summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2026-07-19 15:07:23 +0200
committerMiguel Ojeda <ojeda@kernel.org>2026-08-03 08:03:24 +0200
commitfd045c81ed45517b023ea95e7b80a801c48e5463 (patch)
tree29fb405f296a2570d10e561f817affd6cbba49f1 /scripts
parent16861ca3508e0deac70d3bcacb6dcf435b49d9ef (diff)
downloadlinux-next-fd045c81ed45517b023ea95e7b80a801c48e5463.tar.gz
linux-next-fd045c81ed45517b023ea95e7b80a801c48e5463.zip
rust: rust_is_available: support testing with `bash` as `/bin/sh`
`command -v` behaves differently on `dash` vs. `bash` when faced with a file without the execute bit. Thus, for the non-executable `rustc` and `bindgen` tests, support both possible outputs that the script currently gives. This makes the test script clean on distributions like Fedora. Reviewed-by: Onur Özkan <work@onurozkan.dev> Link: https://patch.msgid.link/20260719130723.162899-1-ojeda@kernel.org [ Added custom assertion message as suggested. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/rust_is_available_test.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/rust_is_available_test.py b/scripts/rust_is_available_test.py
index d6d54b7ea42a..b205d792550d 100755
--- a/scripts/rust_is_available_test.py
+++ b/scripts/rust_is_available_test.py
@@ -177,7 +177,13 @@ else:
def test_rustc_nonexecutable(self):
result = self.run_script(self.Expected.FAILURE, { "RUSTC": self.nonexecutable })
- self.assertIn(f"Running '{self.nonexecutable}' to check the Rust compiler version failed with", result.stderr)
+ self.assertTrue(
+ # `dash`.
+ f"Running '{self.nonexecutable}' to check the Rust compiler version failed with" in result.stderr or
+ # `bash`.
+ f"Rust compiler '{self.nonexecutable}' could not be found." in result.stderr,
+ f"Unexpected `stderr`:\n{result.stderr}"
+ )
def test_rustc_unexpected_binary(self):
result = self.run_script(self.Expected.FAILURE, { "RUSTC": self.unexpected_binary })
@@ -205,7 +211,13 @@ else:
def test_bindgen_nonexecutable(self):
result = self.run_script(self.Expected.FAILURE, { "BINDGEN": self.nonexecutable })
- self.assertIn(f"Running '{self.nonexecutable}' to check the Rust bindings generator version failed with", result.stderr)
+ self.assertTrue(
+ # `dash`.
+ f"Running '{self.nonexecutable}' to check the Rust bindings generator version failed with" in result.stderr or
+ # `bash`.
+ f"Rust bindings generator '{self.nonexecutable}' could not be found." in result.stderr,
+ f"Unexpected `stderr`:\n{result.stderr}"
+ )
def test_bindgen_unexpected_binary(self):
result = self.run_script(self.Expected.FAILURE, { "BINDGEN": self.unexpected_binary })