Skip to content

Commit ace202d

Browse files
committed
Toggle whether output on stderr indicates an error.
1 parent 6b9c4a6 commit ace202d

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

tests/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ OUTPUT_INSTRUMENT ?= no
4242
# possibly set in the environment, enables build from source after preprocessing
4343
EXPLICIT_PREPROCESSOR ?= no
4444

45+
# possibly set in the environment, toggle whether nonempty output on stderr is treated as an error
46+
ERROR_OUTPUT_IS_ERROR ?= yes
47+
4548
CXX ?= clang++
4649

4750
FLAGS = $(CXXFLAGS) -std=c++11
@@ -151,7 +154,7 @@ $(patsubst %,run%,$(DRIVERS)):
151154
@rm -f testresults; \
152155
for test in ${DRIVER_TESTS}; \
153156
do \
154-
bash run.sh ${DRIVER} $$test $(MODE) $(EXPLICIT_PREPROCESSOR); \
157+
bash run.sh ${DRIVER} $$test $(MODE) $(EXPLICIT_PREPROCESSOR) $(ERROR_OUTPUT_IS_ERROR); \
155158
done; \
156159
if grep -q 1 testresults; then \
157160
exit 1; \

tests/run.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,24 @@ TEST=$2
2828
GENFILE=$BUILD_DIR"/"$DRIVER$TEST".cpp"
2929
MODE=$3
3030
EXPLICIT_PREPROCESSOR=$4
31+
ERROR_OUTPUT_IS_ERROR=$5
3132

3233
LAUNCH_NAME=$DRIVER$TEST
3334
if [[ "$EXPLICIT_PREPROCESSOR" == "yes" ]];
3435
then
3536
LAUNCH_NAME+="Pre";
36-
fi
37+
fi
38+
39+
if [[ "$ERROR_OUTPUT_IS_ERROR" == "yes" ]];
40+
then
41+
ERROR_FILE=$RESULT_DIR/$DRIVER$TEST.err;
42+
else
43+
ERROR_FILE=/dev/null;
44+
fi
3745

3846
case "$MODE" in
3947
"RUN")
40-
timeout 5m ./$BUILD_DIR/$LAUNCH_NAME 1> $RESULT_DIR/$DRIVER$TEST.out 2> $RESULT_DIR/$DRIVER$TEST.err;
48+
timeout 5m ./$BUILD_DIR/$LAUNCH_NAME 1> $RESULT_DIR/$DRIVER$TEST.out 2> $ERROR_FILE;
4149
ret=$?
4250
if [[ $ret -ne 0 ]];
4351
then

0 commit comments

Comments
 (0)