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:
+2
-2
@@ -114,9 +114,9 @@ project (Jerry C ASM)
|
||||
set(MCU_SCRIPT_GENERATED_HEADER ${CMAKE_BINARY_DIR}/generated.h)
|
||||
|
||||
# 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")
|
||||
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()
|
||||
|
||||
set(USE_JERRY_LIBC FALSE)
|
||||
|
||||
@@ -73,16 +73,19 @@ BUILD_NAME:=
|
||||
# LOG
|
||||
ifneq ($(LOG),)
|
||||
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_LOG=$(LOG)
|
||||
BUILD_NAME:=$(BUILD_NAME)-LOG-$(LOG)
|
||||
endif
|
||||
|
||||
# Date system calls
|
||||
ifneq ($(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
|
||||
|
||||
# Fill error messages for builtin error objects
|
||||
ifneq ($(ERROR_MESSAGES),)
|
||||
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_ERROR_MESSAGES=$(ERROR_MESSAGES)
|
||||
BUILD_NAME:=$(BUILD_NAME)-ERROR_MESSAGES-$(ERROR_MESSAGES)
|
||||
endif
|
||||
|
||||
# All-in-one build
|
||||
@@ -91,9 +94,10 @@ BUILD_NAME:=
|
||||
BUILD_NAME:=$(BUILD_NAME)-ALL_IN_ONE-$(ALL_IN_ONE)
|
||||
endif
|
||||
|
||||
# Flag, indicating whether to use compiler's default libc (YES / NO)
|
||||
ifneq ($(USE_COMPILER_DEFAULT_LIBC),)
|
||||
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DUSE_COMPILER_DEFAULT_LIBC=$(USE_COMPILER_DEFAULT_LIBC)
|
||||
# Flag, indicating whether to use compiler's default libc (ON / OFF)
|
||||
ifneq ($(COMPILER_DEFAULT_LIBC),)
|
||||
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DCOMPILER_DEFAULT_LIBC=$(COMPILER_DEFAULT_LIBC)
|
||||
BUILD_NAME:=$(BUILD_NAME)-COMPILER_DEFAULT_LIBC-$(COMPILER_DEFAULT_LIBC)
|
||||
endif
|
||||
|
||||
# Apply strip to release binaries
|
||||
@@ -101,6 +105,10 @@ BUILD_NAME:=
|
||||
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DSTRIP_RELEASE_BINARY=$(STRIP_RELEASE_BINARY)
|
||||
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
|
||||
export ROOT_DIR := $(shell pwd)
|
||||
export BUILD_DIR_PREFIX := $(ROOT_DIR)/build/obj
|
||||
@@ -138,6 +146,18 @@ export JERRY_TEST_TARGETS_CP := \
|
||||
$(foreach __MODE,$(DEBUG_MODES) $(RELEASE_MODES), \
|
||||
$(__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)
|
||||
export JERRY_TEST_SUITE_J := j:$(ROOT_DIR)/tests/jerry
|
||||
export JERRY_TEST_SUITE_JTS := jts:$(ROOT_DIR)/tests/jerry-test-suite
|
||||
@@ -196,7 +216,9 @@ define WRITE_TOOLCHAIN_CONFIG
|
||||
endef
|
||||
|
||||
.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" == "" ]; \
|
||||
then \
|
||||
arch=`uname -m`; \
|
||||
@@ -235,6 +257,8 @@ endef
|
||||
$(foreach __SYSTEM,$(NATIVE_SYSTEM) $(MCU_SYSTEMS), \
|
||||
$(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
|
||||
|
||||
# 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,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.
|
||||
#
|
||||
@@ -303,6 +327,24 @@ $(foreach __TARGET,$(JERRY_TEST_TARGETS_CP), \
|
||||
$(foreach __SUITE,$(JERRY_TEST_SUITE_JTS_CP), \
|
||||
$(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
|
||||
|
||||
.PHONY: clean
|
||||
@@ -344,6 +386,15 @@ test-js-precommit: \
|
||||
$(foreach __SUITE,$(JERRY_TEST_SUITE_J) $(JERRY_TEST_SUITE_JTS_PREC), \
|
||||
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
|
||||
precommit: prerequisites
|
||||
$(Q)+$(MAKE) --no-print-directory clean
|
||||
|
||||
@@ -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");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ jerry:
|
||||
-DENABLE_LTO=OFF \
|
||||
-DENABLE_VALGRIND=OFF \
|
||||
-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_C_COMPILER=arm-none-eabi-gcc \
|
||||
-DEXTERNAL_CMAKE_C_COMPILER_ID=GNU \
|
||||
|
||||
Reference in New Issue
Block a user