Improve the usability of test runner scripts
* First of all, remove the counter-intuitive "OUT_DIR" second argument of run-test-suite.sh. This, way, the invocation of the script becomes easier to remember: `tools/runners/run-test-suite.sh <engine> <testsuite>` However, this also means that all output files (lists of executed, passed, and failed tests) are generated in the current working directory. * Align the behaviour of run-unittests.sh with the above, i.e., don't try to guess where to put output files but write them in the CWD. * Adapt Makefile to the change in the use of the test runner scripts: create and change to "check" directories before invoking test runner scripts. Extras: * tools/runners/run-test-suite.sh collected fail tests from directories twice. This does no harm but is inefficient, thus removing. * tools/runners/run-test-suite.sh was too permissive on the contents of test suite list files. Better to accept those lines only which really contain paths to JS test files. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -105,6 +105,15 @@ export NATIVE_MODS := $(MCU_MODS) mem_stats mem_stress_test
|
|||||||
# Compiler to use for external build
|
# Compiler to use for external build
|
||||||
EXTERNAL_C_COMPILER ?= arm-none-eabi-gcc
|
EXTERNAL_C_COMPILER ?= arm-none-eabi-gcc
|
||||||
|
|
||||||
|
# Directories
|
||||||
|
export ROOT_DIR := $(shell pwd)
|
||||||
|
export BUILD_DIR_PREFIX := $(ROOT_DIR)/build/obj
|
||||||
|
export BUILD_DIR := $(BUILD_DIR_PREFIX)-VALGRIND-$(VALGRIND)-VALGRIND_FREYA-$(VALGRIND_FREYA)-LTO-$(LTO)-ALL_IN_ONE-$(ALL_IN_ONE)
|
||||||
|
export OUT_DIR := $(ROOT_DIR)/build/bin
|
||||||
|
export PREREQUISITES_STATE_DIR := $(ROOT_DIR)/build/prerequisites
|
||||||
|
|
||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
# Build targets
|
# Build targets
|
||||||
export JERRY_NATIVE_TARGETS := \
|
export JERRY_NATIVE_TARGETS := \
|
||||||
$(foreach __MODE,$(DEBUG_MODES) $(RELEASE_MODES), \
|
$(foreach __MODE,$(DEBUG_MODES) $(RELEASE_MODES), \
|
||||||
@@ -132,18 +141,10 @@ export JERRY_TEST_TARGETS_CP := \
|
|||||||
$(__MODE).$(NATIVE_SYSTEM)-cp)
|
$(__MODE).$(NATIVE_SYSTEM)-cp)
|
||||||
|
|
||||||
# JS test suites (in the format of id:path)
|
# JS test suites (in the format of id:path)
|
||||||
export JERRY_TEST_SUITE_J := j:./tests/jerry
|
export JERRY_TEST_SUITE_J := j:$(ROOT_DIR)/tests/jerry
|
||||||
export JERRY_TEST_SUITE_JTS := jts:./tests/jerry-test-suite
|
export JERRY_TEST_SUITE_JTS := jts:$(ROOT_DIR)/tests/jerry-test-suite
|
||||||
export JERRY_TEST_SUITE_JTS_PREC := jts-prec:./tests/jerry-test-suite/precommit-test-list
|
export JERRY_TEST_SUITE_JTS_PREC := jts-prec:$(ROOT_DIR)/tests/jerry-test-suite/precommit-test-list
|
||||||
export JERRY_TEST_SUITE_JTS_CP := jts-cp:./tests/jerry-test-suite/compact-profile-list
|
export JERRY_TEST_SUITE_JTS_CP := jts-cp:$(ROOT_DIR)/tests/jerry-test-suite/compact-profile-list
|
||||||
|
|
||||||
# Directories
|
|
||||||
export BUILD_DIR_PREFIX := ./build/obj
|
|
||||||
export BUILD_DIR := $(BUILD_DIR_PREFIX)-VALGRIND-$(VALGRIND)-VALGRIND_FREYA-$(VALGRIND_FREYA)-LTO-$(LTO)-ALL_IN_ONE-$(ALL_IN_ONE)
|
|
||||||
export OUT_DIR := ./build/bin
|
|
||||||
export PREREQUISITES_STATE_DIR := ./build/prerequisites
|
|
||||||
|
|
||||||
SHELL := /bin/bash
|
|
||||||
|
|
||||||
# Default make target
|
# Default make target
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
@@ -235,7 +236,7 @@ $(1)/Makefile: $(1)/toolchain.config
|
|||||||
-DENABLE_LTO=$$(LTO) \
|
-DENABLE_LTO=$$(LTO) \
|
||||||
-DENABLE_ALL_IN_ONE=$$(ALL_IN_ONE) \
|
-DENABLE_ALL_IN_ONE=$$(ALL_IN_ONE) \
|
||||||
-DUSE_COMPILER_DEFAULT_LIBC=$$(USE_COMPILER_DEFAULT_LIBC) \
|
-DUSE_COMPILER_DEFAULT_LIBC=$$(USE_COMPILER_DEFAULT_LIBC) \
|
||||||
-DCMAKE_TOOLCHAIN_FILE=`cat toolchain.config` ../../.. 2>&1),$(1)/cmake.log,CMake run)
|
-DCMAKE_TOOLCHAIN_FILE=`cat toolchain.config` $$(ROOT_DIR) 2>&1),$(1)/cmake.log,CMake run)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(foreach __SYSTEM,$(NATIVE_SYSTEM) $(MCU_SYSTEMS), \
|
$(foreach __SYSTEM,$(NATIVE_SYSTEM) $(MCU_SYSTEMS), \
|
||||||
@@ -295,9 +296,9 @@ $(eval $(call BUILD_RULE,unittests,$(NATIVE_SYSTEM),unittests))
|
|||||||
# its non-deterministically vanishing .a files.
|
# its non-deterministically vanishing .a files.
|
||||||
define JSTEST_RULE
|
define JSTEST_RULE
|
||||||
test-js.$(1).$(2): build.$$(NATIVE_SYSTEM)
|
test-js.$(1).$(2): build.$$(NATIVE_SYSTEM)
|
||||||
$$(Q) $$(call SHLOG,./tools/runners/run-test-suite.sh \
|
$$(Q) mkdir -p $$(OUT_DIR)/$(1)/check/$(2)
|
||||||
|
$$(Q) $$(call SHLOG,cd $$(OUT_DIR)/$(1)/check/$(2) && $$(ROOT_DIR)/tools/runners/run-test-suite.sh \
|
||||||
$$(OUT_DIR)/$(1)/jerry \
|
$$(OUT_DIR)/$(1)/jerry \
|
||||||
$$(OUT_DIR)/$(1)/check/$(2) \
|
|
||||||
$(3),$$(OUT_DIR)/$(1)/check/$(2)/test.log,Testing)
|
$(3),$$(OUT_DIR)/$(1)/check/$(2)/test.log,Testing)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
@@ -332,7 +333,8 @@ build: build.$(NATIVE_SYSTEM) $(foreach __SYSTEM,$(MCU_SYSTEMS),build.mcu_$(__SY
|
|||||||
|
|
||||||
.PHONY: test-unit
|
.PHONY: test-unit
|
||||||
test-unit: unittests
|
test-unit: unittests
|
||||||
$(Q) $(call SHLOG,./tools/runners/run-unittests.sh $(OUT_DIR)/unittests,$(OUT_DIR)/unittests/check/unittests.log,Unit tests)
|
$(Q) mkdir -p $(OUT_DIR)/unittests/check
|
||||||
|
$(Q) $(call SHLOG,cd $(OUT_DIR)/unittests/check && $(ROOT_DIR)/tools/runners/run-unittests.sh $(OUT_DIR)/unittests,$(OUT_DIR)/unittests/check/unittests.log,Unit tests)
|
||||||
|
|
||||||
.PHONY: test-js
|
.PHONY: test-js
|
||||||
test-js: \
|
test-js: \
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ TIMEOUT=${TIMEOUT:=5}
|
|||||||
ENGINE="$1"
|
ENGINE="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
OUT_DIR="$1"
|
|
||||||
shift
|
|
||||||
|
|
||||||
TESTS="$1"
|
TESTS="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
@@ -34,30 +31,20 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p $OUT_DIR
|
TEST_FILES=test.files
|
||||||
|
TEST_FAILED=test.failed
|
||||||
TEST_FILES=$OUT_DIR/test.files
|
TEST_PASSED=test.passed
|
||||||
TEST_FAILED=$OUT_DIR/test.failed
|
|
||||||
TEST_PASSED=$OUT_DIR/test.passed
|
|
||||||
|
|
||||||
if [ -d $TESTS ]
|
if [ -d $TESTS ]
|
||||||
then
|
then
|
||||||
TESTS_DIR=$TESTS
|
TESTS_DIR=$TESTS
|
||||||
|
|
||||||
( cd $TESTS; find . -path fail -prune -o -name "[^N]*.js" -print ) | sort > $TEST_FILES
|
( cd $TESTS; find . -name "[^N]*.js" ) | sort > $TEST_FILES
|
||||||
|
|
||||||
if [ -d $TESTS/fail ]
|
|
||||||
then
|
|
||||||
for error_code in `cd $TESTS/fail && ls -d [0-9]*`
|
|
||||||
do
|
|
||||||
( cd $TESTS; find ./fail/$error_code -name "[^N]*.js" -print ) | sort >> $TEST_FILES
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
elif [ -f $TESTS ]
|
elif [ -f $TESTS ]
|
||||||
then
|
then
|
||||||
TESTS_DIR=`dirname $TESTS`
|
TESTS_DIR=`dirname $TESTS`
|
||||||
|
|
||||||
cp $TESTS $TEST_FILES
|
grep -e '.js\s*$' $TESTS | sort > $TEST_FILES
|
||||||
else
|
else
|
||||||
echo "$0: $TESTS: not a test suite"
|
echo "$0: $TESTS: not a test suite"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -93,7 +80,7 @@ do
|
|||||||
|
|
||||||
echo -n "[$tested/$total] $ENGINE $ENGINE_ARGS $full_test: "
|
echo -n "[$tested/$total] $ENGINE $ENGINE_ARGS $full_test: "
|
||||||
|
|
||||||
( ulimit -t $TIMEOUT; $ENGINE $ENGINE_ARGS $full_test &>$ENGINE_TEMP; exit $? )
|
( ulimit -t $TIMEOUT; $ENGINE $ENGINE_ARGS $full_test &>$ENGINE_TEMP )
|
||||||
status_code=$?
|
status_code=$?
|
||||||
|
|
||||||
if [ $status_code -ne $error_code ]
|
if [ $status_code -ne $error_code ]
|
||||||
|
|||||||
@@ -18,10 +18,8 @@
|
|||||||
DIR="$1"
|
DIR="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
mkdir -p $DIR/check
|
UNITTEST_ERROR=unittests.failed
|
||||||
|
UNITTEST_OK=unittests.passed
|
||||||
UNITTEST_ERROR=$DIR/check/unittests.failed
|
|
||||||
UNITTEST_OK=$DIR/check/unittests.passed
|
|
||||||
|
|
||||||
rm -f $UNITTEST_ERROR $UNITTEST_OK
|
rm -f $UNITTEST_ERROR $UNITTEST_OK
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user