Skip to content

Commit cb2d8d9

Browse files
committed
Merged pass and xfail test suite runners
Also applied some renaming and coding style unification to the scripts. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
1 parent 7abe4ec commit cb2d8d9

File tree

5 files changed

+83
-178
lines changed

5 files changed

+83
-178
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,10 +312,10 @@ $(eval $(call BUILD_RULE,unittests,$(NATIVE_SYSTEM),unittests,Build))
312312
# its non-deterministically vanishing .a files.
313313
define JSTEST_SUITE_RULE
314314
test-js.$(1).$(2): build-all.$$(NATIVE_SYSTEM)
315-
$$(Q) $$(call SHLOG,./tools/runners/run-precommit-check-for-target.sh \
315+
$$(Q) $$(call SHLOG,./tools/runners/run-test-suite.sh \
316316
$$(OUT_DIR)/$(1)/jerry \
317317
$$(OUT_DIR)/$(1)/check/$(2) \
318-
$(3),$$(OUT_DIR)/$(1)/check/$(2)/jerry_test.log,Testing)
318+
$(3),$$(OUT_DIR)/$(1)/check/$(2)/test.log,Testing)
319319
endef
320320

321321
$(foreach __TARGET,$(JERRY_TEST_TARGETS), \
@@ -356,7 +356,7 @@ build: $(patsubst %,build-all.%,$(NATIVE_SYSTEM) $(foreach __SYSTEM,$(MCU_SYSTEM
356356
test-unit: unittests
357357
$(Q) rm -rf $(OUT_DIR)/unittests/check
358358
$(Q) mkdir -p $(OUT_DIR)/unittests/check
359-
$(Q) $(call SHLOG,./tools/runners/run-unittests.sh $(OUT_DIR)/unittests,$(OUT_DIR)/unittests/unittests.log,Unit tests)
359+
$(Q) $(call SHLOG,./tools/runners/run-unittests.sh $(OUT_DIR)/unittests,$(OUT_DIR)/unittests/check/unittests.log,Unit tests)
360360

361361
.PHONY: test-js
362362
test-js: $(foreach __TARGET,$(JERRY_TEST_TARGETS),test-js.$(__TARGET))

tools/runners/run-test-pass.sh

Lines changed: 0 additions & 116 deletions
This file was deleted.

tools/runners/run-test-xfail.sh renamed to tools/runners/run-test-suite-status.sh

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18-
TIMEOUT=${TIMEOUT:=30}
19-
2018
ENGINE=$1
2119
shift
2220

@@ -26,45 +24,58 @@ shift
2624
ERROR_CODE=$1
2725
shift
2826

29-
TESTS=$1/fail/$ERROR_CODE
27+
if [ $ERROR_CODE -eq 0 ]
28+
then
29+
TESTS=$1
30+
TIMEOUT=${TIMEOUT:=5}
31+
PASS="PASS"
32+
else
33+
TESTS=$1/fail/$ERROR_CODE
34+
TIMEOUT=${TIMEOUT:=30}
35+
PASS="XFAIL"
36+
fi
3037
shift
3138

3239
JERRY_ARGS="$@"
3340

3441
if [ ! -x $ENGINE ]
3542
then
36-
echo "\"$ENGINE\" is not an executable file"
37-
exit 1
43+
echo "$0: $ENGINE: not an executable"
44+
exit 1
3845
fi
3946

4047
if [ ! -d $OUT_DIR ]
4148
then
42-
mkdir -p $OUT_DIR
49+
mkdir -p $OUT_DIR
4350
fi
4451

45-
JS_FILES=$OUT_DIR/js.fail.files
46-
JERRY_ERROR=$OUT_DIR/jerry.error
47-
JERRY_OK=$OUT_DIR/jerry.passed
52+
JS_FILES=$OUT_DIR/test.$ERROR_CODE.files
53+
JERRY_ERROR=$OUT_DIR/test.$ERROR_CODE.failed
54+
JERRY_OK=$OUT_DIR/test.$ERROR_CODE.passed
4855

4956
rm -f $JS_FILES $JERRY_ERROR $JERRY_OK
5057

51-
if [ -d $TESTS ];
58+
if [ -d $TESTS ]
5259
then
53-
find $TESTS -name [^N]*.js -print | sort > $JS_FILES
60+
if [ $ERROR_CODE -eq 0 ]
61+
then
62+
find $TESTS -path $TESTS/fail -prune -o -name "[^N]*.js" -print | sort > $JS_FILES
63+
else
64+
find $TESTS -name "[^N]*.js" -print | sort > $JS_FILES
65+
fi
66+
elif [ -f $TESTS ]
67+
then
68+
cp $TESTS $JS_FILES
5469
else
55-
if [ -f $TESTS ];
56-
then
57-
cp $TESTS $JS_FILES
58-
else
59-
exit 1
60-
fi;
61-
fi;
70+
echo "$0: $TESTS: not a test suite"
71+
exit 1
72+
fi
6273
total=$(cat $JS_FILES | wc -l)
6374

6475
if [ "$total" -eq 0 ]
6576
then
66-
echo "No test to execute"
67-
exit 1
77+
echo "$0: $TESTS: no test in test suite"
78+
exit 1
6879
fi
6980

7081
tested=1
@@ -75,17 +86,17 @@ JERRY_TEMP=`mktemp`
7586

7687
for test in `cat $JS_FILES`
7788
do
78-
echo -n "[${tested}/${total}] ${ENGINE} ${JERRY_ARGS} ${test}: "
89+
echo -n "[$tested/$total] $ENGINE $JERRY_ARGS $test: "
7990

80-
( ulimit -t $TIMEOUT; ${ENGINE} ${JERRY_ARGS} ${test} &>$JERRY_TEMP; exit $? );
91+
( ulimit -t $TIMEOUT; $ENGINE $JERRY_ARGS $test &>$JERRY_TEMP; exit $? )
8192
status_code=$?
8293

8394
if [ $status_code -ne $ERROR_CODE ]
8495
then
8596
echo "FAIL ($status_code)"
8697
cat $JERRY_TEMP
8798

88-
echo "$status_code: ${test}" >> $JERRY_ERROR
99+
echo "$status_code: $test" >> $JERRY_ERROR
89100
echo "============================================" >> $JERRY_ERROR
90101
cat $JERRY_TEMP >> $JERRY_ERROR
91102
echo "============================================" >> $JERRY_ERROR
@@ -94,9 +105,9 @@ do
94105

95106
failed=$((failed+1))
96107
else
97-
echo "XFAIL"
108+
echo "$PASS"
98109

99-
echo "${test}" >> $JERRY_OK
110+
echo "$test" >> $JERRY_OK
100111

101112
passed=$((passed+1))
102113
fi
@@ -108,12 +119,12 @@ rm -f $JERRY_TEMP
108119

109120
ratio=$(echo $passed*100/$total | bc)
110121

111-
echo "[summary] ${ENGINE} ${JERRY_ARGS} ${TESTS}: ${passed} XFAIL, ${failed} FAIL, ${total} total, ${ratio}% success"
122+
echo "[summary] $ENGINE $JERRY_ARGS $TESTS: $passed $PASS, $failed FAIL, $total total, $ratio% success"
112123

113-
if [ ${failed} -ne 0 ]
124+
if [ $failed -ne 0 ]
114125
then
115-
echo "See $JERRY_ERROR for details about failures"
116-
exit 1;
126+
echo "$0: see $JERRY_ERROR for details about failures"
127+
exit 1
117128
fi
118129

119130
exit 0
Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

3-
# Copyright 2015 Samsung Electronics Co., Ltd.
3+
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
4+
# Copyright 2016 University of Szeged
45
#
56
# Licensed under the Apache License, Version 2.0 (the "License");
67
# you may not use this file except in compliance with the License.
@@ -14,32 +15,39 @@
1415
# See the License for the specific language governing permissions and
1516
# limitations under the License.
1617

17-
ENGINE_PATH="$1"
18-
OUTPUT_PATH="$2"
19-
TESTS_PATH="$3"
20-
TESTS_OPTS="$4"
18+
ENGINE_PATH=$1
19+
shift
20+
21+
OUTPUT_PATH=$1
22+
shift
23+
24+
TESTS_PATH=$1
25+
shift
26+
27+
TESTS_OPTS="$@"
2128

2229
[ -x $ENGINE_PATH ] || exit 1
2330
[[ -d $TESTS_PATH || -f $TESTS_PATH ]] || exit 1
2431
mkdir -p $OUTPUT_PATH || exit 1
2532

26-
./tools/runners/run-test-pass.sh $ENGINE_PATH $OUTPUT_PATH $TESTS_PATH $TESTS_OPTS; status_code=$?
33+
failed=0
34+
35+
./tools/runners/run-test-suite-status.sh $ENGINE_PATH $OUTPUT_PATH 0 $TESTS_PATH $TESTS_OPTS; status_code=$?
2736
if [ $status_code -ne 0 ]
2837
then
29-
exit $status_code
38+
failed=1
3039
fi
3140

3241
if [ -d $TESTS_PATH/fail ]
3342
then
34-
for error_code in `cd $TESTS_PATH/fail && ls -d [0-9]*`
35-
do
36-
./tools/runners/run-test-xfail.sh $ENGINE_PATH $OUTPUT_PATH $error_code $TESTS_PATH $TESTS_OPTS; status_code=$?
37-
38-
if [ $status_code -ne 0 ]
39-
then
40-
exit $status_code
41-
fi
42-
done
43+
for error_code in `cd $TESTS_PATH/fail && ls -d [0-9]*`
44+
do
45+
./tools/runners/run-test-suite-status.sh $ENGINE_PATH $OUTPUT_PATH $error_code $TESTS_PATH $TESTS_OPTS; status_code=$?
46+
if [ $status_code -ne 0 ]
47+
then
48+
failed=1
49+
fi
50+
done
4351
fi
4452

45-
exit 0
53+
exit $failed

0 commit comments

Comments
 (0)