From 80bfec17eb843c311e8dfca76862a45e6a716fc8 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 30 May 2022 11:51:07 -0400 Subject: [PATCH 1/2] find/matchers: Implement -mount as an alias for -xdev --- src/find/matchers/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/find/matchers/mod.rs b/src/find/matchers/mod.rs index 4cdb6e6f..49d9813f 100644 --- a/src/find/matchers/mod.rs +++ b/src/find/matchers/mod.rs @@ -463,7 +463,7 @@ fn build_matcher_tree( config.depth_first = true; None } - "-xdev" => { + "-mount" | "-xdev" => { // TODO add warning if it appears after actual testing criterion config.same_file_system = true; None From 1bfbe7623e5f66beb36d980b1fa62b086cc5f9ca Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Tue, 31 May 2022 17:01:35 -0400 Subject: [PATCH 2/2] tests: Add a simple integration test for find -mount/-xdev --- tests/find_cmd_tests.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/find_cmd_tests.rs b/tests/find_cmd_tests.rs index 45e68a10..619c138c 100644 --- a/tests/find_cmd_tests.rs +++ b/tests/find_cmd_tests.rs @@ -378,3 +378,26 @@ fn find_perm() { .assert() .success(); } + +#[serial(working_dir)] +#[test] +fn find_mount_xdev() { + // Make sure that -mount/-xdev doesn't prune unexpectedly. + // TODO: Test with a mount point in the search. + + Command::cargo_bin("find") + .expect("found binary") + .args(&["test_data", "-mount"]) + .assert() + .success() + .stderr(predicate::str::is_empty()) + .stdout(predicate::str::contains("abbbc")); + + Command::cargo_bin("find") + .expect("found binary") + .args(&["test_data", "-xdev"]) + .assert() + .success() + .stderr(predicate::str::is_empty()) + .stdout(predicate::str::contains("abbbc")); +}