Hello

As attachment, two tests of cksum covering when several files are passed.

One tests when the files are missing

The second when the file exists but empty.

Currently, this isn't covered.

Thanks

Sylvestre

From fabe8ff5f40d98da4d73361ca652c98fcc98addd Mon Sep 17 00:00:00 2001
From: Sylvestre Ledru <sylves...@debian.org>
Date: Mon, 1 Jul 2024 23:45:09 +0200
Subject: [PATCH] tests: cksum: check when several files are missing or
 incorrect

 * tests/cksum/cksum-c.sh: Add test cases when several files with errors
---
 tests/cksum/cksum-c.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tests/cksum/cksum-c.sh b/tests/cksum/cksum-c.sh
index 3ead14504..b07fc9418 100755
--- a/tests/cksum/cksum-c.sh
+++ b/tests/cksum/cksum-c.sh
@@ -143,4 +143,15 @@ test -s out || fail=1
 grep 'CHECKSUMS-missing: no file was verified' out || fail=1
 grep -v 'nonexistent: No such file or directory' stdout && fail=1
 
+# Check with several files
+# When the files don't exist
+cksum --check non-existing-1 non-existing-2 > out 2>&1 && fail=1
+grep -v 'non-existing-1: No such file or directory' out || fail=1
+grep -v 'non-existing-2: No such file or directory' out || fail=1
+
+# When the files are empty
+touch empty-1 empty-2
+cksum --check empty-1 empty-2 > out 2>&1 && fail=1
+grep -v 'empty-1: no properly formatted checksum lines found' out || fail=1
+grep -v 'empty-2: no properly formatted checksum lines found' out || fail=1
 Exit $fail
-- 
2.43.0

Reply via email to