xref: /openbmc/linux/tools/memory-model/scripts/initlitmushist.sh (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1b02eb5b0SPaul E. McKenney#!/bin/sh
2b02eb5b0SPaul E. McKenney# SPDX-License-Identifier: GPL-2.0+
3b02eb5b0SPaul E. McKenney#
4b02eb5b0SPaul E. McKenney# Runs the C-language litmus tests matching the specified criteria.
5b02eb5b0SPaul E. McKenney# Generates the output for each .litmus file into a corresponding
6b02eb5b0SPaul E. McKenney# .litmus.out file, and does not judge the result.
7b02eb5b0SPaul E. McKenney#
8b02eb5b0SPaul E. McKenney# sh initlitmushist.sh
9b02eb5b0SPaul E. McKenney#
10b02eb5b0SPaul E. McKenney# Run from the Linux kernel tools/memory-model directory.
11b02eb5b0SPaul E. McKenney# See scripts/parseargs.sh for list of arguments.
12b02eb5b0SPaul E. McKenney#
13b02eb5b0SPaul E. McKenney# This script can consume significant wallclock time and CPU, especially as
14b02eb5b0SPaul E. McKenney# the value of --procs rises.  On a four-core (eight hardware threads)
15b02eb5b0SPaul E. McKenney# 2.5GHz x86 with a one-minute per-run timeout:
16b02eb5b0SPaul E. McKenney#
17b02eb5b0SPaul E. McKenney# --procs wallclock CPU		timeouts	tests
18b02eb5b0SPaul E. McKenney#	1 0m11.241s 0m1.086s           0	   19
19b02eb5b0SPaul E. McKenney#	2 1m12.598s 2m8.459s           2	  393
20b02eb5b0SPaul E. McKenney#	3 1m30.007s 6m2.479s           4	 2291
21b02eb5b0SPaul E. McKenney#	4 3m26.042s 18m5.139s	       9	 3217
22b02eb5b0SPaul E. McKenney#	5 4m26.661s 23m54.128s	      13	 3784
23b02eb5b0SPaul E. McKenney#	6 4m41.900s 26m4.721s         13	 4352
24b02eb5b0SPaul E. McKenney#	7 5m51.463s 35m50.868s        13	 4626
25b02eb5b0SPaul E. McKenney#	8 10m5.235s 68m43.672s        34	 5117
26b02eb5b0SPaul E. McKenney#	9 15m57.80s 105m58.101s       69	 5156
27b02eb5b0SPaul E. McKenney#      10 16m14.13s 103m35.009s       69         5165
28b02eb5b0SPaul E. McKenney#      20 27m48.55s 198m3.286s       156         5269
29b02eb5b0SPaul E. McKenney#
30b02eb5b0SPaul E. McKenney# Increasing the timeout on the 20-process run to five minutes increases
31b02eb5b0SPaul E. McKenney# the runtime to about 90 minutes with the CPU time rising to about
32b02eb5b0SPaul E. McKenney# 10 hours.  On the other hand, it decreases the number of timeouts to 101.
33b02eb5b0SPaul E. McKenney#
34b02eb5b0SPaul E. McKenney# Note that there are historical tests for which herd7 will fail
35b02eb5b0SPaul E. McKenney# completely, for example, litmus/manual/atomic/C-unlock-wait-00.litmus
36b02eb5b0SPaul E. McKenney# contains a call to spin_unlock_wait(), which no longer exists in either
37b02eb5b0SPaul E. McKenney# the kernel or LKMM.
38b02eb5b0SPaul E. McKenney
39b02eb5b0SPaul E. McKenney. scripts/parseargs.sh
40b02eb5b0SPaul E. McKenney
41b02eb5b0SPaul E. McKenneyT=/tmp/initlitmushist.sh.$$
42b02eb5b0SPaul E. McKenneytrap 'rm -rf $T' 0
43b02eb5b0SPaul E. McKenneymkdir $T
44b02eb5b0SPaul E. McKenney
45b02eb5b0SPaul E. McKenneyif test -d litmus
46b02eb5b0SPaul E. McKenneythen
47b02eb5b0SPaul E. McKenney	:
48b02eb5b0SPaul E. McKenneyelse
49b02eb5b0SPaul E. McKenney	git clone https://github.com/paulmckrcu/litmus
50b02eb5b0SPaul E. McKenney	( cd litmus; git checkout origin/master )
51b02eb5b0SPaul E. McKenneyfi
52b02eb5b0SPaul E. McKenney
53b02eb5b0SPaul E. McKenney# Create any new directories that have appeared in the github litmus
54b02eb5b0SPaul E. McKenney# repo since the last run.
55b02eb5b0SPaul E. McKenneyif test "$LKMM_DESTDIR" != "."
56b02eb5b0SPaul E. McKenneythen
57b02eb5b0SPaul E. McKenney	find litmus -type d -print |
58b02eb5b0SPaul E. McKenney	( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )
59b02eb5b0SPaul E. McKenneyfi
60b02eb5b0SPaul E. McKenney
61b02eb5b0SPaul E. McKenney# Create a list of the C-language litmus tests with no more than the
62b02eb5b0SPaul E. McKenney# specified number of processes (per the --procs argument).
63*75eee921SPaul E. McKenneyfind litmus -name '*.litmus' -print | mselect7 -arch C > $T/list-C
64b02eb5b0SPaul E. McKenneyxargs < $T/list-C -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short
65b02eb5b0SPaul E. McKenney
66b02eb5b0SPaul E. McKenneyscripts/runlitmushist.sh < $T/list-C-short
67b02eb5b0SPaul E. McKenney
68b02eb5b0SPaul E. McKenneyexit 0
69