]> git.cworth.org Git - notmuch/blobdiff - test/test-lib.sh
test: check for empty/missing files in test_expect_equal_message_body
[notmuch] / test / test-lib.sh
index eec5c5b4508c1224d7b2510fe3822ce13e374bc0..f218fa03202a886b6144f4f957c2fe3104dece6e 100644 (file)
@@ -388,6 +388,14 @@ test_expect_equal_message_body () {
     test "$#" = 2 ||
        error "bug in the test script: not 2 parameters to test_expect_equal_file"
 
+    for file in "$1" "$2"; do
+       if [ ! -s "$file" ]; then
+           test_failure_ "Missing or zero length file: $file"
+           inside_subtest=
+           return 1
+       fi
+    done
+
     expected=$(sed '1,/^$/d' "$1")
     output=$(sed '1,/^$/d' "$2")
     test_expect_equal "$expected" "$output"
@@ -740,6 +748,12 @@ test_subtest_known_broken () {
        test_subtest_known_broken_=t
 }
 
+test_subtest_broken_for_root () {
+   if [ "$EUID" = "0" ]; then
+       test_subtest_known_broken_=t
+    fi
+}
+
 test_expect_success () {
        exec 1>&6 2>&7          # Restore stdout and stderr
        if [ -z "$inside_subtest" ]; then