|
1 | 1 | // SPDX-License-Identifier: Apache-2.0 |
2 | 2 |
|
3 | 3 | use std::{ |
4 | | - io::ErrorKind, |
| 4 | + io::{ErrorKind, Write}, |
5 | 5 | path::Path, |
6 | 6 | process::{Child, Command}, |
7 | 7 | sync::{ |
@@ -65,6 +65,14 @@ pub fn start_test_tool(level: SecurityLevel) -> Result<Child> { |
65 | 65 | )); |
66 | 66 | } |
67 | 67 | } |
| 68 | + // create file |
| 69 | + let mut file = std::fs::File::create(test_constants::TEST_TOOL_FILE).map_err(|e| { |
| 70 | + anyhow!( |
| 71 | + "failed to create file {}: {e}", |
| 72 | + test_constants::TEST_TOOL_FILE |
| 73 | + ) |
| 74 | + })?; |
| 75 | + file.write_all(b"Hello, World!")?; |
68 | 76 |
|
69 | 77 | // add key |
70 | 78 | Command::new(SEABEECTL_EXE) |
@@ -276,6 +284,10 @@ fn deny_chmod_file() -> Result<(), Failed> { |
276 | 284 | test_utils::try_chmod(test_constants::TEST_TOOL_FILE, false) |
277 | 285 | } |
278 | 286 |
|
| 287 | +fn deny_rename_file() -> Result<(), Failed> { |
| 288 | + test_utils::try_rename(test_constants::TEST_TOOL_FILE, false) |
| 289 | +} |
| 290 | + |
279 | 291 | // check that protected directory attributes cannot be modified |
280 | 292 | fn deny_chmod_dir() -> Result<(), Failed> { |
281 | 293 | test_utils::try_chmod(test_constants::TEST_TOOL_DIR, false) |
@@ -344,6 +356,7 @@ fn block_tests() -> Vec<Trial> { |
344 | 356 | create_test!(deny_open_file), |
345 | 357 | create_test!(deny_chmod_file), |
346 | 358 | create_test!(deny_chmod_dir), |
| 359 | + create_test!(deny_rename_file), |
347 | 360 | create_test!(deny_policy_overwrite), |
348 | 361 | ] |
349 | 362 | } |
|
0 commit comments