// Excerpt from directory_read_grant_denies_a_forbidden_hard_link_created_after_compilation. // Fixture construction appears earlier in the source test; this is not a standalone program. let existing_control = compile_for_target(required_path("CHIO_CAGE_TEST_DIRECTORY_READ")); let late_link_attack = compile_for_target(required_path("CHIO_CAGE_TEST_DIRECTORY_HARD_LINK")); std::fs::hard_link(&forbidden_file, &late_forbidden_link).test_unwrap(); for compiled in [existing_control, late_link_attack] { let record = launch(compiled, CageLaunchOptions::default()) .test_unwrap() .wait() .test_unwrap(); assert_eq!( record.exit.as_ref().and_then(|exit| exit.exit_code), Some(0) ); } std::fs::remove_dir_all(&allowed_directory).test_unwrap(); std::fs::remove_file(&forbidden_file).test_unwrap();