Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/memory-model: Split runlitmus.sh out of checklitmus.sh

This commit prepares for adding --hw capability to github litmus-test
scripts by splitting runlitmus.sh (which simply runs the verification)
out of checklitmus.sh (which also judges the results).

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

+73 -53
+4 -53
tools/memory-model/scripts/checklitmus.sh
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0+ 3 3 # 4 - # Run a herd7 test and invokes judgelitmus.sh to check the result against 5 - # a "Result:" comment within the litmus test. It also outputs verification 6 - # results to a file whose name is that of the specified litmus test, but 7 - # with ".out" appended. 8 - # 9 - # If the --hw argument is specified, this script translates the .litmus 10 - # C-language file to the specified type of assembly and verifies that. 11 - # But in this case, litmus tests using complex synchronization (such as 12 - # locking, RCU, and SRCU) are cheerfully ignored. 4 + # Invokes runlitmus.sh and judgelitmus.sh on its arguments to run the 5 + # specified litmus test and pass judgment on the results. 13 6 # 14 7 # Usage: 15 8 # checklitmus.sh file.litmus ··· 15 22 # 16 23 # Author: Paul E. McKenney <paulmck@linux.ibm.com> 17 24 18 - litmus=$1 19 - if test -f "$litmus" -a -r "$litmus" 20 - then 21 - : 22 - else 23 - echo ' --- ' error: \"$litmus\" is not a readable file 24 - exit 255 25 - fi 26 - 27 - if test -z "$LKMM_HW_MAP_FILE" 28 - then 29 - # LKMM run 30 - herdoptions=${LKMM_HERD_OPTIONS--conf linux-kernel.cfg} 31 - echo Herd options: $herdoptions > $LKMM_DESTDIR/$litmus.out 32 - /usr/bin/time $LKMM_TIMEOUT_CMD herd7 $herdoptions $litmus >> $LKMM_DESTDIR/$litmus.out 2>&1 33 - else 34 - # Hardware run 35 - 36 - T=/tmp/checklitmushw.sh.$$ 37 - trap 'rm -rf $T' 0 2 38 - mkdir $T 39 - 40 - # Generate filenames 41 - catfile="`echo $LKMM_HW_MAP_FILE | tr '[A-Z]' '[a-z]'`.cat" 42 - mapfile="Linux2${LKMM_HW_MAP_FILE}.map" 43 - themefile="$T/${LKMM_HW_MAP_FILE}.theme" 44 - herdoptions="-model $LKMM_HW_CAT_FILE" 45 - hwlitmus=`echo $litmus | sed -e 's/\.litmus$/.'${LKMM_HW_MAP_FILE}'.litmus/'` 46 - hwlitmusfile=`echo $hwlitmus | sed -e 's,^.*/,,'` 47 - 48 - # Don't run on litmus tests with complex synchronization 49 - if ! scripts/simpletest.sh $litmus 50 - then 51 - echo ' --- ' error: \"$litmus\" contains locking, RCU, or SRCU 52 - exit 254 53 - fi 54 - 55 - # Generate the assembly code and run herd7 on it. 56 - gen_theme7 -n 10 -map $mapfile -call Linux.call > $themefile 57 - jingle7 -theme $themefile $litmus > $T/$hwlitmusfile 2> $T/$hwlitmusfile.jingle7.out 58 - /usr/bin/time $LKMM_TIMEOUT_CMD herd7 -model $catfile $T/$hwlitmusfile > $LKMM_DESTDIR/$hwlitmus.out 2>&1 59 - fi 60 - 61 - scripts/judgelitmus.sh $litmus 25 + scripts/runlitmus.sh $1 26 + scripts/judgelitmus.sh $1
+69
tools/memory-model/scripts/runlitmus.sh
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0+ 3 + # 4 + # Without the -hw argument, runs a herd7 test and outputs verification 5 + # results to a file whose name is that of the specified litmus test, 6 + # but with ".out" appended. 7 + # 8 + # If the --hw argument is specified, this script translates the .litmus 9 + # C-language file to the specified type of assembly and verifies that. 10 + # But in this case, litmus tests using complex synchronization (such as 11 + # locking, RCU, and SRCU) are cheerfully ignored. 12 + # 13 + # Either way, return the status of the herd7 command. 14 + # 15 + # Usage: 16 + # runlitmus.sh file.litmus 17 + # 18 + # Run this in the directory containing the memory model, specifying the 19 + # pathname of the litmus test to check. The caller is expected to have 20 + # properly set up the LKMM environment variables. 21 + # 22 + # Copyright IBM Corporation, 2019 23 + # 24 + # Author: Paul E. McKenney <paulmck@linux.ibm.com> 25 + 26 + litmus=$1 27 + if test -f "$litmus" -a -r "$litmus" 28 + then 29 + : 30 + else 31 + echo ' --- ' error: \"$litmus\" is not a readable file 32 + exit 255 33 + fi 34 + 35 + if test -z "$LKMM_HW_MAP_FILE" 36 + then 37 + # LKMM run 38 + herdoptions=${LKMM_HERD_OPTIONS--conf linux-kernel.cfg} 39 + echo Herd options: $herdoptions > $LKMM_DESTDIR/$litmus.out 40 + /usr/bin/time $LKMM_TIMEOUT_CMD herd7 $herdoptions $litmus >> $LKMM_DESTDIR/$litmus.out 2>&1 41 + else 42 + # Hardware run 43 + 44 + T=/tmp/checklitmushw.sh.$$ 45 + trap 'rm -rf $T' 0 2 46 + mkdir $T 47 + 48 + # Generate filenames 49 + catfile="`echo $LKMM_HW_MAP_FILE | tr '[A-Z]' '[a-z]'`.cat" 50 + mapfile="Linux2${LKMM_HW_MAP_FILE}.map" 51 + themefile="$T/${LKMM_HW_MAP_FILE}.theme" 52 + herdoptions="-model $LKMM_HW_CAT_FILE" 53 + hwlitmus=`echo $litmus | sed -e 's/\.litmus$/.'${LKMM_HW_MAP_FILE}'.litmus/'` 54 + hwlitmusfile=`echo $hwlitmus | sed -e 's,^.*/,,'` 55 + 56 + # Don't run on litmus tests with complex synchronization 57 + if ! scripts/simpletest.sh $litmus 58 + then 59 + echo ' --- ' error: \"$litmus\" contains locking, RCU, or SRCU 60 + exit 254 61 + fi 62 + 63 + # Generate the assembly code and run herd on it. 64 + gen_theme7 -n 10 -map $mapfile -call Linux.call > $themefile 65 + jingle7 -theme $themefile $litmus > $T/$hwlitmusfile 2> $T/$hwlitmusfile.jingle7.out 66 + /usr/bin/time $LKMM_TIMEOUT_CMD herd7 -model $catfile $T/$hwlitmusfile > $LKMM_DESTDIR/$hwlitmus.out 2>&1 67 + fi 68 + 69 + exit $?