checkalllitmus.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. #
  3. # Run herd tests on all .litmus files in the specified directory (which
  4. # defaults to litmus-tests) and check each file's result against a "Result:"
  5. # comment within that litmus test. If the verification result does not
  6. # match that specified in the litmus test, this script prints an error
  7. # message prefixed with "^^^". It also outputs verification results to
  8. # a file whose name is that of the specified litmus test, but with ".out"
  9. # appended.
  10. #
  11. # Usage:
  12. # checkalllitmus.sh [ directory ]
  13. #
  14. # The LINUX_HERD_OPTIONS environment variable may be used to specify
  15. # arguments to herd, whose default is defined by the checklitmus.sh script.
  16. # Thus, one would normally run this in the directory containing the memory
  17. # model, specifying the pathname of the litmus test to check.
  18. #
  19. # This script makes no attempt to run the litmus tests concurrently.
  20. #
  21. # This program is free software; you can redistribute it and/or modify
  22. # it under the terms of the GNU General Public License as published by
  23. # the Free Software Foundation; either version 2 of the License, or
  24. # (at your option) any later version.
  25. #
  26. # This program is distributed in the hope that it will be useful,
  27. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  28. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  29. # GNU General Public License for more details.
  30. #
  31. # You should have received a copy of the GNU General Public License
  32. # along with this program; if not, you can access it online at
  33. # http://www.gnu.org/licenses/gpl-2.0.html.
  34. #
  35. # Copyright IBM Corporation, 2018
  36. #
  37. # Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  38. litmusdir=${1-litmus-tests}
  39. if test -d "$litmusdir" -a -r "$litmusdir" -a -x "$litmusdir"
  40. then
  41. :
  42. else
  43. echo ' --- ' error: $litmusdir is not an accessible directory
  44. exit 255
  45. fi
  46. # Find the checklitmus script. If it is not where we expect it, then
  47. # assume that the caller has the PATH environment variable set
  48. # appropriately.
  49. if test -x scripts/checklitmus.sh
  50. then
  51. clscript=scripts/checklitmus.sh
  52. else
  53. clscript=checklitmus.sh
  54. fi
  55. # Run the script on all the litmus tests in the specified directory
  56. ret=0
  57. for i in litmus-tests/*.litmus
  58. do
  59. if ! $clscript $i
  60. then
  61. ret=1
  62. fi
  63. done
  64. if test "$ret" -ne 0
  65. then
  66. echo " ^^^ VERIFICATION MISMATCHES"
  67. else
  68. echo All litmus tests verified as was expected.
  69. fi
  70. exit $ret