checkalllitmus.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash
  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. # If the --hw argument is specified, this script translates the .litmus
  12. # C-language file to the specified type of assembly and verifies that.
  13. # But in this case, litmus tests using complex synchronization (such as
  14. # locking, RCU, and SRCU) are cheerfully ignored.
  15. #
  16. # Usage:
  17. # checkalllitmus.sh
  18. #
  19. # Run this in the directory containing the memory model.
  20. #
  21. # This script makes no attempt to run the litmus tests concurrently.
  22. #
  23. # Copyright IBM Corporation, 2018
  24. #
  25. # Author: Paul E. McKenney <paulmck@linux.ibm.com>
  26. . scripts/parseargs.sh
  27. litmusdir=litmus-tests
  28. if test -d "$litmusdir" -a -r "$litmusdir" -a -x "$litmusdir"
  29. then
  30. :
  31. else
  32. echo ' --- ' error: $litmusdir is not an accessible directory
  33. exit 255
  34. fi
  35. # Create any new directories that have appeared in the litmus-tests
  36. # directory since the last run.
  37. if test "$LKMM_DESTDIR" != "."
  38. then
  39. find $litmusdir -type d -print |
  40. ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
  41. fi
  42. # Run the script on all the litmus tests in the specified directory
  43. ret=0
  44. for i in $litmusdir/*.litmus
  45. do
  46. if test -n "$LKMM_HW_MAP_FILE" && ! scripts/simpletest.sh $i
  47. then
  48. continue
  49. fi
  50. if ! scripts/checklitmus.sh $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