Skip to content

Commit 649aaf7

Browse files
committed
rcutorture: Add --datestamp parameter to kvm-again.sh
This commit adds a --datestamp parameter to kvm-again.sh, which, in contrast to the existing --rundir argument, specifies only the last segments of the pathname. This addition enables torture.sh to use kvm-again.sh in order to avoid redundant kernel builds. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 92e5f7d commit 649aaf7

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

tools/testing/selftests/rcutorture/bin/kvm-again.sh

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,24 @@ bootargs=
5454
dryrun=
5555
dur=
5656
default_link="cp -R"
57-
rundir="`pwd`/tools/testing/selftests/rcutorture/res/`date +%Y.%m.%d-%H.%M.%S-again`"
57+
resdir="`pwd`/tools/testing/selftests/rcutorture/res"
58+
rundir="$resdir/`date +%Y.%m.%d-%H.%M.%S-again`"
59+
got_datestamp=
60+
got_rundir=
5861

5962
startdate="`date`"
6063
starttime="`get_starttime`"
6164

6265
usage () {
6366
echo "Usage: $scriptname $oldrun [ arguments ]:"
6467
echo " --bootargs kernel-boot-arguments"
68+
echo " --datestamp string"
6569
echo " --dryrun"
6670
echo " --duration minutes | <seconds>s | <hours>h | <days>d"
6771
echo " --link hard|soft|copy"
6872
echo " --remote"
6973
echo " --rundir /new/res/path"
74+
echo "Command line: $scriptname $args"
7075
exit 1
7176
}
7277

@@ -78,6 +83,23 @@ do
7883
bootargs="$bootargs $2"
7984
shift
8085
;;
86+
--datestamp)
87+
checkarg --datestamp "(relative pathname)" "$#" "$2" '^[a-zA-Z0-9._/-]*$' '^--'
88+
if test -n "$got_rundir" || test -n "$got_datestamp"
89+
then
90+
echo Only one of --datestamp or --rundir may be specified
91+
usage
92+
fi
93+
got_datestamp=y
94+
ds=$2
95+
rundir="$resdir/$ds"
96+
if test -e "$rundir"
97+
then
98+
echo "--datestamp $2: Already exists."
99+
usage
100+
fi
101+
shift
102+
;;
81103
--dryrun)
82104
dryrun=1
83105
;;
@@ -119,6 +141,12 @@ do
119141
;;
120142
--rundir)
121143
checkarg --rundir "(absolute pathname)" "$#" "$2" '^/' '^error'
144+
if test -n "$got_rundir" || test -n "$got_datestamp"
145+
then
146+
echo Only one of --datestamp or --rundir may be specified
147+
usage
148+
fi
149+
got_rundir=y
122150
rundir=$2
123151
if test -e "$rundir"
124152
then
@@ -128,8 +156,11 @@ do
128156
shift
129157
;;
130158
*)
131-
echo Unknown argument $1
132-
usage
159+
if test -n "$1"
160+
then
161+
echo Unknown argument $1
162+
usage
163+
fi
133164
;;
134165
esac
135166
shift

0 commit comments

Comments
 (0)