Test the build options

Add new build target: test-buildoptions
Now every build option is tested on the proper targets. These are the native
and the MCU targets in release mode and unittests.
Therefore the USE_COMPILER_DEFAULT_LIBC build option is refactored.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
This commit is contained in:
Zsolt Borbély
2016-03-11 10:06:19 +01:00
parent f0db5c9754
commit 21f8f06c51
3 changed files with 60 additions and 9 deletions
+2 -2
View File
@@ -114,9 +114,9 @@ project (Jerry C ASM)
set(MCU_SCRIPT_GENERATED_HEADER ${CMAKE_BINARY_DIR}/generated.h) set(MCU_SCRIPT_GENERATED_HEADER ${CMAKE_BINARY_DIR}/generated.h)
# Should we use external libc? # Should we use external libc?
if(DEFINED USE_COMPILER_DEFAULT_LIBC AND USE_COMPILER_DEFAULT_LIBC STREQUAL "YES") if(DEFINED COMPILER_DEFAULT_LIBC AND COMPILER_DEFAULT_LIBC STREQUAL "ON")
if(DEFINED EXTERNAL_LIBC_INTERFACE AND NOT EXTERNAL_LIBC_INTERFACE STREQUAL "UNDEFINED") if(DEFINED EXTERNAL_LIBC_INTERFACE AND NOT EXTERNAL_LIBC_INTERFACE STREQUAL "UNDEFINED")
message(FATAL_ERROR "EXTERNAL_LIBC_INTERFACE='${EXTERNAL_LIBC_INTERFACE}' should not be set in case compiler's default libc is used (USE_COMPILER_DEFAULT_LIBC=YES)") message(FATAL_ERROR "EXTERNAL_LIBC_INTERFACE='${EXTERNAL_LIBC_INTERFACE}' should not be set in case compiler's default libc is used (COMPILER_DEFAULT_LIBC=ON)")
endif() endif()
set(USE_JERRY_LIBC FALSE) set(USE_JERRY_LIBC FALSE)
+56 -5
View File
@@ -73,16 +73,19 @@ BUILD_NAME:=
# LOG # LOG
ifneq ($(LOG),) ifneq ($(LOG),)
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_LOG=$(LOG) CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_LOG=$(LOG)
BUILD_NAME:=$(BUILD_NAME)-LOG-$(LOG)
endif endif
# Date system calls # Date system calls
ifneq ($(DATE_SYS_CALLS),) ifneq ($(DATE_SYS_CALLS),)
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_DATE_SYS_CALLS=$(DATE_SYS_CALLS) CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_DATE_SYS_CALLS=$(DATE_SYS_CALLS)
BUILD_NAME:=$(BUILD_NAME)-DATE_SYS_CALLS-$(DATE_SYS_CALLS)
endif endif
# Fill error messages for builtin error objects # Fill error messages for builtin error objects
ifneq ($(ERROR_MESSAGES),) ifneq ($(ERROR_MESSAGES),)
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_ERROR_MESSAGES=$(ERROR_MESSAGES) CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_ERROR_MESSAGES=$(ERROR_MESSAGES)
BUILD_NAME:=$(BUILD_NAME)-ERROR_MESSAGES-$(ERROR_MESSAGES)
endif endif
# All-in-one build # All-in-one build
@@ -91,9 +94,10 @@ BUILD_NAME:=
BUILD_NAME:=$(BUILD_NAME)-ALL_IN_ONE-$(ALL_IN_ONE) BUILD_NAME:=$(BUILD_NAME)-ALL_IN_ONE-$(ALL_IN_ONE)
endif endif
# Flag, indicating whether to use compiler's default libc (YES / NO) # Flag, indicating whether to use compiler's default libc (ON / OFF)
ifneq ($(USE_COMPILER_DEFAULT_LIBC),) ifneq ($(COMPILER_DEFAULT_LIBC),)
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DUSE_COMPILER_DEFAULT_LIBC=$(USE_COMPILER_DEFAULT_LIBC) CMAKE_DEFINES:=$(CMAKE_DEFINES) -DCOMPILER_DEFAULT_LIBC=$(COMPILER_DEFAULT_LIBC)
BUILD_NAME:=$(BUILD_NAME)-COMPILER_DEFAULT_LIBC-$(COMPILER_DEFAULT_LIBC)
endif endif
# Apply strip to release binaries # Apply strip to release binaries
@@ -101,6 +105,10 @@ BUILD_NAME:=
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DSTRIP_RELEASE_BINARY=$(STRIP_RELEASE_BINARY) CMAKE_DEFINES:=$(CMAKE_DEFINES) -DSTRIP_RELEASE_BINARY=$(STRIP_RELEASE_BINARY)
endif endif
# For testing build-options
export BUILD_OPTIONS_TEST_MCU := LTO LOG DATE_SYS_CALLS ERROR_MESSAGES ALL_IN_ONE
export BUILD_OPTIONS_TEST_NATIVE := $(BUILD_OPTIONS_TEST_MCU) VALGRIND VALGRIND_FREYA COMPILER_DEFAULT_LIBC
# Directories # Directories
export ROOT_DIR := $(shell pwd) export ROOT_DIR := $(shell pwd)
export BUILD_DIR_PREFIX := $(ROOT_DIR)/build/obj export BUILD_DIR_PREFIX := $(ROOT_DIR)/build/obj
@@ -138,6 +146,18 @@ export JERRY_TEST_TARGETS_CP := \
$(foreach __MODE,$(DEBUG_MODES) $(RELEASE_MODES), \ $(foreach __MODE,$(DEBUG_MODES) $(RELEASE_MODES), \
$(__MODE).$(NATIVE_SYSTEM)-cp) $(__MODE).$(NATIVE_SYSTEM)-cp)
# Build-options test targets
export JERRY_BUILD_OPTIONS_TEST_TARGETS_NATIVE := \
$(foreach __MODE,$(RELEASE_MODES), \
$(__MODE).$(NATIVE_SYSTEM))
JERRY_BUILD_OPTIONS_TEST_TARGETS_NATIVE += unittests
export JERRY_BUILD_OPTIONS_TEST_TARGETS_MCU := \
$(foreach __MODE,$(RELEASE_MODES), \
$(foreach __SYSTEM,$(MCU_SYSTEMS), \
$(__MODE).mcu_$(__SYSTEM)))
# JS test suites (in the format of id:path) # JS test suites (in the format of id:path)
export JERRY_TEST_SUITE_J := j:$(ROOT_DIR)/tests/jerry export JERRY_TEST_SUITE_J := j:$(ROOT_DIR)/tests/jerry
export JERRY_TEST_SUITE_JTS := jts:$(ROOT_DIR)/tests/jerry-test-suite export JERRY_TEST_SUITE_JTS := jts:$(ROOT_DIR)/tests/jerry-test-suite
@@ -196,7 +216,9 @@ define WRITE_TOOLCHAIN_CONFIG
endef endef
.PHONY: $(BUILD_DIR)/$(NATIVE_SYSTEM)/toolchain.config .PHONY: $(BUILD_DIR)/$(NATIVE_SYSTEM)/toolchain.config
$(BUILD_DIR)/$(NATIVE_SYSTEM)/toolchain.config: .PHONY: $(BUILD_DIR)/$(NATIVE_SYSTEM)/unittests/toolchain.config
$(BUILD_DIR)/$(NATIVE_SYSTEM)/toolchain.config \
$(BUILD_DIR)/$(NATIVE_SYSTEM)/unittests/toolchain.config:
$(Q) if [ "$$TOOLCHAIN" == "" ]; \ $(Q) if [ "$$TOOLCHAIN" == "" ]; \
then \ then \
arch=`uname -m`; \ arch=`uname -m`; \
@@ -235,6 +257,8 @@ endef
$(foreach __SYSTEM,$(NATIVE_SYSTEM) $(MCU_SYSTEMS), \ $(foreach __SYSTEM,$(NATIVE_SYSTEM) $(MCU_SYSTEMS), \
$(eval $(call GEN_MAKEFILE_RULE,$(BUILD_DIR)/$(__SYSTEM)))) $(eval $(call GEN_MAKEFILE_RULE,$(BUILD_DIR)/$(__SYSTEM))))
$(eval $(call GEN_MAKEFILE_RULE,$(BUILD_DIR)/$(NATIVE_SYSTEM)/unittests))
# Targets to perform build and test steps in the build directories # Targets to perform build and test steps in the build directories
# Make rule macro to build a/some target(s) and copy out the result(s). # Make rule macro to build a/some target(s) and copy out the result(s).
@@ -274,7 +298,7 @@ $(foreach __TARGET,$(JERRY_STM32F4_TARGETS), \
$(eval $(call BUILD_RULE,build.mcu_stm32f4,stm32f4,$(patsubst %,%.bin,$(JERRY_STM32F4_TARGETS)))) $(eval $(call BUILD_RULE,build.mcu_stm32f4,stm32f4,$(patsubst %,%.bin,$(JERRY_STM32F4_TARGETS))))
$(eval $(call BUILD_RULE,unittests,$(NATIVE_SYSTEM),unittests)) $(eval $(call BUILD_RULE,unittests,$(NATIVE_SYSTEM)/unittests,unittests))
# Make rule macro to test a build target with a test suite. # Make rule macro to test a build target with a test suite.
# #
@@ -303,6 +327,24 @@ $(foreach __TARGET,$(JERRY_TEST_TARGETS_CP), \
$(foreach __SUITE,$(JERRY_TEST_SUITE_JTS_CP), \ $(foreach __SUITE,$(JERRY_TEST_SUITE_JTS_CP), \
$(eval $(call JSTEST_RULE,$(__TARGET),$(firstword $(subst :, ,$(__SUITE))),$(lastword $(subst :, ,$(__SUITE))))))) $(eval $(call JSTEST_RULE,$(__TARGET),$(firstword $(subst :, ,$(__SUITE))),$(lastword $(subst :, ,$(__SUITE)))))))
# Make rule macro to test a build target with a build option.
#
# $(1) - name of the target to test
# $(2) - name of the option to test
define OPTIONSTEST_RULE
.PHONY: test-option.$(1)-$(2)
test-option.$(1)-$(2):
$$(Q)+$(MAKE) --no-print-directory $(2)=ON $(1)
endef
$(foreach __TARGET,$(JERRY_BUILD_OPTIONS_TEST_TARGETS_NATIVE), \
$(foreach __OPTION, $(BUILD_OPTIONS_TEST_NATIVE), \
$(eval $(call OPTIONSTEST_RULE,$(__TARGET),$(__OPTION)))))
$(foreach __TARGET,$(JERRY_BUILD_OPTIONS_TEST_TARGETS_MCU), \
$(foreach __OPTION, $(BUILD_OPTIONS_TEST_MCU), \
$(eval $(call OPTIONSTEST_RULE,$(__TARGET),$(__OPTION)))))
# Targets to perform batch builds, checks, and tests # Targets to perform batch builds, checks, and tests
.PHONY: clean .PHONY: clean
@@ -344,6 +386,15 @@ test-js-precommit: \
$(foreach __SUITE,$(JERRY_TEST_SUITE_J) $(JERRY_TEST_SUITE_JTS_PREC), \ $(foreach __SUITE,$(JERRY_TEST_SUITE_J) $(JERRY_TEST_SUITE_JTS_PREC), \
test-js.$(__TARGET).$(firstword $(subst :, ,$(__SUITE))))) test-js.$(__TARGET).$(firstword $(subst :, ,$(__SUITE)))))
.PHONY: test-buildoptions
test-buildoptions: \
$(foreach __TARGET,$(JERRY_BUILD_OPTIONS_TEST_TARGETS_NATIVE), \
$(foreach __OPTION, $(BUILD_OPTIONS_TEST_NATIVE), \
test-option.$(__TARGET)-$(__OPTION))) \
$(foreach __TARGET,$(JERRY_BUILD_OPTIONS_TEST_TARGETS_MCU), \
$(foreach __OPTION, $(BUILD_OPTIONS_TEST_MCU), \
test-option.$(__TARGET)-$(__OPTION))) \
.PHONY: precommit .PHONY: precommit
precommit: prerequisites precommit: prerequisites
$(Q)+$(MAKE) --no-print-directory clean $(Q)+$(MAKE) --no-print-directory clean
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2015 Samsung Electronics Co., Ltd. # Copyright 2015-2016 Samsung Electronics Co., Ltd.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ jerry:
-DENABLE_LTO=OFF \ -DENABLE_LTO=OFF \
-DENABLE_VALGRIND=OFF \ -DENABLE_VALGRIND=OFF \
-DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_external.cmake \ -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_external.cmake \
-DUSE_COMPILER_DEFAULT_LIBC=YES \ -DCOMPILER_DEFAULT_LIBC=ON \
-DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=arm7-m \ -DEXTERNAL_CMAKE_SYSTEM_PROCESSOR=arm7-m \
-DEXTERNAL_CMAKE_C_COMPILER=arm-none-eabi-gcc \ -DEXTERNAL_CMAKE_C_COMPILER=arm-none-eabi-gcc \
-DEXTERNAL_CMAKE_C_COMPILER_ID=GNU \ -DEXTERNAL_CMAKE_C_COMPILER_ID=GNU \