-
Notifications
You must be signed in to change notification settings - Fork 683
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,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 | ||
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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`; \ | ||
|
@@ -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 | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
?There was a problem hiding this comment.
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 useYES/NO
, the others useON/OFF
.In my opinion, the
ON/OFF
is more obvious without theUSE_
prefix.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks for explanation.