Skip to content

Commit

Permalink
RunSafely: Add option to omit exit status from output.
Browse files Browse the repository at this point in the history
This is useful for external benchmark suites which bring reference files
for stdout without the llvm-test-suite convention of having an exit code
behind the stdout output.

As discussed in D14678 I am going for post-commit review as cmake/lit
test-suite support is still in early development.

Differential Revision: http://reviews.llvm.org/D14679

llvm-svn: 254835
  • Loading branch information
MatzeB committed Dec 5, 2015
1 parent 2fb4141 commit cc7e4aa
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 2 deletions.
1 change: 1 addition & 0 deletions External/Nurbs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ if(TEST_SUITE_NURBS_ROOT)

llvm_multisource()
endif()
file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
1 change: 1 addition & 0 deletions External/Nurbs/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.output_append_exitstatus = True
1 change: 1 addition & 0 deletions External/Povray/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ if(TEST_SUITE_POVRAY_ROOT)

llvm_multisource()
endif()
file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
1 change: 1 addition & 0 deletions External/Povray/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.output_append_exitstatus = True
1 change: 1 addition & 0 deletions External/skidmarks10/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ if(TEST_SUITE_SKIDMARKS10_ROOT)
)
llvm_multisource()
endif()
file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
1 change: 1 addition & 0 deletions External/skidmarks10/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.output_append_exitstatus = True
2 changes: 2 additions & 0 deletions MultiSource/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ endif()
llvm_multisource()

llvm_add_subdirectories(${DIRS} ${PARALLEL_DIRS})

file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
1 change: 1 addition & 0 deletions MultiSource/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.output_append_exitstatus = True
13 changes: 11 additions & 2 deletions RunSafely.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Syntax:
#
# RunSafely.sh [-r <rhost>] [-l <ruser>] [-rc <client>] [-rp <port>]
# [-u <under>] [--show-errors] -t <timeit>
# [-u <under>] [--show-errors] [--omit-exitval] -t <timeit>
# <timeout> <infile> <outfile> <program> <args...>
#
# where:
Expand All @@ -35,6 +35,8 @@
#
# If --show-errors is given, then the output file will be printed if the command
# fails (returns a non-zero exit code).
# Unless --omit-exitval is given the last line of the outfile has the form
# "exit NN" with NN being the exit status number of the program.

if [ $# -lt 4 ]; then
echo "./RunSafely.sh [-t <PATH>] <timeout> <infile> <outfile>" \
Expand All @@ -54,6 +56,11 @@ RCLIENT=rsh
RUN_UNDER=
TIMEIT=
SHOW_ERRORS=0
OMIT_EXITVAL=0
if [ $1 = "--omit-exitval" ]; then
OMIT_EXITVAL=1
shift 1
fi
if [ $1 = "-r" ]; then
RHOST=$2
shift 2
Expand Down Expand Up @@ -172,7 +179,9 @@ elif [ "$SHOW_ERRORS" -eq 1 -a "$exitval" -ne 0 ] ; then
else
fail=no
fi
echo "exit $exitval" >> $OUTFILE
if [ "$OMIT_EXITVAL" -ne 1 ]; then
echo "exit $exitval" >> $OUTFILE
fi

# If we detected a failure, print the name of the test executable to the
# output file. This will cause it to compare as different with other runs
Expand Down
2 changes: 2 additions & 0 deletions SingleSource/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ list(APPEND LDFLAGS -lm)
llvm_singlesource()

llvm_add_subdirectories(${DIRS} ${PARALLEL_DIRS})

file(COPY lit.local.cfg DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
1 change: 1 addition & 0 deletions SingleSource/lit.local.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
config.output_append_exitstatus = True
3 changes: 3 additions & 0 deletions lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def prepareRunSafely(config, commandline, outfile):

runsafely = "%s/RunSafely.sh" % config.test_suite_root
runsafely_prefix = [ runsafely ]
if not config.output_append_exitstatus:
runsafely_prefix += ["--omit-exitval"]
if config.remote_host:
runsafely_prefix += [ "-r", config.remote_host ]
if config.remote_user:
Expand Down Expand Up @@ -215,5 +217,6 @@ config.name = 'test-suite'
config.test_format = TestSuiteTest()
config.suffixes = ['.test']
config.excludes = ['ABI-Testsuite']
config.output_append_exitstatus = False
if 'SSH_AUTH_SOCK' in os.environ:
config.environment['SSH_AUTH_SOCK'] = os.environ['SSH_AUTH_SOCK']

0 comments on commit cc7e4aa

Please sign in to comment.