Re-thinking the build system to bring it more into line with the conventions.

We removed that implementation where the build directory isn't set up to build with exactly one
configuration of the project but potentially several variants: the same build directory
can/must be used for debug and release builds, for full or compact profile versions, etc.
So we reworked the CMakeLists, and now one build dir deal with exactly one configuration
of the project's libraries and tools.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
Robert Sipka
2016-07-27 09:48:10 +02:00
parent 778f3c001e
commit ddab1d8152
48 changed files with 1107 additions and 1927 deletions
+1 -1
View File
@@ -19,4 +19,4 @@ sudo apt-get update -q
sudo apt-get install -q -y \
make cmake ninja-build \
gcc gcc-arm-none-eabi \
cppcheck vera++
cppcheck vera++ python
Executable
+142
View File
@@ -0,0 +1,142 @@
#!/usr/bin/env python
# Copyright 2016 Samsung Electronics Co., Ltd.
# Copyright 2016 University of Szeged.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse
import shutil
import subprocess
import sys
from os import makedirs
from settings import *
BUILD_DIR = path.join(PROJECT_DIR, 'build')
def add_build_args(parser):
parser.add_argument('--verbose', '-v', action='store_const', const='ON', default='OFF', help='Increase verbosity')
parser.add_argument('--unittests', action='store_const', const='ON', default='OFF', help='Build unittests too')
parser.add_argument('--clean', action='store_true', default=False, help='Clean build')
parser.add_argument('--builddir', action='store', default=BUILD_DIR, help='Specify output directory (default: %(default)s)')
parser.add_argument('--strip', choices=['on', 'off'], default='on', help='Strip release binary (default: %(default)s)')
parser.add_argument('--all-in-one', choices=['on', 'off'], default='off', help='All-in-one build (default: %(default)s)')
parser.add_argument('--debug', action='store_const', const='Debug', default='Release', dest='build_type', help='Debug build')
parser.add_argument('--lto', choices=['on', 'off'], default='on', help='Enable link-time optimizations (default: %(default)s)')
parser.add_argument('--profile', choices=['full', 'compact', 'minimal'], default='full', help='Specify the ECMAScript profile (default: %(default)s)')
parser.add_argument('--error-messages', choices=['on', 'off'], default='off', help='Enable error messages (default: %(default)s)')
parser.add_argument('--log', choices=['on', 'off'], default='off', help='Enable logging (default: %(default)s)')
parser.add_argument('--valgrind', choices=['on', 'off'], default='off', help='Enable Valgrind support (default: %(default)s)')
parser.add_argument('--valgrind-freya', choices=['on', 'off'], default='off', help='Enable Valgrind-Freya support (default: %(default)s)')
parser.add_argument('--mem-stats', choices=['on', 'off'], default='off', help='Enable memory-statistics (default: %(default)s)')
parser.add_argument('--mem-stress-test', choices=['on', 'off'], default='off', help='Enable mem-stress test (default: %(default)s)')
parser.add_argument('--snapshot-save', choices=['on', 'off'], default='on', help='Allow to save snapshot files (default: %(default)s)')
parser.add_argument('--snapshot-exec', choices=['on', 'off'], default='on', help='Allow to execute snapshot files (default: %(default)s)')
parser.add_argument('--cmake-param', action='append', default=[], help='Add custom arguments to CMake')
parser.add_argument('--compile-flag', action='append', default=[], help='Add custom compile flag')
parser.add_argument('--linker-flag', action='append', default=[], help='Add custom linker flag')
parser.add_argument('--toolchain', action='store', default='', help='Add toolchain file')
parser.add_argument('--jerry-libc', choices=['on', 'off'], default='on', help='Use jerry-libc (default: %(default)s)')
parser.add_argument('--compiler-default-libc', choices=['on', 'off'], default='off', help='Use compiler-default libc (default: %(default)s)')
parser.add_argument('--jerry-core', choices=['on', 'off'], default='on', help='Use jerry-core (default: %(default)s)')
parser.add_argument('--jerry-libm', choices=['on', 'off'], default='on', help='Use jerry-libm (default: %(default)s)')
parser.add_argument('--jerry-cmdline', choices=['on', 'off'], default='on', help='Use jerry commandline tool (default: %(default)s)')
def get_arguments():
parser = argparse.ArgumentParser()
add_build_args(parser)
return parser.parse_args()
def generate_build_options(arguments):
build_options = []
build_options.append('-DJERRY_LIBC=%s' % arguments.jerry_libc.upper())
build_options.append('-DJERRY_CORE=%s' % arguments.jerry_core.upper())
build_options.append('-DJERRY_LIBM=%s' % arguments.jerry_libm.upper())
build_options.append('-DJERRY_CMDLINE=%s' % arguments.jerry_cmdline.upper())
build_options.append('-DCOMPILER_DEFAULT_LIBC=%s' % arguments.compiler_default_libc.upper())
build_options.append('-DCMAKE_VERBOSE_MAKEFILE=%s' % arguments.verbose)
build_options.append('-DCMAKE_BUILD_TYPE=%s' % arguments.build_type)
build_options.append('-DFEATURE_PROFILE=%s' % arguments.profile)
build_options.append('-DFEATURE_ERROR_MESSAGES=%s' % arguments.error_messages.upper())
build_options.append('-DFEATURE_LOG=%s' % arguments.log.upper())
build_options.append('-DFEATURE_VALGRIND=%s' % arguments.valgrind.upper())
build_options.append('-DFEATURE_VALGRIND_FREYA=%s' % arguments.valgrind_freya.upper())
build_options.append('-DFEATURE_MEM_STATS=%s' % arguments.mem_stats.upper())
build_options.append('-DFEATURE_MEM_STRESS_TEST=%s' % arguments.mem_stress_test.upper())
build_options.append('-DFEATURE_SNAPSHOT_SAVE=%s' % arguments.snapshot_save.upper())
build_options.append('-DFEATURE_SNAPSHOT_EXEC=%s' % arguments.snapshot_exec.upper())
build_options.append('-DENABLE_ALL_IN_ONE=%s' % arguments.all_in_one.upper())
build_options.append('-DENABLE_LTO=%s' % arguments.lto.upper())
build_options.append('-DENABLE_STRIP=%s' % arguments.strip.upper())
build_options.append('-DUNITTESTS=%s' % arguments.unittests)
build_options.extend(arguments.cmake_param)
build_options.append('-DEXTERNAL_COMPILE_FLAGS=' + ' '.join(arguments.compile_flag))
build_options.append('-DEXTERNAL_LINKER_FLAGS=' + ' '.join(arguments.linker_flag))
if arguments.toolchain:
build_options.append('-DCMAKE_TOOLCHAIN_FILE=%s' % arguments.toolchain)
return build_options
def configure_output_dir(arguments):
global BUILD_DIR
if os.path.isabs(arguments.builddir):
BUILD_DIR = arguments.builddir
else:
BUILD_DIR = path.join(PROJECT_DIR, arguments.builddir)
if arguments.clean and os.path.exists(BUILD_DIR):
shutil.rmtree(BUILD_DIR)
if not os.path.exists(BUILD_DIR):
makedirs(BUILD_DIR)
def configure_build(arguments):
configure_output_dir(arguments)
build_options = generate_build_options(arguments)
cmake_cmd = ['cmake', '-B' + BUILD_DIR, '-H' + PROJECT_DIR]
cmake_cmd.extend(build_options)
return subprocess.call(cmake_cmd)
def build_jerry(arguments):
return subprocess.call(['make', '--no-print-directory','-j', '-C', BUILD_DIR])
def print_result(ret):
print('=' * 30)
if ret:
print('Build failed with exit code: %s' % (ret))
else:
print('Build succeeded!')
print('=' * 30)
def main():
arguments = get_arguments()
ret = configure_build(arguments)
if not ret:
ret = build_jerry(arguments)
print_result(ret)
sys.exit(ret)
if __name__ == "__main__":
main()
+1 -1
View File
@@ -35,7 +35,7 @@ actual_signed_off_by_line=`git show -s --format=%B $commit_hash | sed '/^$/d' |
if [ "$actual_signed_off_by_line" != "$required_signed_off_by_line" ]
then
echo -e "\e[1;33m Signed-off-by message is incorrect. The following line should be at the end of the $commit_hash commit's message: '$required_signed_off_by_line'. \e[0m\n"
echo -e "\e[1;33mSigned-off-by message is incorrect. The following line should be at the end of the $commit_hash commit's message: '$required_signed_off_by_line'. \e[0m"
exit 1
fi
+1 -1
View File
@@ -19,7 +19,7 @@ JERRY_CORE_FILES=`find ./jerry-core -name "*.c" -or -name "*.h"`
JERRY_PORT_DEFAULT_FILES=`find ./targets/default -name "*.c" -or -name "*.h"`
JERRY_LIBC_FILES=`find ./jerry-libc -name "*.c" -or -name "*.h"`
JERRY_LIBM_FILES=`find ./jerry-libm -name "*.c" -or -name "*.h"`
JERRY_MAIN_FILES=`find . -maxdepth 1 -name "*.c" -or -name "*.h"`
JERRY_MAIN_FILES=`find ./jerry-main -name "*.c" -or -name "*.h"`
UNIT_TEST_FILES=`find ./tests/unit -name "*.c" -or -name "*.h"`
if [ -n "$1" ]
-24
View File
@@ -1,24 +0,0 @@
#!/bin/bash
# Copyright 2014-2015 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
git log --graph --branches --decorate \
--show-notes=perf --show-notes=mem --show-notes=test_build_env \
--show-notes=arm-linux-perf \
--show-notes=arm-linux-memory-consumption \
--show-notes=arm-linux-binary-size \
--show-notes=stm32f4-binary-size
exit 0
-35
View File
@@ -1,35 +0,0 @@
#!/bin/bash
# Copyright 2014 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
git pull --rebase
status_code=$?
if [ $status_code -ne 0 ]
then
echo "Pulling master failed"
exit 1
fi
git fetch origin refs/notes/*:refs/notes/*
status_code=$?
if [ $status_code -ne 0 ]
then
echo "Pulling notes failed"
exit 1
fi
-160
View File
@@ -1,160 +0,0 @@
#!/bin/bash
# Copyright 2014-2015 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
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"
clear
gitignore_files_list=`find . -name .gitignore`
if [ "$gitignore_files_list" != "./.gitignore" ]
then
echo -e "\n\e[1;33mInvalid .gitignore configuration\e[0m\n"
echo -e -n ".gitignore files list:\t"
echo $gitignore_files_list
echo
exit 1
fi
if [ "`git status --porcelain 2>&1 | wc -l`" != "0" ]
then
echo -e "\n \e[1;90m$GIT_STATUS_NOT_CLEAN_MSG:\n"
git status
echo -e "\n\n $GIT_STATUS_CONSIDER_CLEAN_MSG.\e[0m\n"
fi
ok_to_push=1
current_branch=`git branch | grep "^* " | cut -d ' ' -f 2`
git branch -r | grep "^ *origin/$current_branch$" 2>&1 > /dev/null
have_remote=$?
if [ $have_remote -eq 0 ]
then
base_ref="origin/$current_branch"
echo "Pulling..."
make pull
status_code=$?
if [ $status_code -ne 0 ]
then
echo "Pull failed"
exit 1
fi
else
base_ref=`git merge-base master $current_branch`
status_code=$?
if [ $status_code -ne 0 ]
then
echo "Cannot determine merge-base for '$current_branch' and 'master' branches."
exit 1
fi
fi
commits_to_push=`git log $base_ref..$current_branch | grep "^commit [0-9a-f]*$" | awk 'BEGIN { s = ""; } { s = $2" "s; } END { print s; }'`
echo $commits_to_push | grep "[^ ]" >&/dev/null
status_code=$?
if [ $status_code -ne 0 ]
then
echo "Nothing to push"
exit 0
fi
trap ctrl_c INT
function ctrl_c() {
git checkout $current_branch >&/dev/null
exit 1
}
echo
echo "===== Starting pre-push commit testing series ====="
echo
echo "Commits list: $commits_to_push"
echo
for commit_hash in $commits_to_push
do
git checkout $commit_hash >&/dev/null
status_code=$?
if [ $status_code -ne 0 ]
then
echo "git checkout $commit_hash failed"
exit 1
fi
echo " > Testing $commit_hash"
echo -n " > "
git log --pretty=format:"%H %s" | grep $commit_hash | grep -o " .*"
echo
make -s -j precommit 2>&1
status_code=$?
if [ $status_code -ne 0 ]
then
echo "Pre-commit quality testing for '$commit_hash' failed"
echo
ok_to_push=0
break
fi
echo "Pre-commit quality testing for '$commit_hash' passed successfully"
done
git checkout $current_branch >&/dev/null
echo
echo "Pre-commit testing passed successfully"
echo
if [ $ok_to_push -eq 1 ]
then
if [ "`git status --porcelain 2>&1 | wc -l`" == "0" ]
then
echo "Pushing..."
echo
git push -u origin $current_branch
status_code=$?
if [ $status_code -eq 0 ]
then
echo -e "\n\e[0;32m Pushed successfully\e[0m\n"
else
echo -e "\n\e[1;33m Push failed\e[0m"
fi
exit $status_code
else
echo -e "\e[1;33m $GIT_STATUS_NOT_CLEAN_MSG. $GIT_STATUS_CONSIDER_CLEAN_MSG.\e[0m\n"
exit 1
fi
else
echo -e "\e[1;33mPre-commit testing not passed. Cancelling push.\e[0m"
exit 1
fi
-138
View File
@@ -1,138 +0,0 @@
#!/bin/bash
# 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
PREREQUISITES_INSTALLED_LIST_FILE="$1"
shift
if [ "$1" == "clean" ]
then
CLEAN_MODE=yes
else
CLEAN_MODE=no
fi
trap clean_on_exit INT
function clean_on_exit() {
rm -rf $TMP_DIR
[[ $1 == "OK" ]] || exit 1
exit 0
}
function fail_msg() {
echo "$1"
clean_on_exit "FAIL"
}
function remove_gitignore_files_at() {
DEST="$1"
gitignore_files_list=`find "$DEST" -name .gitignore`
[ $? -eq 0 ] || fail_msg "Failed to search for .gitignore in '$DEST'."
rm -rf $gitignore_files_list || fail_msg "Failed to remove .gitignore files from '$DEST'."
}
function setup_from_zip() {
NAME="$1"
shift
DEST=$(pwd)/"$1"
shift
URL="$1"
shift
CHECKSUM="$1"
shift
LIST="$*"
FAIL_MSG="Failed to setup '$NAME' prerequisite"
if [ "$CLEAN_MODE" == "no" ]
then
echo "$CHECKSUM $NAME" >> $TMP_DIR/.prerequisites
grep -q "^$CHECKSUM $NAME\$" $TMP_DIR/.prerequisites.prev && return 0
echo "Setting up $NAME prerequisite"
fi
if [ -e "$DEST" ]
then
chmod -R u+w "$DEST" || fail_msg "$FAIL_MSG. Failed to add write permission to '$DEST' directory contents."
rm -rf "$DEST" || fail_msg "$FAIL_MSG. Cannot remove '$DEST' directory."
fi
if [ "$CLEAN_MODE" == "yes" ]
then
return 0
fi
wget --no-check-certificate -O "$TMP_DIR/$NAME.zip" "$URL" || fail_msg "$FAIL_MSG. Cannot download '$URL' zip archive."
echo "$CHECKSUM $TMP_DIR/$NAME.zip" | $SHA256SUM --check || fail_msg "$FAIL_MSG. Archive's checksum doesn't match."
unzip "$TMP_DIR/$NAME.zip" -d "$TMP_DIR/$NAME" || fail_msg "$FAIL_MSG. Failed to unpack zip archive."
mkdir "$DEST" || fail_msg "$FAIL_MSG. Failed to create '$DEST' directory."
for part in "$LIST"
do
mv "$TMP_DIR/$NAME"/$part "$DEST" || fail_msg "$FAIL_MSG. Failed to move '$part' to '$DEST'."
done
remove_gitignore_files_at "$DEST"
chmod -R u-w "$DEST" || fail_msg "$FAIL_MSG. Failed to remove write permission from '$DEST' directory contents."
}
HOST_OS=`uname -s`
if [ "$HOST_OS" == "Darwin" ]
then
SHA256SUM="shasum -a 256"
TMP_DIR=`mktemp -d -t jerryscript`
else
SHA256SUM="sha256sum --strict"
TMP_DIR=`mktemp -d --tmpdir=./`
fi
if [ "$CLEAN_MODE" == "yes" ]
then
rm -f $PREREQUISITES_INSTALLED_LIST_FILE
else
touch $PREREQUISITES_INSTALLED_LIST_FILE || fail_msg "Failed to create '$PREREQUISITES_INSTALLED_LIST_FILE'."
mv $PREREQUISITES_INSTALLED_LIST_FILE $TMP_DIR/.prerequisites.prev
fi
setup_from_zip "stm32f3" \
"./third-party/STM32F3-Discovery_FW_V1.1.0" \
"http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/firmware/stm32f3discovery_fw.zip" \
"cf81efd07d627adb58adc20653eecb415878b6585310b77b0ca54a34837b3855" \
"STM32F3-Discovery_FW_V1.1.0/*"
setup_from_zip "stm32f4" \
"./third-party/STM32F4-Discovery_FW_V1.1.0" \
"http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/firmware/stsw-stm32068.zip" \
"8e67f7b930c6c02bd7f89a266c8d1cae3b530510b7979fbfc0ee0d57e7f88b81" \
"STM32F4-Discovery_FW_V1.1.0/*"
if [ "$CLEAN_MODE" == "no" ]
then
mv $TMP_DIR/.prerequisites $PREREQUISITES_INSTALLED_LIST_FILE || fail_msg "Failed to write '$PREREQUISITES_INSTALLED_LIST_FILE'"
fi
clean_on_exit "OK"
+197
View File
@@ -0,0 +1,197 @@
#!/usr/bin/env python
# Copyright 2016 Samsung Electronics Co., Ltd.
# Copyright 2016 University of Szeged.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse
from subprocess import CalledProcessError
from settings import *
OUTPUT_DIR = path.join(PROJECT_DIR, 'build', 'tests')
parser = argparse.ArgumentParser()
parser.add_argument('--toolchain', action='store', default='', help='Add toolchain file')
parser.add_argument('--outdir', action='store', default=OUTPUT_DIR, help='Specify output directory (default: %(default)s)')
parser.add_argument('--check-signed-off', action='store_true', default=False, help='Run signed-off check')
parser.add_argument('--check-cppcheck', action='store_true', default=False, help='Run cppcheck')
parser.add_argument('--check-vera', action='store_true', default=False, help='Run vera check')
parser.add_argument('--buildoption-test', action='store_true', default=False, help='Run buildoption-test')
parser.add_argument('--jerry-tests', action='store_true', default=False, help='Run jerry-tests')
parser.add_argument('--jerry-test-suite', action='store_true', default=False, help='Run jerry-test-suite')
parser.add_argument('--unittests', action='store_true', default=False, help='Run unittests')
parser.add_argument('--precommit', action='store_true', default=False, dest='all', help='Run all test')
if len(sys.argv) == 1:
parser.print_help()
sys.exit(1)
script_args = parser.parse_args()
if os.path.isabs(script_args.outdir):
OUTPUT_DIR = script_args.outdir
else:
OUTPUT_DIR = path.join(PROJECT_DIR, script_args.outdir)
class Options:
out_dir = ''
build_args = []
test_args = []
def __init__(self, name = '', build_args = [], test_args = []):
self.out_dir = os.path.join(OUTPUT_DIR, name)
self.build_args = build_args
self.build_args.append('--builddir=%s' % self.out_dir)
self.test_args = test_args
# Test options for unittests
jerry_unittests_options = [
Options('unittests', ['--unittests']),
Options('unittests-debug', ['--unittests', '--debug']),
]
# Test options for jerry-tests
jerry_tests_options = [
Options('jerry_tests'),
Options('jerry_tests-snapshot', ['--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']),
Options('jerry_tests-debug', ['--debug']),
Options('jerry_tests-debug-snapshot', ['--debug', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']),
]
# Test options for jerry-test-suite
jerry_test_suite_options = jerry_tests_options[:]
jerry_test_suite_options.append(Options('jerry_test_suite-compact', ['--profile=compact']))
jerry_test_suite_options.append(Options('jerry_test_suite-compact-snapshot', ['--profile=compact', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']))
jerry_test_suite_options.append(Options('jerry_test_suite-compact-debug', ['--debug', '--profile=compact']))
jerry_test_suite_options.append(Options('jerry_test_suite-compact-debug-snapshot', ['--debug', '--profile=compact', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']))
# Test options for buildoption-test
jerry_buildoptions = [
Options('buildoption_test-lto', ['--lto=on']),
Options('buildoption_test-log', ['--log=on']),
Options('buildoption_test-error_messages', ['--error-messages=on']),
Options('buildoption_test-all_in_one', ['--all-in-one=on']),
Options('buildoption_test-valgrind', ['--valgrind=on']),
Options('buildoption_test-valgrind_freya', ['--valgrind-freya=on']),
Options('buildoption_test-jerry_libc', ['--jerry-libc=on', '--compiler-default-libc=off']),
Options('buildoption_test-compiler_default_libc', ['--compiler-default-libc=on', '--jerry-libc=off']),
]
def get_bin_dir_path(out_dir):
return path.join(out_dir, 'bin')
def get_binary_path(out_dir):
return path.join(get_bin_dir_path(out_dir), 'jerry')
def create_binary(buildoptions):
build_cmd = [BUILD_SCRIPT]
build_cmd.extend(buildoptions)
if script_args.toolchain:
build_cmd.append('--toolchain=%s' % script_args.toolchain)
sys.stderr.write('Build command: %s\n' % ' '.join(build_cmd))
try:
script_output = subprocess.check_output(build_cmd)
except CalledProcessError as e:
return e.returncode
return 0
def run_jerry_tests():
for job in jerry_tests_options:
ret = create_binary(job.build_args)
if not ret:
test_cmd = [TEST_RUNNER_SCRIPT, get_binary_path(job.out_dir), JERRY_TESTS_DIR]
if job.test_args:
test_cmd.extend(job.test_args)
ret = run_check(test_cmd)
else:
break
return ret
def run_jerry_test_suite():
for job in jerry_test_suite_options:
ret = create_binary(job.build_args)
if not ret:
test_cmd = [TEST_RUNNER_SCRIPT, get_binary_path(job.out_dir)]
if '--profile=compact' in job.build_args:
test_cmd.append(JERRY_TEST_SUITE_COMPACT_LIST)
else:
test_cmd.append(JERRY_TEST_SUITE_DIR)
if job.test_args:
test_cmd.extend(job.test_args)
ret = run_check(test_cmd)
else:
break
return ret
def run_unittests():
for job in jerry_unittests_options:
ret = create_binary(job.build_args)
if not ret:
ret = run_check([UNITTEST_RUNNER_SCRIPT, get_bin_dir_path(job.out_dir)])
else:
break
return ret
def run_buildoption_test():
for job in jerry_buildoptions:
ret = create_binary(job.build_args)
if ret:
break
return ret
def main():
ret = 0
if script_args.all or script_args.check_signed_off:
ret = run_check(SIGNED_OFF_SCRIPT)
if not ret and script_args.all or script_args.check_cppcheck:
ret = run_check(CPPCHECK_SCRIPT)
if not ret and script_args.all or script_args.check_vera:
ret = run_check(VERA_SCRIPT)
if not ret and script_args.all or script_args.jerry_tests:
ret = run_jerry_tests()
if not ret and script_args.all or script_args.jerry_test_suite:
ret = run_jerry_test_suite()
if not ret and script_args.all or script_args.unittests:
ret = run_unittests()
if not ret and script_args.all or script_args.buildoption_test:
ret = run_buildoption_test()
sys.exit(ret)
if __name__ == "__main__":
main()
+10 -7
View File
@@ -20,21 +20,24 @@
TIMEOUT=${TIMEOUT:=5}
TEST_FILES=test.files
TEST_FAILED=test.failed
TEST_PASSED=test.passed
ENGINE="$1"
shift
TESTS="$1"
shift
OUTPUT_DIR=`dirname $ENGINE`
TESTS_BASENAME=`basename $TESTS`
TEST_FILES=$OUTPUT_DIR/$TESTS_BASENAME.files
TEST_FAILED=$OUTPUT_DIR/$TESTS_BASENAME.failed
TEST_PASSED=$OUTPUT_DIR/$TESTS_BASENAME.passed
if [ "$1" == "--snapshot" ]
then
TEST_FILES="snapshot.$TEST_FILES"
TEST_FAILED="snapshot.$TEST_FAILED"
TEST_PASSED="snapshot.$TEST_PASSED"
TEST_FILES="$TEST_FILES.snapshot"
TEST_FAILED="$TEST_FAILED.snapshot"
TEST_PASSED="$TEST_PASSED.snapshot"
IS_SNAPSHOT=true;
shift
fi
+2 -2
View File
@@ -18,8 +18,8 @@
DIR="$1"
shift
UNITTEST_ERROR=unittests.failed
UNITTEST_OK=unittests.passed
UNITTEST_ERROR=$DIR/unittests.failed
UNITTEST_OK=$DIR/unittests.passed
rm -f $UNITTEST_ERROR $UNITTEST_OK
+43
View File
@@ -0,0 +1,43 @@
#!/usr/bin/env python
# Copyright 2016 Samsung Electronics Co., Ltd.
# Copyright 2016 University of Szeged.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import subprocess
import sys
from subprocess import CalledProcessError
from os import path
TOOLS_DIR = path.dirname(path.abspath(__file__))
PROJECT_DIR = path.normpath(path.join(TOOLS_DIR, '..'))
JERRY_TESTS_DIR = path.join(PROJECT_DIR, 'tests/jerry')
JERRY_TEST_SUITE_DIR = path.join(PROJECT_DIR, 'tests/jerry-test-suite')
JERRY_TEST_SUITE_COMPACT_LIST = path.join(PROJECT_DIR, 'tests/jerry-test-suite/compact-profile-list')
BUILD_SCRIPT = path.join(TOOLS_DIR, 'build.py')
CPPCHECK_SCRIPT = path.join(TOOLS_DIR, 'check-cppcheck.sh')
SIGNED_OFF_SCRIPT = path.join(TOOLS_DIR, 'check-signed-off.sh')
VERA_SCRIPT = path.join(TOOLS_DIR, 'check-vera.sh')
TEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-test-suite.sh')
UNITTEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-unittests.sh')
def run_check(runnable):
try:
ret = subprocess.check_call(runnable)
except CalledProcessError as e:
return e.returncode
return ret