69 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.0+3#4# Runs the C-language litmus tests matching the specified criteria.5# Generates the output for each .litmus file into a corresponding6# .litmus.out file, and does not judge the result.7#8# sh initlitmushist.sh9#10# Run from the Linux kernel tools/memory-model directory.11# See scripts/parseargs.sh for list of arguments.12#13# This script can consume significant wallclock time and CPU, especially as14# the value of --procs rises. On a four-core (eight hardware threads)15# 2.5GHz x86 with a one-minute per-run timeout:16#17# --procs wallclock CPU timeouts tests18# 1 0m11.241s 0m1.086s 0 1919# 2 1m12.598s 2m8.459s 2 39320# 3 1m30.007s 6m2.479s 4 229121# 4 3m26.042s 18m5.139s 9 321722# 5 4m26.661s 23m54.128s 13 378423# 6 4m41.900s 26m4.721s 13 435224# 7 5m51.463s 35m50.868s 13 462625# 8 10m5.235s 68m43.672s 34 511726# 9 15m57.80s 105m58.101s 69 515627# 10 16m14.13s 103m35.009s 69 516528# 20 27m48.55s 198m3.286s 156 526929#30# Increasing the timeout on the 20-process run to five minutes increases31# the runtime to about 90 minutes with the CPU time rising to about32# 10 hours. On the other hand, it decreases the number of timeouts to 101.33#34# Note that there are historical tests for which herd7 will fail35# completely, for example, litmus/manual/atomic/C-unlock-wait-00.litmus36# contains a call to spin_unlock_wait(), which no longer exists in either37# the kernel or LKMM.38 39. scripts/parseargs.sh40 41T=/tmp/initlitmushist.sh.$$42trap 'rm -rf $T' 043mkdir $T44 45if test -d litmus46then47 :48else49 git clone https://github.com/paulmckrcu/litmus50 ( cd litmus; git checkout origin/master )51fi52 53# Create any new directories that have appeared in the github litmus54# repo since the last run.55if test "$LKMM_DESTDIR" != "."56then57 find litmus -type d -print |58 ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh )59fi60 61# Create a list of the C-language litmus tests with no more than the62# specified number of processes (per the --procs argument).63find litmus -name '*.litmus' -print | mselect7 -arch C > $T/list-C64xargs < $T/list-C -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short65 66scripts/runlitmushist.sh < $T/list-C-short67 68exit 069