Commit 040accb3 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

torture: Abstract jitter.sh start/stop into scripts



This commit creates jitterstart.sh and jitterstop.sh scripts that handle
the starting and stopping of the jitter.sh scripts.  These must be sourced
using the bash "." command to allow the generated script to wait on the
backgrounded jitter.sh scripts.

Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 4cd54518
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0+
#
# Start up the specified number of jitter.sh scripts in the background.
#
# Usage: . jitterstart.sh n jittering-dir duration [ sleepmax [ spinmax ] ]
#
# n: Number of jitter.sh scripts to start up.
# jittering-dir: Directory in which to put "jittering" file.
# duration: Time to run in seconds.
# sleepmax: Maximum microseconds to sleep, defaults to one second.
# spinmax: Maximum microseconds to spin, defaults to one millisecond.
#
# Copyright (C) 2021 Facebook, Inc.
#
# Authors: Paul E. McKenney <paulmck@kernel.org>

jitter_n=$1
if test -z "$jitter_n"
then
	echo jitterstart.sh: Missing count of jitter.sh scripts to start.
	exit 33
fi
jittering_dir=$2
if test -z "$jittering_dir"
then
	echo jitterstart.sh: Missing directory in which to place jittering file.
	exit 34
fi
shift
shift

touch ${jittering_dir}/jittering
for ((jitter_i = 1; jitter_i <= $jitter_n; jitter_i++))
do
	jitter.sh $jitter_i "${jittering_dir}/jittering" "$@" &
done
+23 −0
Original line number Diff line number Diff line
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0+
#
# Remove the "jittering" file, signaling the jitter.sh scripts to stop,
# then wait for them to terminate.
#
# Usage: . jitterstop.sh jittering-dir
#
# jittering-dir: Directory containing "jittering" file.
#
# Copyright (C) 2021 Facebook, Inc.
#
# Authors: Paul E. McKenney <paulmck@kernel.org>

jittering_dir=$1
if test -z "$jittering_dir"
then
	echo jitterstop.sh: Missing directory in which to place jittering file.
	exit 34
fi

rm -f ${jittering_dir}/jittering
wait
+2 −5
Original line number Diff line number Diff line
@@ -502,15 +502,12 @@ function dump(first, pastlast, batchnum)
	print "if test -n \"$needqemurun\""
	print "then"
	print "\techo ---- Starting kernels. `date` | tee -a " rd "log";
	print "\ttouch " rd "jittering"
	for (j = 0; j < njitter; j++)
		print "\tjitter.sh " j " " rd "jittering " dur " " ja[2] " " ja[3] "&"
	print "\t. jitterstart.sh " njitter " " rd " " dur " " ja[2] " " ja[3]
	print "\twhile ls $runfiles > /dev/null 2>&1"
	print "\tdo"
	print "\t\t:"
	print "\tdone"
	print "\trm -f " rd "jittering"
	print "\twait"
	print "\t. jitterstop.sh " rd
	print "\techo ---- All kernel runs complete. `date` | tee -a " rd "log";
	print "else"
	print "\twait"