checkghlitmus.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. . scripts/hwfnseg.sh
  13. T=/tmp/checkghlitmus.sh.$$
  14. trap 'rm -rf $T' 0
  15. mkdir $T
  16. # Clone the repository if it is not already present.
  17. if test -d litmus
  18. then
  19. :
  20. else
  21. git clone https://github.com/paulmckrcu/litmus
  22. ( cd litmus; git checkout origin/master )
  23. fi
  24. # Create any new directories that have appeared in the github litmus
  25. # repo since the last run.
  26. if test "$LKMM_DESTDIR" != "."
  27. then
  28. find litmus -type d -print |
  29. ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
  30. fi
  31. # Create a list of the specified litmus tests previously run.
  32. ( cd $LKMM_DESTDIR; find litmus -name "*.litmus${hwfnseg}.out" -print ) |
  33. sed -e "s/${hwfnseg}"'\.out$//' |
  34. xargs -r grep -E -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' |
  35. xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already
  36. # Create a list of C-language litmus tests with "Result:" commands and
  37. # no more than the specified number of processes.
  38. find litmus -name '*.litmus' -print | mselect7 -arch C > $T/list-C
  39. xargs < $T/list-C -r grep -E -l '^ \* Result: (Never|Sometimes|Always|DEADLOCK)' > $T/list-C-result
  40. xargs < $T/list-C-result -r grep -L "^P${LKMM_PROCS}" > $T/list-C-result-short
  41. # Form list of tests without corresponding .out files
  42. sort $T/list-C-already $T/list-C-result-short | uniq -u > $T/list-C-needed
  43. # Run any needed tests.
  44. if scripts/runlitmushist.sh < $T/list-C-needed > $T/run.stdout 2> $T/run.stderr
  45. then
  46. errs=
  47. else
  48. errs=1
  49. fi
  50. sed < $T/list-C-result-short -e 's,^,scripts/judgelitmus.sh ,' |
  51. sh > $T/judge.stdout 2> $T/judge.stderr
  52. if test -n "$errs"
  53. then
  54. cat $T/run.stderr 1>&2
  55. fi
  56. grep '!!!' $T/judge.stdout