Skip to content

Test the build options #790

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you rename this? Are you sure you changed all reference of USE_COMPILER_DEFAULT_LIBC?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've changed all occurences of USE_COMPILER_DEFAULT_LIBC.
The YES/NO -> ON/OFF modification just simplify the testing-mechanism, because only this option use YES/NO, the others use ON/OFF.
In my opinion, the ON/OFF is more obvious without the USE_ prefix.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, thanks for explanation.

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)
Expand Down
61 changes: 56 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -91,16 +94,21 @@ 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
ifneq ($(STRIP_RELEASE_BINARY),)
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cause of this (and related) modifications is that the parallel native builds can interfere with the unittests build.

$(BUILD_DIR)/$(NATIVE_SYSTEM)/toolchain.config \
$(BUILD_DIR)/$(NATIVE_SYSTEM)/unittests/toolchain.config:
$(Q) if [ "$$TOOLCHAIN" == "" ]; \
then \
arch=`uname -m`; \
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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.
#
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions targets/mbedk64f/Makefile.mbedk64f
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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 \
Expand Down