[test-suite] r255609 - EXPRIMENTAL: Support separate stdout/stderr redirect
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 14 18:51:19 PST 2015
Author: matze
Date: Mon Dec 14 20:51:19 2015
New Revision: 255609
URL: http://llvm.org/viewvc/llvm-project?rev=255609&view=rev
Log:
EXPRIMENTAL: Support separate stdout/stderr redirect
Modified:
test-suite/trunk/External/Nurbs/lit.local.cfg
test-suite/trunk/External/Povray/lit.local.cfg
test-suite/trunk/External/skidmarks10/lit.local.cfg
test-suite/trunk/MultiSource/lit.local.cfg
test-suite/trunk/RunSafely.sh
test-suite/trunk/SingleSource/lit.local.cfg
test-suite/trunk/lit.cfg
Modified: test-suite/trunk/External/Nurbs/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/Nurbs/lit.local.cfg?rev=255609&r1=255608&r2=255609&view=diff
==============================================================================
--- test-suite/trunk/External/Nurbs/lit.local.cfg (original)
+++ test-suite/trunk/External/Nurbs/lit.local.cfg Mon Dec 14 20:51:19 2015
@@ -1 +1 @@
-config.output_append_exitstatus = True
+config.produce_traditional_output = True
Modified: test-suite/trunk/External/Povray/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/Povray/lit.local.cfg?rev=255609&r1=255608&r2=255609&view=diff
==============================================================================
--- test-suite/trunk/External/Povray/lit.local.cfg (original)
+++ test-suite/trunk/External/Povray/lit.local.cfg Mon Dec 14 20:51:19 2015
@@ -1 +1 @@
-config.output_append_exitstatus = True
+config.produce_traditional_output = True
Modified: test-suite/trunk/External/skidmarks10/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/skidmarks10/lit.local.cfg?rev=255609&r1=255608&r2=255609&view=diff
==============================================================================
--- test-suite/trunk/External/skidmarks10/lit.local.cfg (original)
+++ test-suite/trunk/External/skidmarks10/lit.local.cfg Mon Dec 14 20:51:19 2015
@@ -1 +1 @@
-config.output_append_exitstatus = True
+config.produce_traditional_output = True
Modified: test-suite/trunk/MultiSource/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/lit.local.cfg?rev=255609&r1=255608&r2=255609&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/lit.local.cfg (original)
+++ test-suite/trunk/MultiSource/lit.local.cfg Mon Dec 14 20:51:19 2015
@@ -1 +1 @@
-config.output_append_exitstatus = True
+config.produce_traditional_output = True
Modified: test-suite/trunk/RunSafely.sh
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/RunSafely.sh?rev=255609&r1=255608&r2=255609&view=diff
==============================================================================
--- test-suite/trunk/RunSafely.sh (original)
+++ test-suite/trunk/RunSafely.sh Mon Dec 14 20:51:19 2015
@@ -16,8 +16,9 @@
#
# Syntax:
#
-# RunSafely.sh [--omit-exitval] [-d <workdir>] [-r <rhost>] [-l <ruser>]
-# [-rc <client>] [-rp <port>] [-u <under>] [--show-errors]
+# RunSafely.sh [-d <workdir>] [-r <rhost>] [-l <ruser>] [-rc <client>]
+# [-rp <port>] [-u <under>] [--show-errors]
+# [-n [-o <stdoutfile>] [-e <stderrfile>]]
# -t <timeit> <timeout> <infile> <outfile> <program> <args...>
#
# where:
@@ -27,10 +28,13 @@
# <client> is the remote client used to execute the program
# <port> is the port used by the remote client
# <under> is a wrapper that the program is run under
+# <stdoutfile> file where standard output is written to
+# <stderrfile> file where standard error output is written to
# <timeit> is a wrapper that is used to collect timing data
# <timeout> is the maximum number of seconds to let the <program> run
# <infile> is a file from which standard input is directed
-# <outfile> is a file to which standard output and error are directed
+# <outfile> is a file to which standard output and error are directed.
+# This argument is not parsed if -n was specified.
# <program> is the path to the program to run
# <args...> are the arguments to pass to the program.
#
@@ -57,12 +61,10 @@ RCLIENT=rsh
RUN_UNDER=
TIMEIT=
SHOW_ERRORS=0
-OMIT_EXITVAL=0
+NEW_MODE=0
+STDOUT_FILE=""
+STDERR_FILE=""
PWD=`pwd`
-if [ $1 = "--omit-exitval" ]; then
- OMIT_EXITVAL=1
- shift 1
-fi
if [ $1 = "-d" ]; then
PWD="$2"
shift 2
@@ -91,6 +93,18 @@ if [ $1 = "--show-errors" ]; then
SHOW_ERRORS=1
shift 1
fi
+if [ $1 = "-n" ]; then
+ NEW_MODE=1
+ shift 1
+ if [ $1 = "-o" ]; then
+ STDOUT_FILE="$2"
+ shift 2
+ fi
+ if [ $1 = "-e" ]; then
+ STDERR_FILE="$2"
+ shift 2
+ fi
+fi
if [ $1 = "-t" ]; then
TIMEIT=$2
shift 2
@@ -136,19 +150,45 @@ COMMAND="$RUN_UNDER $PROGRAM $*"
TIMEITCMD="$TIMEIT $LIMITARGS --timeout $TIMELIMIT --chdir $PWD"
if [ "x$RHOST" = x ] ; then
rm -f "$OUTFILE.time"
+ if [ "$STDOUT_FILE" != "" ]; then
+ TIMEITCMD="$TIMEITCMD --redirect-stdout $STDOUT_FILE"
+ fi
+ if [ "$STDERR_FILE" != "" ]; then
+ TIMEITCMD="$TIMEITCMD --redirect-stderr $STDERR_FILE"
+ fi
+ if [ "$NEW_MODE" = "0" ]; then
+ TIMEITCMD="$TIMEITCMD --redirect-output $OUTFILE"
+ fi
$TIMEITCMD \
--summary $OUTFILE.time \
--redirect-input $INFILE \
- --redirect-output $OUTFILE \
$COMMAND
else
# Get the absolute path to INFILE.
ABSINFILE=$(cd $(dirname $INFILE); pwd)/$(basename $INFILE)
PROG_BASENAME="$(basename ${PROG})"
+ if [ "$STDOUT_FILE" != "" ]; then
+ case "$STDOUT_FILE" in
+ /*) STDOUT_FILE_ABS="$STDOUT_FILE";;
+ *) STDOUT_FILE_ABS="$PWD/$STDOUT_FILE";;
+ esac
+ TIMEITCMD="$TIMEITCMD --redirect-stdout ${STDOUT_FILE_ABS}"
+ fi
+ if [ "$STDERR_FILE" != "" ]; then
+ case "$STDERR_FILE" in
+ /*) STDERR_FILE_ABS="$STDERR_FILE";;
+ *) STDERR_FILE_ABS="$PWD/$STDERR_FILE";;
+ esac
+ TIMEITCMD="$TIMEITCMD --redirect-stderr ${STDERR_FILE_ABS}"
+ fi
case "$OUTFILE" in
/*) OUTFILE_ABS="$OUTFILE";;
*) OUTFILE_ABS="$PWD/$OUTFILE";;
esac
+ if [ "$NEW_MODE" = "0" ]; then
+ TIMEITCMD="$TIMEITCMD --redirect-output ${OUTFILE_ABS}.remote"
+ fi
+
rm -f "$PWD/${PROG_BASENAME}.command"
rm -f "$PWD/${PROG_BASENAME}.remote"
rm -f "${OUTFILE_ABS}.remote.time"
@@ -184,7 +224,7 @@ elif [ "$SHOW_ERRORS" -eq 1 -a "$exitval
else
fail=no
fi
-if [ "$OMIT_EXITVAL" -ne 1 ]; then
+if [ "$NEW_MODE" = "0" ]; then
echo "exit $exitval" >> $OUTFILE
fi
Modified: test-suite/trunk/SingleSource/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/lit.local.cfg?rev=255609&r1=255608&r2=255609&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/lit.local.cfg (original)
+++ test-suite/trunk/SingleSource/lit.local.cfg Mon Dec 14 20:51:19 2015
@@ -1 +1 @@
-config.output_append_exitstatus = True
+config.produce_traditional_output = True
Modified: test-suite/trunk/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/lit.cfg?rev=255609&r1=255608&r2=255609&view=diff
==============================================================================
--- test-suite/trunk/lit.cfg (original)
+++ test-suite/trunk/lit.cfg Mon Dec 14 20:51:19 2015
@@ -87,37 +87,33 @@ def prepareRunSafely(config, commandline
workdir = None
tokens = shlex.split(commandline)
# Parse "< INPUTFILE", "> OUTFILE", "2> OUTFILE" patterns
- for i in range(len(tokens)):
+ i = 0
+ while i < len(tokens):
if tokens[i] == "<" and i+1 < len(tokens):
stdin = tokens[i+1]
del tokens[i+1]
del tokens[i]
- break
+ continue
elif tokens[i] == ">" and i+1 < len(tokens):
stdout = tokens[i+1]
del tokens[i+1]
del tokens[i]
- break
+ continue
elif tokens[i] == "2>" and i+1 < len(tokens):
stderr = tokens[i+1]
del tokens[i+1]
del tokens[i]
- break
+ continue
if i+2 < len(tokens) and tokens[i] == "cd" and tokens[i+2] == ";":
workdir = tokens[i+1]
del tokens[i+2]
del tokens[i+1]
del tokens[i]
-
- if stdin is None:
- stdin = "/dev/null"
- if stdout is not None or stderr is not None:
- raise Exception("stdout/stderr redirection in combination with RunSafely not implemented yet")
+ continue
+ i += 1
runsafely = "%s/RunSafely.sh" % config.test_suite_root
runsafely_prefix = [ runsafely ]
- if not config.output_append_exitstatus:
- runsafely_prefix += [ "--omit-exitval" ]
if workdir is not None:
runsafely_prefix += [ "-d", workdir ]
if config.remote_host:
@@ -130,8 +126,19 @@ def prepareRunSafely(config, commandline
runsafely_prefix += [ "-rp", config.remote_port ]
if config.run_under:
runsafely_prefix += [ "-u", config.run_under ]
+ if not config.produce_traditional_output:
+ runsafely_prefix += [ "-n" ]
+ if stdout is not None:
+ runsafely_prefix += [ "-o", stdout ]
+ if stderr is not None:
+ runsafely_prefix += [ "-e", stderr ]
+ else:
+ if stdout is not None or stderr is not None:
+ raise Exception("separate stdout/stderr redirection not possible with traditional output")
timeit = "%s/tools/timeit-target" % config.test_source_root
timeout = "7200"
+ if stdin is None:
+ stdin = "/dev/null"
runsafely_prefix += [ "-t", timeit, timeout, stdin, outfile ]
new_commandline = " ".join(map(quote, runsafely_prefix + tokens))
@@ -225,6 +232,6 @@ config.name = 'test-suite'
config.test_format = TestSuiteTest()
config.suffixes = ['.test']
config.excludes = ['ABI-Testsuite']
-config.output_append_exitstatus = False
+config.produce_traditional_output = False
if 'SSH_AUTH_SOCK' in os.environ:
config.environment['SSH_AUTH_SOCK'] = os.environ['SSH_AUTH_SOCK']
More information about the llvm-commits
mailing list