checkghlitmus.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0+
  3. #
  4. # Runs the C-language litmus tests having a maximum number of processes
  5. # to run, defaults to 6.
  6. #
  7. # sh checkghlitmus.sh
  8. #
  9. # Run from the Linux kernel tools/memory-model directory. See the
  10. # parseargs.sh scripts for arguments.
  11. . scripts/parseargs.sh
  12. T=/tmp/checkghlitmus.sh.$$
  13. trap 'rm -rf $T' 0
  14. mkdir $T
  15. # Clone the repository if it is not already present.
  16. if test -d litmus
  17. then
  18. :
  19. else
  20. git clone https://github.com/paulmckrcu/litmus
  21. ( cd litmus; git checkout origin/master )
  22. fi
  23. # Create any new directories that have appeared in the github litmus
  24. # repo since the last run.
  25. if test "$LKMM_DESTDIR" != "."
  26. then
  27. find litmus -type d -print |
  28. ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
  29. fi
  30. # Create a list of the C-language litmus tests previously run.
  31. ( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |
  32. sed -e 's/\.out$//' |
  33. xargs -r egrep -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' |
  34. xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already
  35. # Create a list of C-language litmus tests with "Result:" commands and
  36. # no more than the specified number of processes.
  37. find litmus -name '*.litmus' -exec grep -l -m 1 "^C " {} \; > $T/list-C
  38. xargs < $T/list-C -r egrep -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' > $T/list-C-result
  39. xargs < $T/list-C-result -r grep -L "^P${LKMM_PROCS}" > $T/list-C-result-short
  40. # Form list of tests without corresponding .litmus.out files
  41. sort $T/list-C-already $T/list-C-result-short | uniq -u > $T/list-C-needed
  42. # Run any needed tests.
  43. if scripts/runlitmushist.sh < $T/list-C-needed > $T/run.stdout 2> $T/run.stderr
  44. then
  45. errs=
  46. else
  47. errs=1
  48. fi
  49. sed < $T/list-C-result-short -e 's,^,scripts/judgelitmus.sh ,' |
  50. sh > $T/judge.stdout 2> $T/judge.stderr
  51. if test -n "$errs"
  52. then
  53. cat $T/run.stderr 1>&2
  54. fi
  55. grep '!!!' $T/judge.stdout