checkalllitmus.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0+
  3. #
  4. # Run herd7 tests on all .litmus files in the litmus-tests directory
  5. # and check each file's result against a "Result:" comment within that
  6. # litmus test. If the verification result does not match that specified
  7. # in the litmus test, this script prints an error message prefixed with
  8. # "^^^". It also outputs verification results to a file whose name is
  9. # that of the specified litmus test, but with ".out" appended.
  10. #
  11. # Usage:
  12. # checkalllitmus.sh
  13. #
  14. # Run this in the directory containing the memory model.
  15. #
  16. # This script makes no attempt to run the litmus tests concurrently.
  17. #
  18. # Copyright IBM Corporation, 2018
  19. #
  20. # Author: Paul E. McKenney <[email protected]>
  21. . scripts/parseargs.sh
  22. litmusdir=litmus-tests
  23. if test -d "$litmusdir" -a -r "$litmusdir" -a -x "$litmusdir"
  24. then
  25. :
  26. else
  27. echo ' --- ' error: $litmusdir is not an accessible directory
  28. exit 255
  29. fi
  30. # Create any new directories that have appeared in the github litmus
  31. # repo since the last run.
  32. if test "$LKMM_DESTDIR" != "."
  33. then
  34. find $litmusdir -type d -print |
  35. ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
  36. fi
  37. # Find the checklitmus script. If it is not where we expect it, then
  38. # assume that the caller has the PATH environment variable set
  39. # appropriately.
  40. if test -x scripts/checklitmus.sh
  41. then
  42. clscript=scripts/checklitmus.sh
  43. else
  44. clscript=checklitmus.sh
  45. fi
  46. # Run the script on all the litmus tests in the specified directory
  47. ret=0
  48. for i in $litmusdir/*.litmus
  49. do
  50. if ! $clscript $i
  51. then
  52. ret=1
  53. fi
  54. done
  55. if test "$ret" -ne 0
  56. then
  57. echo " ^^^ VERIFICATION MISMATCHES" 1>&2
  58. else
  59. echo All litmus tests verified as was expected. 1>&2
  60. fi
  61. exit $ret