checklitmushist.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0+
  3. #
  4. # Reruns the C-language litmus tests previously run that match the
  5. # specified criteria, and compares the result to that of the previous
  6. # runs from initlitmushist.sh and/or newlitmushist.sh.
  7. #
  8. # sh checklitmushist.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/checklitmushist.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 the results directory and populate it with subdirectories.
  28. # The initial output is created here to avoid clobbering the output
  29. # generated earlier.
  30. mkdir $T/results
  31. find litmus -type d -print | ( cd $T/results; sed -e 's/^/mkdir -p /' | sh )
  32. # Create the list of litmus tests already run, then remove those that
  33. # are excluded by this run's --procs argument.
  34. ( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) |
  35. sed -e 's/\.out$//' |
  36. xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already
  37. xargs < $T/list-C-already -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short
  38. # Redirect output, run tests, then restore destination directory.
  39. destdir="$LKMM_DESTDIR"
  40. LKMM_DESTDIR=$T/results; export LKMM_DESTDIR
  41. scripts/runlitmushist.sh < $T/list-C-short > $T/runlitmushist.sh.out 2>&1
  42. LKMM_DESTDIR="$destdir"; export LKMM_DESTDIR
  43. # Move the newly generated .litmus.out files to .litmus.out.new files
  44. # in the destination directory.
  45. cdir=`pwd`
  46. ddir=`awk -v c="$cdir" -v d="$LKMM_DESTDIR" \
  47. 'END { if (d ~ /^\//) print d; else print c "/" d; }' < /dev/null`
  48. ( cd $T/results; find litmus -type f -name '*.litmus.out' -print |
  49. sed -e 's,^.*$,cp & '"$ddir"'/&.new,' | sh )
  50. sed < $T/list-C-short -e 's,^,'"$LKMM_DESTDIR/"',' |
  51. sh scripts/cmplitmushist.sh
  52. exit $?