18c2ecf20Sopenharmony_ci#!/bin/sh 28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0+ 38c2ecf20Sopenharmony_ci# 48c2ecf20Sopenharmony_ci# Reruns the C-language litmus tests previously run that match the 58c2ecf20Sopenharmony_ci# specified criteria, and compares the result to that of the previous 68c2ecf20Sopenharmony_ci# runs from initlitmushist.sh and/or newlitmushist.sh. 78c2ecf20Sopenharmony_ci# 88c2ecf20Sopenharmony_ci# sh checklitmushist.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# Copyright IBM Corporation, 2018 148c2ecf20Sopenharmony_ci# 158c2ecf20Sopenharmony_ci# Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci. scripts/parseargs.sh 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciT=/tmp/checklitmushist.sh.$$ 208c2ecf20Sopenharmony_citrap 'rm -rf $T' 0 218c2ecf20Sopenharmony_cimkdir $T 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciif test -d litmus 248c2ecf20Sopenharmony_cithen 258c2ecf20Sopenharmony_ci : 268c2ecf20Sopenharmony_cielse 278c2ecf20Sopenharmony_ci echo Run scripts/initlitmushist.sh first, need litmus repo. 288c2ecf20Sopenharmony_ci exit 1 298c2ecf20Sopenharmony_cifi 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci# Create the results directory and populate it with subdirectories. 328c2ecf20Sopenharmony_ci# The initial output is created here to avoid clobbering the output 338c2ecf20Sopenharmony_ci# generated earlier. 348c2ecf20Sopenharmony_cimkdir $T/results 358c2ecf20Sopenharmony_cifind litmus -type d -print | ( cd $T/results; sed -e 's/^/mkdir -p /' | sh ) 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci# Create the list of litmus tests already run, then remove those that 388c2ecf20Sopenharmony_ci# are excluded by this run's --procs argument. 398c2ecf20Sopenharmony_ci( cd $LKMM_DESTDIR; find litmus -name '*.litmus.out' -print ) | 408c2ecf20Sopenharmony_ci sed -e 's/\.out$//' | 418c2ecf20Sopenharmony_ci xargs -r grep -L "^P${LKMM_PROCS}"> $T/list-C-already 428c2ecf20Sopenharmony_cixargs < $T/list-C-already -r grep -L "^P${LKMM_PROCS}" > $T/list-C-short 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci# Redirect output, run tests, then restore destination directory. 458c2ecf20Sopenharmony_cidestdir="$LKMM_DESTDIR" 468c2ecf20Sopenharmony_ciLKMM_DESTDIR=$T/results; export LKMM_DESTDIR 478c2ecf20Sopenharmony_ciscripts/runlitmushist.sh < $T/list-C-short > $T/runlitmushist.sh.out 2>&1 488c2ecf20Sopenharmony_ciLKMM_DESTDIR="$destdir"; export LKMM_DESTDIR 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci# Move the newly generated .litmus.out files to .litmus.out.new files 518c2ecf20Sopenharmony_ci# in the destination directory. 528c2ecf20Sopenharmony_cicdir=`pwd` 538c2ecf20Sopenharmony_ciddir=`awk -v c="$cdir" -v d="$LKMM_DESTDIR" \ 548c2ecf20Sopenharmony_ci 'END { if (d ~ /^\//) print d; else print c "/" d; }' < /dev/null` 558c2ecf20Sopenharmony_ci( cd $T/results; find litmus -type f -name '*.litmus.out' -print | 568c2ecf20Sopenharmony_ci sed -e 's,^.*$,cp & '"$ddir"'/&.new,' | sh ) 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_cised < $T/list-C-short -e 's,^,'"$LKMM_DESTDIR/"',' | 598c2ecf20Sopenharmony_ci sh scripts/cmplitmushist.sh 608c2ecf20Sopenharmony_ciexit $? 61