uclibcng-testrunner.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. #-
  3. # Copyright (c) 2015
  4. # Thorsten "mirabilos" Glaser <tg@mirbsd.org>
  5. #
  6. # Provided that these terms and disclaimer and all copyright notices
  7. # are retained or reproduced in an accompanying document, permission
  8. # is granted to deal in this work without restriction, including un-
  9. # limited rights to use, publicly perform, distribute, sell, modify,
  10. # merge, give away, or sublicence.
  11. #
  12. # This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
  13. # the utmost extent permitted by applicable law, neither express nor
  14. # implied; without malicious intent or gross negligence. In no event
  15. # may a licensor, author or contributor be held liable for indirect,
  16. # direct, other damage, loss, or other issues arising in any way out
  17. # of dealing in the work, even if advised of the possibility of such
  18. # damage or existence of a defect, except proven that it results out
  19. # of said person's immediate fault when using the work as intended.
  20. #-
  21. # Testsuite runner
  22. die() {
  23. echo >&2 E: "$*"
  24. exit 1
  25. }
  26. test -s uclibcng-testrunner.in || die uclibcng-testrunner.in not found
  27. nfail=0
  28. nskip=0
  29. npass=0
  30. while read expected_ret tst_src_name binary_name subdir cmd; do
  31. printf '.... %s\r' "$binary_name"
  32. (cd $subdir && eval "$cmd" >$binary_name.out 2>&1) </dev/null
  33. ret=$?
  34. test $ret = "23" && {
  35. echo "SKIP $binary_name"
  36. nskip=`expr $nskip + 1`
  37. sed 's/^/ /' <$subdir/$binary_name.out
  38. continue
  39. }
  40. test $ret = "$expected_ret" || {
  41. echo "FAIL $binary_name got $ret expected $expected_ret"
  42. nfail=`expr $nfail + 1`
  43. sed 's/^/ /' <$subdir/$binary_name.out
  44. continue
  45. }
  46. for x in $binary_name.out $test_src_name.out -; do
  47. if test x"$x" = x"-"; then
  48. echo "PASS $binary_name"
  49. npass=`expr $npass + 1`
  50. break
  51. fi
  52. test -e "$subdir/$x.good" || continue
  53. if d=`diff -u "$subdir/$binary_name.out" "$subdir/$x.good"`; then
  54. echo "PASS $binary_name"
  55. npass=`expr $npass + 1`
  56. else
  57. echo "FAIL $binary_name expected output differs"
  58. nfail=`expr $nfail + 1`
  59. echo "$d" | sed 's/^/ /'
  60. fi
  61. break
  62. done
  63. done <uclibcng-testrunner.in
  64. echo Total skipped: $nskip
  65. echo Total failed: $nfail
  66. echo Total passed: $npass
  67. test $nfail = 0