From 92a9d6db45c0da72ae49ee8856a5121a28ab8841 Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Tue, 17 Feb 2015 13:44:05 +0300 Subject: [PATCH] Moving precommit testing scripts from Makefile[.mk] to tools/runners/run-precommit-check-for-target.sh and tools/precommit.sh; deleting Makefile.mk. --- CMakeLists.txt | 9 +- Makefile | 81 +++------------ Makefile.mk | 98 ------------------- .../arguments_assignment_strict.js | 0 .../{255 => 12}/arguments_catch_strict.js | 0 ...arguments_in_prop_set_param_list_strict.js | 0 .../arguments_in_var_decl_strict.js | 0 .../{255 => 12}/arguments_param_strict.js | 0 .../{255 => 12}/arguments_postfix_strict.js | 0 .../{255 => 12}/arguments_prefix_strict.js | 0 tests/jerry/fail/{255 => 12}/delete_strict.js | 0 .../{255 => 12}/eval_assignment_strict.js | 0 .../fail/{255 => 12}/eval_catch_strict.js | 0 .../eval_in_prop_set_param_list_strict.js | 0 .../{255 => 12}/eval_in_var_decl_strict.js | 0 .../fail/{255 => 12}/eval_param_strict.js | 0 .../fail/{255 => 12}/eval_postfix_strict.js | 0 .../fail/{255 => 12}/eval_prefix_strict.js | 0 tests/jerry/fail/{255 => 12}/let_strict.js | 0 .../jerry/fail/{255 => 12}/object_get_data.js | 0 .../jerry/fail/{255 => 12}/object_get_get.js | 0 .../object_several_prop_names_strict.js | 0 tests/jerry/fail/{255 => 12}/octal_strict.js | 0 .../{255 => 12}/param_duplication_strict.js | 0 tests/jerry/fail/{255 => 12}/with_strict.js | 0 tools/precommit.sh | 70 +++++++++++++ .../runners/run-precommit-check-for-target.sh | 49 ++++++++++ tools/runners/run-test-pass.sh | 6 +- tools/runners/run-test-xfail.sh | 6 +- tools/runners/run-unittests.sh | 3 +- 30 files changed, 141 insertions(+), 181 deletions(-) delete mode 100644 Makefile.mk rename tests/jerry/fail/{255 => 12}/arguments_assignment_strict.js (100%) rename tests/jerry/fail/{255 => 12}/arguments_catch_strict.js (100%) rename tests/jerry/fail/{255 => 12}/arguments_in_prop_set_param_list_strict.js (100%) rename tests/jerry/fail/{255 => 12}/arguments_in_var_decl_strict.js (100%) rename tests/jerry/fail/{255 => 12}/arguments_param_strict.js (100%) rename tests/jerry/fail/{255 => 12}/arguments_postfix_strict.js (100%) rename tests/jerry/fail/{255 => 12}/arguments_prefix_strict.js (100%) rename tests/jerry/fail/{255 => 12}/delete_strict.js (100%) rename tests/jerry/fail/{255 => 12}/eval_assignment_strict.js (100%) rename tests/jerry/fail/{255 => 12}/eval_catch_strict.js (100%) rename tests/jerry/fail/{255 => 12}/eval_in_prop_set_param_list_strict.js (100%) rename tests/jerry/fail/{255 => 12}/eval_in_var_decl_strict.js (100%) rename tests/jerry/fail/{255 => 12}/eval_param_strict.js (100%) rename tests/jerry/fail/{255 => 12}/eval_postfix_strict.js (100%) rename tests/jerry/fail/{255 => 12}/eval_prefix_strict.js (100%) rename tests/jerry/fail/{255 => 12}/let_strict.js (100%) rename tests/jerry/fail/{255 => 12}/object_get_data.js (100%) rename tests/jerry/fail/{255 => 12}/object_get_get.js (100%) rename tests/jerry/fail/{255 => 12}/object_several_prop_names_strict.js (100%) rename tests/jerry/fail/{255 => 12}/octal_strict.js (100%) rename tests/jerry/fail/{255 => 12}/param_duplication_strict.js (100%) rename tests/jerry/fail/{255 => 12}/with_strict.js (100%) create mode 100755 tools/precommit.sh create mode 100755 tools/runners/run-precommit-check-for-target.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index c7db5c88c..4ea3a3e36 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,7 +145,7 @@ project (Jerry CXX C ASM) set(COMPILE_FLAGS_JERRY "${COMPILE_FLAGS_JERRY} -Werror -Wfatal-errors") # Static build - set(LINKER_FLAGS_STATIC "-static") + set(LINKER_FLAGS_STATIC "-static") # C++ set(CXX_FLAGS_JERRY "-std=c++11 -fno-exceptions -fno-rtti") @@ -165,11 +165,9 @@ project (Jerry CXX C ASM) # Debug set(FLAGS_COMMON_DEBUG "-nostdlib") - set(LINKER_FLAGS_COMMON_DEBUG "-nostdlib") # Release set(FLAGS_COMMON_RELEASE "-Os -flto -nostdlib") - set(LINKER_FLAGS_COMMON_RELEASE "-nostdlib") # Unit tests set(FLAGS_COMMON_UNITTESTS "-O3 -flto -nodefaultlibs") @@ -234,7 +232,7 @@ project (Jerry CXX C ASM) function(declare_target_with_modifiers ) # modifiers are passed in ARGN implicit argument set(CORE_TARGET_NAME ${BUILD_MODE_PREFIX_${BUILD_MODE}}) - foreach(MODIFIER ${ARGN}) # FIXME + foreach(MODIFIER ${ARGN}) set(TARGET_NAME ${TARGET_NAME}${MODIFIER_SUFFIX_${MODIFIER}}) set(LIBC_TARGET_NAME ${LIBC_TARGET_NAME}${MODIFIER_SUFFIX_${MODIFIER}}) @@ -306,8 +304,7 @@ project (Jerry CXX C ASM) PROPERTY COMPILE_FLAGS "${COMPILE_FLAGS_JERRY} ${CXX_FLAGS_JERRY} ${FLAGS_COMMON_UNITTESTS}") set_property(TARGET ${TARGET_NAME} PROPERTY LINK_FLAGS "${COMPILE_FLAGS_JERRY} ${CXX_FLAGS_JERRY} ${FLAGS_COMMON_UNITTESTS} ${LINKER_FLAGS_COMMON}") - target_compile_definitions(${TARGET_NAME} PRIVATE ${DEFINES_UNIT_TEST}) - target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_CORE}) + target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDE_CORE_INTERFACE}) target_link_libraries(${TARGET_NAME} ${CORE_TARGET_NAME} imported_libc imported_libgcc) add_dependencies(unittests ${TARGET_NAME}) diff --git a/Makefile b/Makefile index 881020133..a3b19deeb 100644 --- a/Makefile +++ b/Makefile @@ -73,6 +73,9 @@ export OUT_DIR = ./build/bin export SHELL=/bin/bash +# Precommit check targets + PRECOMMIT_CHECK_TARGETS_LIST := debug.linux release.linux + # Building all options combinations OPTIONS_COMBINATIONS := $(foreach __OPTION,ON OFF,$(__COMBINATION)-VALGRIND-$(__OPTION)) # OPTIONS_COMBINATIONS := $(foreach __COMBINATION,$(OPTIONS_COMBINATIONS),$(foreach __OPTION,ON OFF,$(__COMBINATION)-{ANOTHER_OPTION}-$(__OPTION))) @@ -106,17 +109,20 @@ $(BUILD_DIRS_NATIVE): fi; \ mkdir -p $@ && \ cd $@ && \ - cmake -DENABLE_VALGRIND=$(VALGRIND) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_linux_$$arch.cmake ../../.. &>cmake.log + cmake -DENABLE_VALGRIND=$(VALGRIND) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_linux_$$arch.cmake ../../.. &>cmake.log || \ + (echo "CMake run failed. See "`pwd`"/cmake.log for details."; exit 1;) $(BUILD_DIRS_STM32F3): @ mkdir -p $@ && \ cd $@ && \ - cmake -DENABLE_VALGRIND=$(VALGRIND) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f3.cmake ../../.. &>cmake.log + cmake -DENABLE_VALGRIND=$(VALGRIND) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f3.cmake ../../.. &>cmake.log || \ + (echo "CMake run failed. See "`pwd`"/cmake.log for details."; exit 1;) $(BUILD_DIRS_STM32F4): @ mkdir -p $@ && \ cd $@ && \ - cmake -DENABLE_VALGRIND=$(VALGRIND) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f4.cmake ../../.. &>cmake.log + cmake -DENABLE_VALGRIND=$(VALGRIND) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f4.cmake ../../.. &>cmake.log || \ + (echo "CMake run failed. See "`pwd`"/cmake.log for details."; exit 1;) $(JERRY_LINUX_TARGETS): $(BUILD_DIR)/native @ mkdir -p $(OUT_DIR)/$@ @@ -145,13 +151,6 @@ build: $(JERRY_TARGETS) unittests $(FLASH_TARGETS): $(BUILD_DIR)/mcu @$(MAKE) -C $(BUILD_DIR)/mcu VERBOSE=1 $@ 1>/dev/null -PRECOMMIT_CHECK_TARGETS_NO_VALGRIND_LIST= debug.linux.check \ - release.linux.check - -PRECOMMIT_CHECK_TARGETS_VALGRIND_LIST= #debug.linux-valgrind.check \ - release.linux-valgrind.check \ - release.linux-cp-valgrind.check - push: ./tools/git-scripts/push.sh @ ./tools/git-scripts/push.sh @@ -162,65 +161,13 @@ log: ./tools/git-scripts/log.sh @ ./tools/git-scripts/log.sh precommit: clean - @ echo -e "\nBuilding...\n\n" - @ $(MAKE) build - @ echo -e "\n================ Build completed successfully. Running precommit tests ================\n" - @ echo -e "All targets were built successfully. Starting unit tests' run.\n" - @ $(MAKE) unittests_run TESTS_OPTS="--silent" - @ echo -e "Unit tests completed successfully. Starting parse-only testing.\n" - @ echo -e "All targets were built successfully. Starting parse-only testing.\n" - @ # Parse-only testing - @ for path in "./tests/jerry" "./tests/benchmarks/jerry"; \ - do \ - run_ids=""; \ - for check_target in $(PRECOMMIT_CHECK_TARGETS_NO_VALGRIND_LIST) $(PRECOMMIT_CHECK_TARGETS_VALGRIND_LIST); \ - do \ - $(MAKE) -s -f Makefile.mk TARGET=$$check_target $$check_target TESTS="$$path" TESTS_OPTS="--parse-only" OUTPUT_TO_LOG=enable & \ - run_ids="$$run_ids $$!"; \ - done; \ - result_ok=1; \ - for run_id in $$run_ids; \ - do \ - wait $$run_id || result_ok=0; \ - done; \ - [ $$result_ok -eq 1 ] || exit 1; \ - done - @ echo -e "Parse-only testing completed successfully. Starting full tests run.\n" - @ # Full testing - @ for path in "./tests/jerry"; \ - do \ - run_ids=""; \ - for check_target in $(PRECOMMIT_CHECK_TARGETS_NO_VALGRIND_LIST) $(PRECOMMIT_CHECK_TARGETS_VALGRIND_LIST); \ - do \ - $(MAKE) -s -f Makefile.mk TARGET=$$check_target $$check_target TESTS="$$path" TESTS_OPTS="" OUTPUT_TO_LOG=enable & \ - run_ids="$$run_ids $$!"; \ - done; \ - result_ok=1; \ - for run_id in $$run_ids; \ - do \ - wait $$run_id || result_ok=0; \ - done; \ - [ $$result_ok -eq 1 ] || exit 1; \ - done - @ for path in "./tests/jerry-test-suite/precommit_test_list"; \ - do \ - run_ids=""; \ - for check_target in $(PRECOMMIT_CHECK_TARGETS_NO_VALGRIND_LIST); \ - do \ - $(MAKE) -s -f Makefile.mk TARGET=$$check_target $$check_target TESTS="$$path" TESTS_OPTS="" OUTPUT_TO_LOG=enable & \ - run_ids="$$run_ids $$!"; \ - done; \ - result_ok=1; \ - for run_id in $$run_ids; \ - do \ - wait $$run_id || result_ok=0; \ - done; \ - [ $$result_ok -eq 1 ] || exit 1; \ - done - @ echo -e "Full testing completed successfully\n\n================\n\n" + @ ./tools/precommit.sh "$(MAKE)" "$(OUT_DIR)" "$(PRECOMMIT_CHECK_TARGETS_LIST)" unittests_run: unittests - @$(MAKE) -s -f Makefile.mk TARGET=$@ $@ + @rm -rf $(OUT_DIR)/unittests/check + @mkdir -p $(OUT_DIR)/unittests/check + @./tools/runners/run-unittests.sh $(OUT_DIR)/unittests || \ + (echo "Unit tests run failed. See $(OUT_DIR)/unittests/unit_tests_run.log for details."; exit 1;) clean: @ rm -rf $(BUILD_DIR_PREFIX)* $(OUT_DIR) diff --git a/Makefile.mk b/Makefile.mk deleted file mode 100644 index cf9e571f7..000000000 --- a/Makefile.mk +++ /dev/null @@ -1,98 +0,0 @@ -export SHELL=/bin/bash - -ifeq ($(TARGET),) - $(error TARGET not set) -endif - -ENGINE_NAME ?= jerry - -# Parsing target -# '.' -> ' ' -TARGET_SPACED := $(subst ., ,$(TARGET)) -# extract target mode part -TARGET_MODE := $(word 1,$(TARGET_SPACED)) -# extract target system part with modifiers -TARGET_SYSTEM_AND_MODS := $(word 2,$(TARGET_SPACED)) -TARGET_SYSTEM_AND_MODS_SPACED := $(subst -, ,$(TARGET_SYSTEM_AND_MODS)) - -# extract target system part -TARGET_SYSTEM := $(word 1,$(TARGET_SYSTEM_AND_MODS_SPACED)) - -# extract modifiers -TARGET_MODS := $(wordlist 2, $(words $(TARGET_SYSTEM_AND_MODS_SPACED)), $(TARGET_SYSTEM_AND_MODS_SPACED)) - -# extract optional action part -TARGET_ACTION := $(word 3,$(TARGET_SPACED)) - -# Target used as dependency of an action (check, flash, etc.) -TARGET_OF_ACTION := $(TARGET_MODE).$(TARGET_SYSTEM_AND_MODS) - -# target folder name in $(OUT_DIR) -TARGET_DIR=$(OUT_DIR)/$(TARGET_MODE).$(TARGET_SYSTEM_AND_MODS) - -# unittests mode -> linux system -ifeq ($(TARGET_MODE),unittests_run) - TARGET_SYSTEM := linux - TARGET_SYSTEM_AND_MODS := $(TARGET_SYSTEM) - TARGET_DIR := $(OUT_DIR)/unittests -endif - -ifeq ($(filter valgrind,$(TARGET_MODS)), valgrind) - OPTION_VALGRIND := enable - - ifeq ($(OPTION_SANITIZE),enable) - $(error ASAN and Valgrind are mutually exclusive) - endif -else - OPTION_VALGRIND := disable -endif - -ifeq ($(OPTION_VALGRIND),enable) - VALGRIND_CMD := "valgrind --error-exitcode=254 --track-origins=yes" - VALGRIND_TIMEOUT := 60 -else - VALGRIND_CMD := - VALGRIND_TIMEOUT := -endif - -.PHONY: unittests_run $(CHECK_TARGETS) - -unittests_run: - @ VALGRIND=$(VALGRIND_CMD) ./tools/runners/run-unittests.sh $(TARGET_DIR) $(TESTS_OPTS) - -$(CHECK_TARGETS): - @ if [ ! -f $(TARGET_DIR)/$(ENGINE_NAME) ]; then echo $(TARGET_OF_ACTION) is not built yet; exit 1; fi; - @ if [[ ! -d "$(TESTS)" && ! -f "$(TESTS)" ]]; then echo \"$(TESTS)\" is not a directory and not a file; exit 1; fi; - @ rm -rf $(TARGET_DIR)/check - @ mkdir -p $(TARGET_DIR)/check - @ if [ "$(OUTPUT_TO_LOG)" = "enable" ]; \ - then \ - ADD_OPTS="--output-to-log"; \ - fi; \ - VALGRIND=$(VALGRIND_CMD) TIMEOUT=$(VALGRIND_TIMEOUT) ./tools/runners/run-test-pass.sh $(TARGET_DIR)/$(ENGINE_NAME) $(TARGET_DIR)/check $(TESTS) $(TESTS_OPTS) $$ADD_OPTS; \ - status_code=$$?; \ - if [ $$status_code -ne 0 ]; \ - then \ - echo $(TARGET) failed; \ - if [ "$(OUTPUT_TO_LOG)" = "enable" ]; \ - then \ - echo See log in $(TARGET_DIR)/check directory for details.; \ - fi; \ - \ - exit $$status_code; \ - fi; \ - if [ -d $(TESTS_DIR)/fail/ ]; \ - then \ - VALGRIND=$(VALGRIND_CMD) TIMEOUT=$(VALGRIND_TIMEOUT) ./tools/runners/run-test-xfail.sh $(TARGET_DIR)/$(ENGINE_NAME) $(TARGET_DIR)/check $(PARSER_ERROR_CODE) $(TESTS_DIR) $(TESTS_OPTS) $$ADD_OPTS; \ - status_code=$$?; \ - if [ $$status_code -ne 0 ]; \ - then \ - echo $(TARGET) failed; \ - if [ "$(OUTPUT_TO_LOG)" = "enable" ]; \ - then \ - echo See log in $(TARGET_DIR)/check directory for details.; \ - fi; \ - \ - exit $$status_code; \ - fi; \ - fi; diff --git a/tests/jerry/fail/255/arguments_assignment_strict.js b/tests/jerry/fail/12/arguments_assignment_strict.js similarity index 100% rename from tests/jerry/fail/255/arguments_assignment_strict.js rename to tests/jerry/fail/12/arguments_assignment_strict.js diff --git a/tests/jerry/fail/255/arguments_catch_strict.js b/tests/jerry/fail/12/arguments_catch_strict.js similarity index 100% rename from tests/jerry/fail/255/arguments_catch_strict.js rename to tests/jerry/fail/12/arguments_catch_strict.js diff --git a/tests/jerry/fail/255/arguments_in_prop_set_param_list_strict.js b/tests/jerry/fail/12/arguments_in_prop_set_param_list_strict.js similarity index 100% rename from tests/jerry/fail/255/arguments_in_prop_set_param_list_strict.js rename to tests/jerry/fail/12/arguments_in_prop_set_param_list_strict.js diff --git a/tests/jerry/fail/255/arguments_in_var_decl_strict.js b/tests/jerry/fail/12/arguments_in_var_decl_strict.js similarity index 100% rename from tests/jerry/fail/255/arguments_in_var_decl_strict.js rename to tests/jerry/fail/12/arguments_in_var_decl_strict.js diff --git a/tests/jerry/fail/255/arguments_param_strict.js b/tests/jerry/fail/12/arguments_param_strict.js similarity index 100% rename from tests/jerry/fail/255/arguments_param_strict.js rename to tests/jerry/fail/12/arguments_param_strict.js diff --git a/tests/jerry/fail/255/arguments_postfix_strict.js b/tests/jerry/fail/12/arguments_postfix_strict.js similarity index 100% rename from tests/jerry/fail/255/arguments_postfix_strict.js rename to tests/jerry/fail/12/arguments_postfix_strict.js diff --git a/tests/jerry/fail/255/arguments_prefix_strict.js b/tests/jerry/fail/12/arguments_prefix_strict.js similarity index 100% rename from tests/jerry/fail/255/arguments_prefix_strict.js rename to tests/jerry/fail/12/arguments_prefix_strict.js diff --git a/tests/jerry/fail/255/delete_strict.js b/tests/jerry/fail/12/delete_strict.js similarity index 100% rename from tests/jerry/fail/255/delete_strict.js rename to tests/jerry/fail/12/delete_strict.js diff --git a/tests/jerry/fail/255/eval_assignment_strict.js b/tests/jerry/fail/12/eval_assignment_strict.js similarity index 100% rename from tests/jerry/fail/255/eval_assignment_strict.js rename to tests/jerry/fail/12/eval_assignment_strict.js diff --git a/tests/jerry/fail/255/eval_catch_strict.js b/tests/jerry/fail/12/eval_catch_strict.js similarity index 100% rename from tests/jerry/fail/255/eval_catch_strict.js rename to tests/jerry/fail/12/eval_catch_strict.js diff --git a/tests/jerry/fail/255/eval_in_prop_set_param_list_strict.js b/tests/jerry/fail/12/eval_in_prop_set_param_list_strict.js similarity index 100% rename from tests/jerry/fail/255/eval_in_prop_set_param_list_strict.js rename to tests/jerry/fail/12/eval_in_prop_set_param_list_strict.js diff --git a/tests/jerry/fail/255/eval_in_var_decl_strict.js b/tests/jerry/fail/12/eval_in_var_decl_strict.js similarity index 100% rename from tests/jerry/fail/255/eval_in_var_decl_strict.js rename to tests/jerry/fail/12/eval_in_var_decl_strict.js diff --git a/tests/jerry/fail/255/eval_param_strict.js b/tests/jerry/fail/12/eval_param_strict.js similarity index 100% rename from tests/jerry/fail/255/eval_param_strict.js rename to tests/jerry/fail/12/eval_param_strict.js diff --git a/tests/jerry/fail/255/eval_postfix_strict.js b/tests/jerry/fail/12/eval_postfix_strict.js similarity index 100% rename from tests/jerry/fail/255/eval_postfix_strict.js rename to tests/jerry/fail/12/eval_postfix_strict.js diff --git a/tests/jerry/fail/255/eval_prefix_strict.js b/tests/jerry/fail/12/eval_prefix_strict.js similarity index 100% rename from tests/jerry/fail/255/eval_prefix_strict.js rename to tests/jerry/fail/12/eval_prefix_strict.js diff --git a/tests/jerry/fail/255/let_strict.js b/tests/jerry/fail/12/let_strict.js similarity index 100% rename from tests/jerry/fail/255/let_strict.js rename to tests/jerry/fail/12/let_strict.js diff --git a/tests/jerry/fail/255/object_get_data.js b/tests/jerry/fail/12/object_get_data.js similarity index 100% rename from tests/jerry/fail/255/object_get_data.js rename to tests/jerry/fail/12/object_get_data.js diff --git a/tests/jerry/fail/255/object_get_get.js b/tests/jerry/fail/12/object_get_get.js similarity index 100% rename from tests/jerry/fail/255/object_get_get.js rename to tests/jerry/fail/12/object_get_get.js diff --git a/tests/jerry/fail/255/object_several_prop_names_strict.js b/tests/jerry/fail/12/object_several_prop_names_strict.js similarity index 100% rename from tests/jerry/fail/255/object_several_prop_names_strict.js rename to tests/jerry/fail/12/object_several_prop_names_strict.js diff --git a/tests/jerry/fail/255/octal_strict.js b/tests/jerry/fail/12/octal_strict.js similarity index 100% rename from tests/jerry/fail/255/octal_strict.js rename to tests/jerry/fail/12/octal_strict.js diff --git a/tests/jerry/fail/255/param_duplication_strict.js b/tests/jerry/fail/12/param_duplication_strict.js similarity index 100% rename from tests/jerry/fail/255/param_duplication_strict.js rename to tests/jerry/fail/12/param_duplication_strict.js diff --git a/tests/jerry/fail/255/with_strict.js b/tests/jerry/fail/12/with_strict.js similarity index 100% rename from tests/jerry/fail/255/with_strict.js rename to tests/jerry/fail/12/with_strict.js diff --git a/tools/precommit.sh b/tools/precommit.sh new file mode 100755 index 000000000..6190594d9 --- /dev/null +++ b/tools/precommit.sh @@ -0,0 +1,70 @@ +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#!/bin/bash + +MAKE="$1" +shift + +OUT_DIR="$1" +shift + +TARGETS="$1" +shift + +PARSE_ONLY_TESTING_PATHS="./tests/benchmarks/jerry" +FULL_TESTING_PATHS="./tests/jerry ./tests/jerry-test-suite/precommit_test_list" + +echo -e "\nBuilding...\n\n" +$MAKE build || exit 1 +echo -e "\n================ Build completed successfully. Running precommit tests ================\n" +echo -e "All targets were built successfully. Starting unit tests' run.\n" +$MAKE unittests_run || exit 1 +echo -e "Unit tests completed successfully. Starting full testing.\n" + +RUN_IDS="" + +for TARGET in $TARGETS +do + ENGINE=$OUT_DIR/$TARGET/jerry + LOGS_PATH_PARSE_ONLY=$OUT_DIR/$TARGET/check_parse_only + LOGS_PATH_FULL=$OUT_DIR/$TARGET/check + + # Parse-only testing + INDEX=0 + for TESTS_PATH in "./tests/benchmarks/jerry" + do + ./tools/runners/run-precommit-check-for-target.sh $ENGINE $LOGS_PATH_PARSE_ONLY/$INDEX $TESTS_PATH --parse-only & + RUN_IDS="$RUN_IDS $!"; + INDEX=$((INDEX + 1)) + done + + # Full testing + INDEX=0 + for TESTS_PATH in "./tests/jerry" "./tests/jerry-test-suite/precommit_test_list" + do + ./tools/runners/run-precommit-check-for-target.sh $ENGINE $LOGS_PATH_FULL/$INDEX $TESTS_PATH & + RUN_IDS="$RUN_IDS $!"; + INDEX=$((INDEX + 1)) + done +done + +RESULT_OK=1 +for RUN_ID in $RUN_IDS +do + wait $RUN_ID || RESULT_OK=0 +done; +[ $RESULT_OK -eq 1 ] || exit 1 + +echo -e "Full testing completed successfully\n\n================\n\n" diff --git a/tools/runners/run-precommit-check-for-target.sh b/tools/runners/run-precommit-check-for-target.sh new file mode 100755 index 000000000..6fa121901 --- /dev/null +++ b/tools/runners/run-precommit-check-for-target.sh @@ -0,0 +1,49 @@ +# Copyright 2015 Samsung Electronics Co., Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#!/bin/bash + +ENGINE_PATH="$1" +OUTPUT_PATH="$2" +TESTS_PATH="$3" +TESTS_OPTS="$4" + +[ -x $ENGINE_PATH ] || exit 1 +[[ -d $TESTS_PATH || -f $TESTS_PATH ]] || exit 1 +mkdir -p $OUTPUT_PATH || exit 1 + +./tools/runners/run-test-pass.sh $ENGINE_PATH $OUTPUT_PATH $TESTS_PATH $TESTS_OPTS --output-to-log; status_code=$? +if [ $status_code -ne 0 ] +then + echo "$ENGINE_PATH testing failed" + echo "See log in $OUTPUT_PATH directory for details." + exit $status_code +fi + +if [ -d $TESTS_PATH/fail ] +then + for error_code in `cd $TESTS_PATH/fail && ls -d [0-9]*` + do + ./tools/runners/run-test-xfail.sh $ENGINE_PATH $OUTPUT_PATH $error_code $TESTS_PATH $TESTS_OPTS --output-to-log; status_code=$? + + if [ $status_code -ne 0 ] + then + echo "$ENGINE_PATH testing failed" + echo "See log in $OUTPUT_PATH directory for details." + exit $status_code + fi + done +fi + +exit 0 diff --git a/tools/runners/run-test-pass.sh b/tools/runners/run-test-pass.sh index 7979ebc7c..015004c2f 100755 --- a/tools/runners/run-test-pass.sh +++ b/tools/runners/run-test-pass.sh @@ -74,15 +74,13 @@ passed=0 JERRY_TEMP=jerry.tmp -exec 2>/dev/null - echo " Passed / Failed / Tested / Total / Percent" for test in `cat $JS_FILES` do percent=$(echo $tested*100/$total | bc) - ( ulimit -t $TIMEOUT; $VALGRIND ${ENGINE} ${JERRY_ARGS} ${test} >&$JERRY_TEMP; exit $? ); + ( ulimit -t $TIMEOUT; ${ENGINE} ${JERRY_ARGS} ${test} &>$JERRY_TEMP; exit $? ); status_code=$? if [ $ECHO_PROGRESS -eq 1 ] @@ -108,7 +106,7 @@ do tested=$((tested+1)) done -rm $JERRY_TEMP +rm -f $JERRY_TEMP printf "\r\e[2K[ %6d / %6d / %6d / %5d / %3d%% ]\n" ${passed} ${failed} ${tested} ${total} ${percent} diff --git a/tools/runners/run-test-xfail.sh b/tools/runners/run-test-xfail.sh index 410c25fef..21a3b02ba 100755 --- a/tools/runners/run-test-xfail.sh +++ b/tools/runners/run-test-xfail.sh @@ -1,4 +1,4 @@ -# Copyright 2014 Samsung Electronics Co., Ltd. +# Copyright 2014-2015 Samsung Electronics Co., Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -82,15 +82,13 @@ passed=0 JERRY_TEMP=jerry.tmp -exec 2>/dev/null - echo " Passed / Failed / Tested / Total / Percent" for test in `cat $JS_FILES` do percent=$(echo $tested*100/$total | bc) - ( ulimit -t $TIMEOUT; $VALGRIND ${ENGINE} ${test} ${JERRY_ARGS} >&$JERRY_TEMP; exit $? ); + ( ulimit -t $TIMEOUT; ${ENGINE} ${test} ${JERRY_ARGS} >&$JERRY_TEMP; exit $? ); status_code=$? if [ $ECHO_PROGRESS -eq 1 ] diff --git a/tools/runners/run-unittests.sh b/tools/runners/run-unittests.sh index 44c457794..7217212e7 100755 --- a/tools/runners/run-unittests.sh +++ b/tools/runners/run-unittests.sh @@ -36,7 +36,7 @@ for unit_test in $UNITTESTS; do [ $OPTION_SILENT = "enable" ] || echo -n "Running $unit_test... "; - $VALGRIND $unit_test >&$DIR/unit_tests_run.log.tmp; + $unit_test >&$DIR/unit_tests_run.log.tmp; status_code=$? cat $DIR/unit_tests_run.log.tmp >> $DIR/unit_tests_run.log rm $DIR/unit_tests_run.log.tmp @@ -49,4 +49,3 @@ do exit 1; fi; done -