brintos

brintos / linux-shallow public Read only

0
0
Text · 3.2 KiB · ed0ec7f Raw
103 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.0+3#4# Run a group of kvm.sh tests on the specified commits.  This currently5# unconditionally does three-minute runs on each scenario in CFLIST,6# taking advantage of all available CPUs and trusting the "make" utility.7# In the short term, adjustments can be made by editing this script and8# CFLIST.  If some adjustments appear to have ongoing value, this script9# might grow some command-line arguments.10#11# Usage: kvm-check-branches.sh commit1 commit2..commit3 commit4 ...12#13# This script considers its arguments one at a time.  If more elaborate14# specification of commits is needed, please use "git rev-list" to15# produce something that this simple script can understand.  The reason16# for retaining the simplicity is that it allows the user to more easily17# see which commit came from which branch.18#19# This script creates a yyyy.mm.dd-hh.mm.ss-group entry in the "res"20# directory.  The calls to kvm.sh create the usual entries, but this script21# moves them under the yyyy.mm.dd-hh.mm.ss-group entry, each in its own22# directory numbered in run order, that is, "0001", "0002", and so on.23# For successful runs, the large build artifacts are removed.  Doing this24# reduces the disk space required by about two orders of magnitude for25# successful runs.26#27# Copyright (C) Facebook, 202028#29# Authors: Paul E. McKenney <paulmck@kernel.org>30 31if ! git status > /dev/null 2>&132then33	echo '!!!' This script needs to run in a git archive. 1>&234	echo '!!!' Giving up. 1>&235	exit 136fi37 38# Remember where we started so that we can get back at the end.39curcommit="`git status | head -1 | awk '{ print $NF }'`"40 41nfail=042ntry=043resdir="tools/testing/selftests/rcutorture/res"44ds="`date +%Y.%m.%d-%H.%M.%S`-group"45if ! test -e $resdir46then47	mkdir $resdir || :48fi49mkdir $resdir/$ds50echo Results directory: $resdir/$ds51 52RCUTORTURE="`pwd`/tools/testing/selftests/rcutorture"; export RCUTORTURE53PATH=${RCUTORTURE}/bin:$PATH; export PATH54. functions.sh55echo Using all `identify_qemu_vcpus` CPUs.56 57# Each pass through this loop does one command-line argument.58for gitbr in $@59do60	echo ' --- git branch ' $gitbr61 62	# Each pass through this loop tests one commit.63	for i in `git rev-list "$gitbr"`64	do65		ntry=`expr $ntry + 1`66		idir=`awk -v ntry="$ntry" 'END { printf "%04d", ntry; }' < /dev/null`67		echo ' --- commit ' $i from branch $gitbr68		date69		mkdir $resdir/$ds/$idir70		echo $gitbr > $resdir/$ds/$idir/gitbr71		echo $i >> $resdir/$ds/$idir/gitbr72 73		# Test the specified commit.74		git checkout $i > $resdir/$ds/$idir/git-checkout.out 2>&175		echo git checkout return code: $? "(Commit $ntry: $i)"76		kvm.sh --allcpus --duration 3 --trust-make --datestamp "$ds/$idir" > $resdir/$ds/$idir/kvm.sh.out 2>&177		ret=$?78		echo kvm.sh return code $ret for commit $i from branch $gitbr79		echo Run results: $resdir/$ds/$idir80		if test "$ret" -ne 081		then82			# Failure, so leave all evidence intact.83			nfail=`expr $nfail + 1`84		else85			# Success, so remove large files to save about 1GB.86			( cd $resdir/$ds/$idir/$rrd; rm -f */vmlinux */bzImage */System.map */Module.symvers )87		fi88	done89done90date91 92# Go back to the original commit.93git checkout "$curcommit"94 95if test $nfail -ne 096then97	echo '!!! ' $nfail failures in $ntry 'runs!!!'98	exit 199else100	echo No failures in $ntry runs.101	exit 0102fi103