18c2ecf20Sopenharmony_ci#!/bin/sh 28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0+ 38c2ecf20Sopenharmony_ci# 48c2ecf20Sopenharmony_ci# Runs the C-language litmus tests matching the specified criteria. 58c2ecf20Sopenharmony_ci# Generates the output for each .litmus file into a corresponding 68c2ecf20Sopenharmony_ci# .litmus.out file, and does not judge the result. 78c2ecf20Sopenharmony_ci# 88c2ecf20Sopenharmony_ci# sh initlitmushist.sh 98c2ecf20Sopenharmony_ci# 108c2ecf20Sopenharmony_ci# Run from the Linux kernel tools/memory-model directory. 118c2ecf20Sopenharmony_ci# See scripts/parseargs.sh for list of arguments. 128c2ecf20Sopenharmony_ci# 138c2ecf20Sopenharmony_ci# This script can consume significant wallclock time and CPU, especially as 148c2ecf20Sopenharmony_ci# the value of --procs rises. On a four-core (eight hardware threads) 158c2ecf20Sopenharmony_ci# 2.5GHz x86 with a one-minute per-run timeout: 168c2ecf20Sopenharmony_ci# 178c2ecf20Sopenharmony_ci# --procs wallclock CPU timeouts tests 188c2ecf20Sopenharmony_ci# 1 0m11.241s 0m1.086s 0 19 198c2ecf20Sopenharmony_ci# 2 1m12.598s 2m8.459s 2 393 208c2ecf20Sopenharmony_ci# 3 1m30.007s 6m2.479s 4 2291 218c2ecf20Sopenharmony_ci# 4 3m26.042s 18m5.139s 9 3217 228c2ecf20Sopenharmony_ci# 5 4m26.661s 23m54.128s 13 3784 238c2ecf20Sopenharmony_ci# 6 4m41.900s 26m4.721s 13 4352 248c2ecf20Sopenharmony_ci# 7 5m51.463s 35m50.868s 13 4626 258c2ecf20Sopenharmony_ci# 8 10m5.235s 68m43.672s 34 5117 268c2ecf20Sopenharmony_ci# 9 15m57.80s 105m58.101s 69 5156 278c2ecf20Sopenharmony_ci# 10 16m14.13s 103m35.009s 69 5165 288c2ecf20Sopenharmony_ci# 20 27m48.55s 198m3.286s 156 5269 298c2ecf20Sopenharmony_ci# 308c2ecf20Sopenharmony_ci# Increasing the timeout on the 20-process run to five minutes increases 318c2ecf20Sopenharmony_ci# the runtime to about 90 minutes with the CPU time rising to about 328c2ecf20Sopenharmony_ci# 10 hours. On the other hand, it decreases the number of timeouts to 101. 338c2ecf20Sopenharmony_ci# 348c2ecf20Sopenharmony_ci# Note that there are historical tests for which herd7 will fail 358c2ecf20Sopenharmony_ci# completely, for example, litmus/manual/atomic/C-unlock-wait-00.litmus 368c2ecf20Sopenharmony_ci# contains a call to spin_unlock_wait(), which no longer exists in either 378c2ecf20Sopenharmony_ci# the kernel or LKMM. 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci. scripts/parseargs.sh 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ciT=/tmp/initlitmushist.sh.$$ 428c2ecf20Sopenharmony_citrap 'rm -rf $T' 0 438c2ecf20Sopenharmony_cimkdir $T 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ciif test -d litmus 468c2ecf20Sopenharmony_cithen 478c2ecf20Sopenharmony_ci : 488c2ecf20Sopenharmony_cielse 498c2ecf20Sopenharmony_ci git clone https://github.com/paulmckrcu/litmus 508c2ecf20Sopenharmony_ci ( cd litmus; git checkout origin/master ) 518c2ecf20Sopenharmony_cifi 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci# Create any new directories that have appeared in the github litmus 548c2ecf20Sopenharmony_ci# repo since the last run. 558c2ecf20Sopenharmony_ciif test "$LKMM_DESTDIR" != "." 568c2ecf20Sopenharmony_cithen 578c2ecf20Sopenharmony_ci find litmus -type d -print | 588c2ecf20Sopenharmony_ci ( cd "$LKMM_DESTDIR"; sed -e 's/^/mkdir -p /' | sh ) 598c2ecf20Sopenharmony_cifi 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci# Create a list of the C-language litmus tests with no more than the 628c2ecf20Sopenharmony_ci# specified number of processes (per the --procs argument). 638c2ecf20Sopenharmony_cifind litmus -name '*.litmus' -exec grep -l -m 1 "^C " {} \; > $T/list-C 648c2ecf20Sopenharmony_cixargs < $T/list-C -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ciscripts/runlitmushist.sh < $T/list-C-short 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ciexit 0 69