newlitmushist.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0+
  3. #
  4. # Runs the C-language litmus tests matching the specified criteria
  5. # that do not already have a corresponding .litmus.out file, and does
  6. # not judge the result.
  7. #
  8. # sh newlitmushist.sh
  9. #
  10. # Run from the Linux kernel tools/memory-model directory.
  11. # See scripts/parseargs.sh for list of arguments.
  12. #
  13. # Copyright IBM Corporation, 2018
  14. #
  15. # Author: Paul E. McKenney <[email protected]>
  16. . scripts/parseargs.sh
  17. T=/tmp/newlitmushist.sh.$$
  18. trap 'rm -rf $T' 0
  19. mkdir $T
  20. if test -d litmus
  21. then
  22. :
  23. else
  24. echo Run scripts/initlitmushist.sh first, need litmus repo.
  25. exit 1
  26. fi
  27. # Create any new directories that have appeared in the github litmus
  28. # repo since the last run.
  29. if test "$LKMM_DESTDIR" != "."
  30. then
  31. find litmus -type d -print |
  32. ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
  33. fi
  34. # Create a list of the C-language litmus tests previously run.
  35. ( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |
  36. sed -e 's/\.out$//' |
  37. xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already
  38. # Form full list of litmus tests with no more than the specified
  39. # number of processes (per the --procs argument).
  40. find litmus -name '*.litmus' -exec grep -l -m 1 "^C " {} \; > $T/list-C-all
  41. xargs < $T/list-C-all -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short
  42. # Form list of new tests. Note: This does not handle litmus-test deletion!
  43. sort $T/list-C-already $T/list-C-short | uniq -u > $T/list-C-new
  44. # Form list of litmus tests that have changed since the last run.
  45. sed < $T/list-C-short -e 's,^.*$,if test & -nt '"$LKMM_DESTDIR"'/&.out; then echo &; fi,' > $T/list-C-script
  46. sh $T/list-C-script > $T/list-C-newer
  47. # Merge the list of new and of updated litmus tests: These must be (re)run.
  48. sort -u $T/list-C-new $T/list-C-newer > $T/list-C-needed
  49. scripts/runlitmushist.sh < $T/list-C-needed
  50. exit 0