Browse Source

allow to skip tests, if uClibc-ng feature is disabled

Waldemar Brodkorb 7 years ago
parent
commit
05df1d32db
3 changed files with 17 additions and 5 deletions
  1. 5 2
      test/crypt/sha256c-test.c
  2. 4 3
      test/crypt/sha512c-test.c
  3. 8 0
      test/uclibcng-testrunner.sh

+ 5 - 2
test/crypt/sha256c-test.c

@@ -39,9 +39,9 @@ static const struct
 static int
 do_test (void)
 {
+#if __UCLIBC_HAS_SHA256_CRYPT_IMPL__
   int result = 0;
 
-#if __UCLIBC_HAS_SHA256_CRYPT_IMPL__
   int i;
 
   for (i = 0; i < ntests; ++i)
@@ -55,9 +55,12 @@ do_test (void)
 	  result = 1;
 	}
     }
-#endif
 
   return result;
+#else
+  return 23;
+#endif
+
 }
 
 #define TIMEOUT 6

+ 4 - 3
test/crypt/sha512c-test.c

@@ -40,9 +40,9 @@ static const struct
 static int
 do_test (void)
 {
+#if __UCLIBC_HAS_SHA512_CRYPT_IMPL__
   int result = 0;
 
-#if __UCLIBC_HAS_SHA512_CRYPT_IMPL__
   int i;
 
   for (i = 0; i < ntests; ++i)
@@ -56,9 +56,10 @@ do_test (void)
 	  result = 1;
 	}
     }
-#endif
-
   return result;
+#else
+  return 23;
+#endif
 }
 
 #define TIMEOUT 6

+ 8 - 0
test/uclibcng-testrunner.sh

@@ -28,11 +28,18 @@ die() {
 test -s uclibcng-testrunner.in || die uclibcng-testrunner.in not found
 
 nfail=0
+nskip=0
 npass=0
 while read expected_ret tst_src_name binary_name subdir cmd; do
 	printf '.... %s\r' "$binary_name"
 	(cd $subdir && eval "$cmd" >$binary_name.out 2>&1) </dev/null
 	ret=$?
+	test $ret = "23" && {
+		echo "SKIP $binary_name"
+		nskip=`expr $nskip + 1`
+		sed 's/^/	/' <$subdir/$binary_name.out
+		continue
+	}
 	test $ret = "$expected_ret" || {
 		echo "FAIL $binary_name got $ret expected $expected_ret"
 		nfail=`expr $nfail + 1`
@@ -57,6 +64,7 @@ while read expected_ret tst_src_name binary_name subdir cmd; do
 		break
 	done
 done <uclibcng-testrunner.in
+echo Total skipped: $nskip
 echo Total failed: $nfail
 echo Total passed: $npass
 test $nfail = 0