Commit fa48beb5 authored by SeongJae Park's avatar SeongJae Park Committed by Paul E. McKenney

rcutorture: Simplify logging

Both the 'kvm.sh' and 'kvm-test-1-run.sh' scripts log messages by printing
the message to 'stdout' and then also printing it into the log file.
Generation of the message thus occurs twice, once for 'stdout' and once
for the log file.  Moreover, many of the messages contain 'date' output,
which results in date being invoked twice (once for stdout print, once
for log file write).  As a result, the date information in stdout and
log file can differ, which could cause confusion.

This commit therefore simplifies the logging procedure by using 'tee'.
Signed-off-by: default avatarSeongJae Park <sj38.park@gmail.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
parent 81394e3f
...@@ -154,9 +154,7 @@ cpu_count=`configfrag_boot_cpus "$boot_args" "$config_template" "$cpu_count"` ...@@ -154,9 +154,7 @@ cpu_count=`configfrag_boot_cpus "$boot_args" "$config_template" "$cpu_count"`
vcpus=`identify_qemu_vcpus` vcpus=`identify_qemu_vcpus`
if test $cpu_count -gt $vcpus if test $cpu_count -gt $vcpus
then then
echo CPU count limited from $cpu_count to $vcpus echo CPU count limited from $cpu_count to $vcpus | tee -a $resdir/Warnings
touch $resdir/Warnings
echo CPU count limited from $cpu_count to $vcpus >> $resdir/Warnings
cpu_count=$vcpus cpu_count=$vcpus
fi fi
qemu_args="`specify_qemu_cpus "$QEMU" "$qemu_args" "$cpu_count"`" qemu_args="`specify_qemu_cpus "$QEMU" "$qemu_args" "$cpu_count"`"
......
...@@ -331,8 +331,7 @@ awk < $T/cfgcpu.pack \ ...@@ -331,8 +331,7 @@ awk < $T/cfgcpu.pack \
# Dump out the scripting required to run one test batch. # Dump out the scripting required to run one test batch.
function dump(first, pastlast, batchnum) function dump(first, pastlast, batchnum)
{ {
print "echo ----Start batch " batchnum ": `date`"; print "echo ----Start batch " batchnum ": `date` | tee -a " rd "log";
print "echo ----Start batch " batchnum ": `date` >> " rd "/log";
print "needqemurun=" print "needqemurun="
jn=1 jn=1
for (j = first; j < pastlast; j++) { for (j = first; j < pastlast; j++) {
...@@ -349,21 +348,18 @@ function dump(first, pastlast, batchnum) ...@@ -349,21 +348,18 @@ function dump(first, pastlast, batchnum)
ovf = "-ovf"; ovf = "-ovf";
else else
ovf = ""; ovf = "";
print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date`"; print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date` | tee -a " rd "log";
print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date` >> " rd "/log";
print "rm -f " builddir ".*"; print "rm -f " builddir ".*";
print "touch " builddir ".wait"; print "touch " builddir ".wait";
print "mkdir " builddir " > /dev/null 2>&1 || :"; print "mkdir " builddir " > /dev/null 2>&1 || :";
print "mkdir " rd cfr[jn] " || :"; print "mkdir " rd cfr[jn] " || :";
print "kvm-test-1-run.sh " CONFIGDIR cf[j], builddir, rd cfr[jn], dur " \"" TORTURE_QEMU_ARG "\" \"" TORTURE_BOOTARGS "\" > " rd cfr[jn] "/kvm-test-1-run.sh.out 2>&1 &" print "kvm-test-1-run.sh " CONFIGDIR cf[j], builddir, rd cfr[jn], dur " \"" TORTURE_QEMU_ARG "\" \"" TORTURE_BOOTARGS "\" > " rd cfr[jn] "/kvm-test-1-run.sh.out 2>&1 &"
print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date`"; print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` | tee -a " rd "log";
print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to complete. `date` >> " rd "/log";
print "while test -f " builddir ".wait" print "while test -f " builddir ".wait"
print "do" print "do"
print "\tsleep 1" print "\tsleep 1"
print "done" print "done"
print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date`"; print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` | tee -a " rd "log";
print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` >> " rd "/log";
jn++; jn++;
} }
for (j = 1; j < jn; j++) { for (j = 1; j < jn; j++) {
...@@ -371,8 +367,7 @@ function dump(first, pastlast, batchnum) ...@@ -371,8 +367,7 @@ function dump(first, pastlast, batchnum)
print "rm -f " builddir ".ready" print "rm -f " builddir ".ready"
print "if test -f \"" rd cfr[j] "/builtkernel\"" print "if test -f \"" rd cfr[j] "/builtkernel\""
print "then" print "then"
print "\techo ----", cfr[j], cpusr[j] ovf ": Kernel present. `date`"; print "\techo ----", cfr[j], cpusr[j] ovf ": Kernel present. `date` | tee -a " rd "log";
print "\techo ----", cfr[j], cpusr[j] ovf ": Kernel present. `date` >> " rd "/log";
print "\tneedqemurun=1" print "\tneedqemurun=1"
print "fi" print "fi"
} }
...@@ -386,31 +381,26 @@ function dump(first, pastlast, batchnum) ...@@ -386,31 +381,26 @@ function dump(first, pastlast, batchnum)
njitter = ja[1]; njitter = ja[1];
if (TORTURE_BUILDONLY && njitter != 0) { if (TORTURE_BUILDONLY && njitter != 0) {
njitter = 0; njitter = 0;
print "echo Build-only run, so suppressing jitter >> " rd "/log" print "echo Build-only run, so suppressing jitter | tee -a " rd "log"
} }
if (TORTURE_BUILDONLY) { if (TORTURE_BUILDONLY) {
print "needqemurun=" print "needqemurun="
} }
print "if test -n \"$needqemurun\"" print "if test -n \"$needqemurun\""
print "then" print "then"
print "\techo ---- Starting kernels. `date`"; print "\techo ---- Starting kernels. `date` | tee -a " rd "log";
print "\techo ---- Starting kernels. `date` >> " rd "/log";
for (j = 0; j < njitter; j++) for (j = 0; j < njitter; j++)
print "\tjitter.sh " j " " dur " " ja[2] " " ja[3] "&" print "\tjitter.sh " j " " dur " " ja[2] " " ja[3] "&"
print "\twait" print "\twait"
print "\techo ---- All kernel runs complete. `date`"; print "\techo ---- All kernel runs complete. `date` | tee -a " rd "log";
print "\techo ---- All kernel runs complete. `date` >> " rd "/log";
print "else" print "else"
print "\twait" print "\twait"
print "\techo ---- No kernel runs. `date`"; print "\techo ---- No kernel runs. `date` | tee -a " rd "log";
print "\techo ---- No kernel runs. `date` >> " rd "/log";
print "fi" print "fi"
for (j = 1; j < jn; j++) { for (j = 1; j < jn; j++) {
builddir=KVM "/b" j builddir=KVM "/b" j
print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results:"; print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results: | tee -a " rd "log";
print "echo ----", cfr[j], cpusr[j] ovf ": Build/run results: >> " rd "/log"; print "cat " rd cfr[j] "/kvm-test-1-run.sh.out | tee -a " rd "log";
print "cat " rd cfr[j] "/kvm-test-1-run.sh.out";
print "cat " rd cfr[j] "/kvm-test-1-run.sh.out >> " rd "/log";
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment