summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre@debian.org>2024-06-02 12:24:50 +0200
committerSylvestre Ledru <sylvestre@debian.org>2024-06-02 15:46:55 +0200
commit773d8cfbc66c6a126e270495a03c9b0409049e5c (patch)
tree9e75c1d1d573573f7d3ef7b5943f61f54d670eb7 /tests
parentb1b6f28b76562bedd4afc64365c566dc0a18323a (diff)
cksum/hashsum: fix the windows tests + improve some
Diffstat (limited to 'tests')
-rw-r--r--tests/by-util/test_cksum.rs11
-rw-r--r--tests/by-util/test_hashsum.rs37
2 files changed, 43 insertions, 5 deletions
diff --git a/tests/by-util/test_cksum.rs b/tests/by-util/test_cksum.rs
index b4f561c66..dcefebb51 100644
--- a/tests/by-util/test_cksum.rs
+++ b/tests/by-util/test_cksum.rs
@@ -1192,8 +1192,17 @@ fn test_check_directory_error() {
"f",
"BLAKE2b (d) = 786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce\n"
);
+ let err_msg: &str;
+ #[cfg(not(windows))]
+ {
+ err_msg = "cksum: d: Is a directory\n";
+ }
+ #[cfg(windows)]
+ {
+ err_msg = "cksum: d: Permission denied\n";
+ }
ucmd.arg("--check")
.arg(at.subdir.join("f"))
.fails()
- .stderr_contains("cksum: d: Is a directory\n");
+ .stderr_contains(err_msg);
}
diff --git a/tests/by-util/test_hashsum.rs b/tests/by-util/test_hashsum.rs
index 289afcba7..63af9f1f2 100644
--- a/tests/by-util/test_hashsum.rs
+++ b/tests/by-util/test_hashsum.rs
@@ -687,6 +687,8 @@ fn test_sha1_with_md5sum_should_fail() {
}
#[test]
+// Disabled on Windows because of the "*"
+#[cfg(not(windows))]
fn test_check_one_two_space_star() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
@@ -724,6 +726,8 @@ fn test_check_one_two_space_star() {
}
#[test]
+// Disabled on Windows because of the "*"
+#[cfg(not(windows))]
fn test_check_space_star_or_not() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
@@ -833,12 +837,21 @@ fn test_check_directory_error() {
at.mkdir("d");
at.write("in.md5", "d41d8cd98f00b204e9800998ecf8427f d\n");
+ let err_msg: &str;
+ #[cfg(not(windows))]
+ {
+ err_msg = "md5sum: d: Is a directory\n";
+ }
+ #[cfg(windows)]
+ {
+ err_msg = "md5sum: d: Permission denied\n";
+ }
scene
.ccmd("md5sum")
.arg("--check")
.arg(at.subdir.join("in.md5"))
.fails()
- .stderr_contains("md5sum: d: Is a directory\n");
+ .stderr_contains(err_msg);
}
#[test]
@@ -854,8 +867,7 @@ fn test_check_quiet() {
.arg("--check")
.arg(at.subdir.join("in.md5"))
.succeeds()
- .stderr_is("")
- .stdout_is("");
+ .no_output();
// incorrect md5
at.write("in.md5", "d41d8cd98f00b204e9800998ecf8427f f\n");
@@ -875,12 +887,29 @@ fn test_star_to_start() {
let at = &scene.fixtures;
at.touch("f");
- at.write("in.md5", "d41d8cd98f00b204e9800998ecf8427e */dev/null\n");
+ at.write("in.md5", "d41d8cd98f00b204e9800998ecf8427e *f\n");
scene
.ccmd("md5sum")
.arg("--check")
.arg(at.subdir.join("in.md5"))
.succeeds()
+ .stdout_only("f: OK\n");
+}
+
+#[test]
+fn test_b2sum_128() {
+ let scene = TestScenario::new(util_name!());
+ let at = &scene.fixtures;
+
+ at.touch("f");
+ at.write("in.b2sum", "786a02f742015903c6c6fd852552d272912f4740e15847618a86e217f71f5419d25e1031afee585313896444934eb04b903a685b1448b755d56f701afe9be2ce /dev/null\n");
+ scene
+ .ccmd("b2sum")
+ .arg("--check")
+ .arg("-l")
+ .arg("128")
+ .arg(at.subdir.join("in.b2sum"))
+ .succeeds()
.stderr_is("")
.stdout_is("/dev/null: OK\n");
}