Skip to content
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

Adding prerequisites download script and fixing precommit testing #9

Merged
merged 5 commits into from
Apr 30, 2015
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

build/bin
build/obj-*
build/prerequisites
build/tests

# IDE related files
Expand All @@ -25,3 +26,11 @@ cscope.*
# ctags and ID database
tags
ID

# Prerequisites
.prerequisites
third-party/STM32F3-Discovery_FW_V1.1.0
third-party/STM32F4-Discovery_FW_V1.1.0
third-party/nuttx
third-party/vera++
third-party/cppcheck
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ project (Jerry CXX C ASM)
message(FATAL_ERROR "Currently, external build with Jerry's libc is not supported")
endif()
else()
if (NOT EXISTS "${EXTERNAL_LIBC_INTERFACE}")
message(FATAL_ERROR "External libc interface directory doesn't exist: ${EXTERNAL_LIBC_INTERFACE}")
endif()

set(USE_EXTERNAL_LIBC TRUE)
endif()

Expand Down Expand Up @@ -194,9 +198,9 @@ project (Jerry CXX C ASM)
# Platform-specific
# MCU
# stm32f3
set(LINKER_FLAGS_COMMON_MCU_STM32F3 "-T${CMAKE_SOURCE_DIR}/third-party/stm32f3.ld")
set(LINKER_FLAGS_COMMON_MCU_STM32F3 "-T${CMAKE_SOURCE_DIR}/third-party/STM32F3-Discovery_FW_V1.1.0/Project/Peripheral_Examples/FLASH_Program/TrueSTUDIO/FLASH_Program/STM32_FLASH.ld")
# stm32f4
set(LINKER_FLAGS_COMMON_MCU_STM32F4 "-T${CMAKE_SOURCE_DIR}/third-party/stm32f4.ld")
set(LINKER_FLAGS_COMMON_MCU_STM32F4 "-T${CMAKE_SOURCE_DIR}/third-party/STM32F4-Discovery_FW_V1.1.0/Project/Peripheral_Examples/FLASH_Program/TrueSTUDIO/FLASH_Program/stm32_flash.ld")

# Debug
set(FLAGS_COMMON_DEBUG "-nostdlib")
Expand Down
26 changes: 20 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export CHECK_TARGETS = $(foreach __TARGET,$(JERRY_LINUX_TARGETS),$(__TARGET).che
export FLASH_TARGETS = $(foreach __TARGET,$(JERRY_STM32F3_TARGETS) $(JERRY_STM32F4_TARGETS),$(__TARGET).flash)

export OUT_DIR = ./build/bin
export PREREQUISITES_STATE_DIR = ./build/prerequisites

export SHELL=/bin/bash

Expand Down Expand Up @@ -138,7 +139,7 @@ export SHELL=/bin/bash

all: precommit

$(BUILD_DIRS_NATIVE):
$(BUILD_DIRS_NATIVE): prerequisites
@ arch=`uname -m`; \
if [ "$$arch" == "armv7l" ]; \
then \
Expand All @@ -149,7 +150,7 @@ $(BUILD_DIRS_NATIVE):
cmake -DENABLE_VALGRIND=$(VALGRIND) -DENABLE_LTO=$(LTO) -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_NUTTX):
$(BUILD_DIRS_NUTTX): prerequisites
@ [ "$(EXTERNAL_LIBS_INTERFACE)" != "" ] && [ -x `which $(EXTERNAL_C_COMPILER)` ] && [ -x `which $(EXTERNAL_CXX_COMPILER)` ] || \
(echo "Wrong external arguments."; \
echo "EXTERNAL_LIBS_INTERFACE='$(EXTERNAL_LIBS_INTERFACE)'"; \
Expand All @@ -167,13 +168,13 @@ $(BUILD_DIRS_NUTTX):
../../.. &>cmake.log || \
(echo "CMake run failed. See "`pwd`"/cmake.log for details."; exit 1;)

$(BUILD_DIRS_STM32F3):
$(BUILD_DIRS_STM32F3): prerequisites
@ mkdir -p $@ && \
cd $@ && \
cmake -DENABLE_VALGRIND=$(VALGRIND) -DENABLE_LTO=$(LTO) -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):
$(BUILD_DIRS_STM32F4): prerequisites
@ mkdir -p $@ && \
cd $@ && \
cmake -DENABLE_VALGRIND=$(VALGRIND) -DENABLE_LTO=$(LTO) -DCMAKE_TOOLCHAIN_FILE=build/configs/toolchain_mcu_stm32f4.cmake ../../.. &>cmake.log || \
Expand Down Expand Up @@ -279,7 +280,7 @@ pull: ./tools/git-scripts/pull.sh
log: ./tools/git-scripts/log.sh
@ ./tools/git-scripts/log.sh

