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