precommit: clean
precommit: clean prerequisites
@ ./tools/precommit.sh "$(MAKE)" "$(OUT_DIR)" "$(PRECOMMIT_CHECK_TARGETS_LIST)"

unittests_run: unittests
Expand All @@ -291,4 +292,17 @@ unittests_run: unittests
clean:
@ rm -rf $(BUILD_DIR_PREFIX)* $(OUT_DIR)

.PHONY: clean build unittests_run $(BUILD_DIRS_ALL) $(JERRY_TARGETS) $(FLASH_TARGETS)
prerequisites: $(PREREQUISITES_STATE_DIR)/.prerequisites

$(PREREQUISITES_STATE_DIR)/.prerequisites:
@ echo "Setting up prerequisites... (log file: $(PREREQUISITES_STATE_DIR)/prerequisites.log)"
@ mkdir -p $(PREREQUISITES_STATE_DIR)
@ ./tools/prerequisites.sh $(PREREQUISITES_STATE_DIR)/.prerequisites >&$(PREREQUISITES_STATE_DIR)/prerequisites.log || \
(echo "Prerequisites setup failed. See $(PREREQUISITES_STATE_DIR)/prerequisites.log for details."; exit 1;)
@ echo "Prerequisites setup succeeded"

prerequisites_clean:
@ ./tools/prerequisites.sh $(PREREQUISITES_STATE_DIR)/.prerequisites clean
@ rm -rf $(PREREQUISITES_STATE_DIR)

.PHONY: prerequisites_clean prerequisites clean build unittests_run $(BUILD_DIRS_ALL) $(JERRY_TARGETS) $(FLASH_TARGETS)
2 changes: 1 addition & 1 deletion build/static-checkers/add_cppcheck_for_target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Cppcheck launcher
set(CMAKE_CPPCHECK ${CMAKE_SOURCE_DIR}/tools/cppcheck.sh)
set(CMAKE_CPPCHECK ${CMAKE_SOURCE_DIR}/tools/cppcheck/cppcheck.sh)

# Definition of cppcheck targets
add_custom_target(cppcheck)
Expand Down
2 changes: 2 additions & 0 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ project (Jerry_Plugins CXX ASM)
# MCU
# STM32F3
set(INCLUDE_THIRD_PARTY_MCU_STM32F3
${CMAKE_SOURCE_DIR}/third-party/STM32F3-Discovery_FW_V1.1.0/Project/Demonstration
${CMAKE_SOURCE_DIR}/third-party/STM32F3-Discovery_FW_V1.1.0/Libraries/CMSIS/Device/ST/STM32F30x/Include
${CMAKE_SOURCE_DIR}/third-party/STM32F3-Discovery_FW_V1.1.0/Libraries/STM32F30x_StdPeriph_Driver/inc
${CMAKE_SOURCE_DIR}/third-party/STM32F3-Discovery_FW_V1.1.0/Libraries/CMSIS/Include
${CMAKE_SOURCE_DIR}/third-party/STM32F3-Discovery_FW_V1.1.0)
# STM32F4
set(INCLUDE_THIRD_PARTY_MCU_STM32F4
${CMAKE_SOURCE_DIR}/third-party/STM32F4-Discovery_FW_V1.1.0/Project/Demonstration
${CMAKE_SOURCE_DIR}/third-party/STM32F4-Discovery_FW_V1.1.0/Libraries/CMSIS/ST/STM32F4xx/Include
${CMAKE_SOURCE_DIR}/third-party/STM32F4-Discovery_FW_V1.1.0/Libraries/STM32F4xx_StdPeriph_Driver/inc
${CMAKE_SOURCE_DIR}/third-party/STM32F4-Discovery_FW_V1.1.0/Libraries/CMSIS/Include
Expand Down
12 changes: 7 additions & 5 deletions tools/cppcheck.sh → tools/cppcheck/cppcheck.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# Copyright 2014-2015 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,16 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

BASE=$(dirname $0)/../third-party/tools/cppcheck
REPOSITORY_DIR=$(dirname $0)/../..
CPPCHECK=$REPOSITORY_DIR/third-party/cppcheck/cppcheck
SUPPRESSIONS_LIST=$(dirname $0)/suppressions-list

if [ ! -x $BASE/$(uname -m)/cppcheck ]
if [ ! -x $CPPCHECK ]
then
exit 1;
fi

$BASE/$(uname -m)/cppcheck "$@" "--exitcode-suppressions=$BASE/cfg/suppressions-list"
$CPPCHECK "$@" "--exitcode-suppressions=$SUPPRESSIONS_LIST"
status_code=$?

exit $status_code
1 change: 1 addition & 0 deletions tools/cppcheck/suppressions-list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
operatorEqVarError
5 changes: 3 additions & 2 deletions tools/generator.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# Copyright 2014-2015 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,11 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

echo "#define JERRY_MCU_SCRIPT \\" > $2
cat $1 | while read line
do
line=$(echo $line | sed 's/"/\\"/g')
echo "\"$line\n\" \\" >> $2
done
echo >> $2
4 changes: 2 additions & 2 deletions tools/git-scripts/log.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# Copyright 2014-2015 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

git log --graph --branches --decorate \
--show-notes=perf --show-notes=mem --show-notes=test_build_env \
--show-notes=arm-linux-perf \
Expand Down
4 changes: 2 additions & 2 deletions tools/git-scripts/pull.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# Copyright 2014 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

git pull --rebase
status_code=$?

Expand Down
4 changes: 2 additions & 2 deletions tools/git-scripts/push.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# Copyright 2014-2015 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

GIT_STATUS_NOT_CLEAN_MSG="Git status of current directory is not clean"
GIT_STATUS_CONSIDER_CLEAN_MSG="Consider removing all untracked files, locally commiting all changes and running $0 again"

Expand Down
4 changes: 2 additions & 2 deletions tools/perf-compare.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# Copyright 2014 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

commit_first=$1
shift

Expand Down
4 changes: 2 additions & 2 deletions tools/perf.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# Copyright 2014 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

ITERS=$1
ENGINE=$2
BENCHMARK=$3
Expand Down
31 changes: 11 additions & 20 deletions tools/precommit.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# Copyright 2015 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,8 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

MAKE="$1"
shift

Expand All @@ -23,27 +23,18 @@ shift
TARGETS="$1"
shift

PARSE_ONLY_TESTING_PATHS="./tests/benchmarks/jerry"
FULL_TESTING_PATHS="./tests/jerry ./tests/jerry-test-suite/precommit_test_list"
VERA_DIRECTORIES_EXCLUDE_LIST="-path ./third-party -o -path tests"
VERA_CONFIGURATION_PATH="./tools/vera++"

VERA=`which vera++`
if [ -x "$VERA" ]
then
VERA_DIRECTORIES_EXCLUDE_LIST="-path ./third-party -o -path tests"
VERA_SCRIPTS_PATH="./tools/vera++"

SOURCES_AND_HEADERS_LIST=`find . -type d \( $VERA_DIRECTORIES_EXCLUDE_LIST \) -prune -or -name "*.c" -or -name "*.cpp" -or -name "*.h"`
vera++ -r $VERA_SCRIPTS_PATH -p jerry $SOURCES_AND_HEADERS_LIST -e --no-duplicate
STATUS_CODE=$?
SOURCES_AND_HEADERS_LIST=`find . -type d \( $VERA_DIRECTORIES_EXCLUDE_LIST \) -prune -or -name "*.c" -or -name "*.cpp" -or -name "*.h"`
./tools/vera++/vera.sh -r $VERA_CONFIGURATION_PATH -p jerry $SOURCES_AND_HEADERS_LIST -e --no-duplicate
STATUS_CODE=$?

if [ $STATUS_CODE -ne 0 ]
then
echo -e "\e[1;33m vera++ static checks failed. See output above for details. \e[0m\n"
if [ $STATUS_CODE -ne 0 ]
then
echo -e "\e[1;33m vera++ static checks failed. See output above for details. \e[0m\n"

exit $STATUS_CODE
fi
else
echo -e "\e[1;33m Warning: vera++ not installed, skipping corresponding static checks. \e[0m\n"
exit $STATUS_CODE
fi

echo -e "\nBuilding...\n\n"
Expand Down
Loading