Refactoring the build system
* Removed unused or unnecessary parts from various make files
* Eliminated lots of duplications from Makefile with the help of
macros.
* Split tools/precommit.sh to its independent components:
* the part that checks the existence of the "signed off" text in
commit messages
(this on got factored out to tools/check-signed-off.sh),
* the part that uses vera++ for style checking (this one got
factored out to tools/check-vera.sh),
* the part that invokes targets in the cmake-generated build
directory, and
* the part that performs various tests (these latter two got
moved into the Makefile).
* Moved the functionality of precommit-full-testing.sh into the
Makefile, too.
* Added ninja build system support (e.g., `make NINJA=1`).
* Updated leading documentation comments (they were somewhat
stale).
* Tried to keep the target names exactly the same as they were --
almost succeeded... (some changes are intentional, and are
subject to personal preferences).
* Simplified console output of `make precommit`
* Unified test runner scripts and their output format
* Eliminated nothing-to-stdout everything-to-log-file policy:
info is printed to stdout and it is the caller's
responsibility to redirect it to a file if needed.
* Also applied some renaming and coding style unification to
the scripts.
* Merged the functionality of tools/runners/run-test-suite-jerry*.sh
into the Makefile
* Merged everything related to a test suite execution in a single
script.
* The new script also allows to specify pass and xfail tests in
a single list file, which was not possible hitherto.
* Also, the paths of the test cases given in a file are
interpreted relative to their container files.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2015-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.
|
||||
@@ -14,15 +15,6 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
MAKE="$1"
|
||||
shift
|
||||
|
||||
OUT_DIR="$1"
|
||||
shift
|
||||
|
||||
TARGETS="$1"
|
||||
shift
|
||||
|
||||
commit_hash=`git show -s --format=%H HEAD`
|
||||
author_name=`git show -s --format=%an HEAD`
|
||||
author_email=`git show -s --format=%ae HEAD`
|
||||
@@ -36,26 +28,4 @@ then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERA_DIRECTORIES_EXCLUDE_LIST="-path ./third-party -o -path tests -o -path ./targets"
|
||||
VERA_CONFIGURATION_PATH="./tools/vera++"
|
||||
|
||||
SOURCES_AND_HEADERS_LIST=`find . -type d \( $VERA_DIRECTORIES_EXCLUDE_LIST \) -prune -or -name "*.c" -or -name "*.h"`
|
||||
vera++ -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"
|
||||
|
||||
exit $STATUS_CODE
|
||||
fi
|
||||
|
||||
echo -e "\nBuilding...\n\n"
|
||||
$MAKE STATIC_CHECK=ON build || exit 1
|
||||
echo -e "\n================ Build completed successfully. Running precommit tests ================\n"
|
||||
echo -e "All targets were built successfully. Starting unit tests' run.\n"
|
||||
$MAKE unittests_run || exit 1
|
||||
echo -e "\nUnit tests completed successfully. Starting full testing.\n"
|
||||
|
||||
./tools/precommit-full-testing.sh "${OUT_DIR}" "${TARGETS}" || exit 1
|
||||
exit 0
|
||||
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2015-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.
|
||||
|
||||
JERRY_CORE_FILES=`find ./jerry-core -name "*.c" -or -name "*.cpp" -or -name "*.h"`
|
||||
JERRY_LIBC_FILES=`find ./jerry-libc -name "*.c" -or -name "*.cpp" -or -name "*.h"`
|
||||
JERRY_MAIN_FILES=`find . -maxdepth 1 -name "*.c" -or -name "*.cpp" -or -name "*.h"`
|
||||
|
||||
vera++ -r tools/vera++ -p jerry $JERRY_CORE_FILES $JERRY_LIBC_FILES $JERRY_MAIN_FILES -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"
|
||||
fi
|
||||
|
||||
exit $STATUS_CODE
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 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.
|
||||
|
||||
OUT_DIR="$1"
|
||||
shift
|
||||
|
||||
TARGETS="$1"
|
||||
shift
|
||||
|
||||
RUN_IDS=""
|
||||
|
||||
for TARGET in ${TARGETS}
|
||||
do
|
||||
ENGINE=${OUT_DIR}/${TARGET}/jerry
|
||||
LOGS_PATH_FULL=${OUT_DIR}/${TARGET}/check
|
||||
|
||||
# Full testing
|
||||
INDEX=0
|
||||
for TESTS_PATH in "./tests/jerry" "./tests/jerry-test-suite/precommit_test_list"
|
||||
do
|
||||
./tools/runners/run-precommit-check-for-target.sh "${ENGINE}" "${LOGS_PATH_FULL}"/"${INDEX}" "${TESTS_PATH}" &
|
||||
RUN_IDS="${RUN_IDS} $!";
|
||||
INDEX=$((INDEX + 1))
|
||||
done
|
||||
done
|
||||
|
||||
RESULT_OK=1
|
||||
for RUN_ID in ${RUN_IDS}
|
||||
do
|
||||
wait "${RUN_ID}" || RESULT_OK=0
|
||||
done;
|
||||
[ ${RESULT_OK} -eq 1 ] || exit 1
|
||||
|
||||
echo -e "Full testing completed successfully\n\n================\n\n"
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 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.
|
||||
|
||||
ENGINE_PATH="$1"
|
||||
OUTPUT_PATH="$2"
|
||||
TESTS_PATH="$3"
|
||||
TESTS_OPTS="$4"
|
||||
|
||||
[ -x $ENGINE_PATH ] || exit 1
|
||||
[[ -d $TESTS_PATH || -f $TESTS_PATH ]] || exit 1
|
||||
mkdir -p $OUTPUT_PATH || exit 1
|
||||
|
||||
./tools/runners/run-test-pass.sh $ENGINE_PATH $OUTPUT_PATH $TESTS_PATH $TESTS_OPTS --output-to-log; status_code=$?
|
||||
if [ $status_code -ne 0 ]
|
||||
then
|
||||
echo "$ENGINE_PATH testing failed"
|
||||
echo "See log in $OUTPUT_PATH directory for details."
|
||||
exit $status_code
|
||||
fi
|
||||
|
||||
if [ -d $TESTS_PATH/fail ]
|
||||
then
|
||||
for error_code in `cd $TESTS_PATH/fail && ls -d [0-9]*`
|
||||
do
|
||||
./tools/runners/run-test-xfail.sh $ENGINE_PATH $OUTPUT_PATH $error_code $TESTS_PATH $TESTS_OPTS --output-to-log; status_code=$?
|
||||
|
||||
if [ $status_code -ne 0 ]
|
||||
then
|
||||
echo "$ENGINE_PATH testing failed"
|
||||
echo "See log in $OUTPUT_PATH directory for details."
|
||||
exit $status_code
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,128 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014-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.
|
||||
|
||||
TIMEOUT=${TIMEOUT:=5}
|
||||
|
||||
START_DIR=`pwd`
|
||||
|
||||
ENGINE=$START_DIR/$1
|
||||
shift
|
||||
|
||||
OUT_DIR=$1
|
||||
shift
|
||||
|
||||
TESTS=$START_DIR/$1
|
||||
shift
|
||||
|
||||
ECHO_PROGRESS=1
|
||||
JERRY_ARGS=
|
||||
while (( "$#" ))
|
||||
do
|
||||
if [ "$1" = "--parse-only" ]
|
||||
then
|
||||
JERRY_ARGS="$JERRY_ARGS $1"
|
||||
fi
|
||||
if [ "$1" = "--output-to-log" ]
|
||||
then
|
||||
exec 1>$OUT_DIR/jerry_test.log
|
||||
ECHO_PROGRESS=0
|
||||
fi
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
if [ ! -x $ENGINE ]
|
||||
then
|
||||
echo \"$ENGINE\" is not an executable file
|
||||
fi
|
||||
|
||||
cd $OUT_DIR
|
||||
|
||||
JS_FILES=js.files
|
||||
JERRY_ERROR=jerry.error
|
||||
JERRY_OK=jerry.passed
|
||||
|
||||
rm -f $JS_FILES $JERRY_ERROR
|
||||
|
||||
if [ -d $TESTS ];
|
||||
then
|
||||
find $TESTS -path $TESTS/fail -prune -o -name "[^N]*.js" -print | sort > $JS_FILES
|
||||
else
|
||||
if [ -f $TESTS ];
|
||||
then
|
||||
awk "{print \"$START_DIR/\"\$1;}" $TESTS > $JS_FILES
|
||||
fi;
|
||||
fi;
|
||||
total=$(cat $JS_FILES | wc -l)
|
||||
|
||||
tested=0
|
||||
failed=0
|
||||
passed=0
|
||||
|
||||
JERRY_TEMP=jerry.tmp
|
||||
|
||||
echo " Passed / Failed / Tested / Total / Percent"
|
||||
|
||||
for test in `cat $JS_FILES`
|
||||
do
|
||||
percent=$(echo $tested*100/$total | bc)
|
||||
|
||||
( ulimit -t $TIMEOUT; ${ENGINE} ${JERRY_ARGS} ${test} &>$JERRY_TEMP; exit $? );
|
||||
status_code=$?
|
||||
|
||||
if [ $ECHO_PROGRESS -eq 1 ]
|
||||
then
|
||||
printf "\r\e[2K[ %6d / %6d / %6d / %5d / %3d%% ]" ${passed} ${failed} ${tested} ${total} ${percent}
|
||||
fi
|
||||
|
||||
if [ $status_code -ne 0 ]
|
||||
then
|
||||
echo "$status_code: ${test}" >> $JERRY_ERROR
|
||||
echo "============================================" >> $JERRY_ERROR
|
||||
cat $JERRY_TEMP >> $JERRY_ERROR
|
||||
echo "============================================" >> $JERRY_ERROR
|
||||
echo >> $JERRY_ERROR
|
||||
echo >> $JERRY_ERROR
|
||||
|
||||
failed=$((failed+1))
|
||||
else
|
||||
echo "${test}" >> $JERRY_OK
|
||||
passed=$((passed+1))
|
||||
fi
|
||||
|
||||
tested=$((tested+1))
|
||||
done
|
||||
|
||||
rm -f $JERRY_TEMP
|
||||
|
||||
printf "\r\e[2K[ %6d / %6d / %6d / %5d / %3d%% ]\n" ${passed} ${failed} ${tested} ${total} ${percent}
|
||||
|
||||
ratio=$(echo $passed*100/$total | bc)
|
||||
|
||||
echo ==========================
|
||||
echo "Number of tests passed: ${passed}"
|
||||
echo "Number of tests failed: ${failed}"
|
||||
echo --------------------------
|
||||
echo "Total number of tests: ${total}"
|
||||
echo "Passed: ${ratio}%"
|
||||
|
||||
if [ ${failed} -ne 0 ]
|
||||
then
|
||||
echo "See $JERRY_ERROR for details about failures"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,17 +0,0 @@
|
||||
# Copyright 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.
|
||||
|
||||
TARGET=$1
|
||||
PARSE=$2
|
||||
rm ./js.files jerry.error jerry.passed; ./tools/runners/run-test-pass.sh $TARGET . ./tests/jerry-test-suite/compact_profile_list $PARSE
|
||||
@@ -1,18 +0,0 @@
|
||||
# Copyright 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.
|
||||
|
||||
TARGET=$1
|
||||
PARSE=$2
|
||||
rm ./js.files jerry.error jerry.passed; ./tools/runners/run-test-pass.sh $TARGET . ./tests/jerry-test-suite/ $PARSE
|
||||
|
||||
Executable
+135
@@ -0,0 +1,135 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2015-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.
|
||||
|
||||
TIMEOUT=${TIMEOUT:=5}
|
||||
|
||||
ENGINE="$1"
|
||||
shift
|
||||
|
||||
OUT_DIR="$1"
|
||||
shift
|
||||
|
||||
TESTS="$1"
|
||||
shift
|
||||
|
||||
ENGINE_ARGS="$@"
|
||||
|
||||
if [ ! -x $ENGINE ]
|
||||
then
|
||||
echo "$0: $ENGINE: not an executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p $OUT_DIR
|
||||
|
||||
TEST_FILES=$OUT_DIR/test.files
|
||||
TEST_FAILED=$OUT_DIR/test.failed
|
||||
TEST_PASSED=$OUT_DIR/test.passed
|
||||
|
||||
if [ -d $TESTS ]
|
||||
then
|
||||
TESTS_DIR=$TESTS
|
||||
|
||||
( cd $TESTS; find . -path fail -prune -o -name "[^N]*.js" -print ) | sort > $TEST_FILES
|
||||
|
||||
if [ -d $TESTS/fail ]
|
||||
then
|
||||
for error_code in `cd $TESTS/fail && ls -d [0-9]*`
|
||||
do
|
||||
( cd $TESTS; find ./fail/$error_code -name "[^N]*.js" -print ) | sort >> $TEST_FILES
|
||||
done
|
||||
fi
|
||||
elif [ -f $TESTS ]
|
||||
then
|
||||
TESTS_DIR=`dirname $TESTS`
|
||||
|
||||
cp $TESTS $TEST_FILES
|
||||
else
|
||||
echo "$0: $TESTS: not a test suite"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
total=$(cat $TEST_FILES | wc -l)
|
||||
if [ "$total" -eq 0 ]
|
||||
then
|
||||
echo "$0: $TESTS: no test in test suite"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f $TEST_FAILED $TEST_PASSED
|
||||
|
||||
tested=1
|
||||
failed=0
|
||||
passed=0
|
||||
|
||||
ENGINE_TEMP=`mktemp engine-out.XXXXXXXXXX`
|
||||
|
||||
for test in `cat $TEST_FILES`
|
||||
do
|
||||
error_code=`echo $test | grep -e "^.\/fail\/[0-9]*\/" -o | cut -d / -f 3`
|
||||
if [ "$error_code" = "" ]
|
||||
then
|
||||
PASS="PASS"
|
||||
error_code=0
|
||||
else
|
||||
PASS="PASS (XFAIL)"
|
||||
fi
|
||||
|
||||
full_test=$TESTS_DIR/${test#./}
|
||||
|
||||
echo -n "[$tested/$total] $ENGINE $ENGINE_ARGS $full_test: "
|
||||
|
||||
( ulimit -t $TIMEOUT; $ENGINE $ENGINE_ARGS $full_test &>$ENGINE_TEMP; exit $? )
|
||||
status_code=$?
|
||||
|
||||
if [ $status_code -ne $error_code ]
|
||||
then
|
||||
echo "FAIL ($status_code)"
|
||||
cat $ENGINE_TEMP
|
||||
|
||||
echo "$status_code: $test" >> $TEST_FAILED
|
||||
echo "============================================" >> $TEST_FAILED
|
||||
cat $ENGINE_TEMP >> $TEST_FAILED
|
||||
echo "============================================" >> $TEST_FAILED
|
||||
echo >> $TEST_FAILED
|
||||
echo >> $TEST_FAILED
|
||||
|
||||
failed=$((failed+1))
|
||||
else
|
||||
echo "$PASS"
|
||||
|
||||
echo "$test" >> $TEST_PASSED
|
||||
|
||||
passed=$((passed+1))
|
||||
fi
|
||||
|
||||
tested=$((tested+1))
|
||||
done
|
||||
|
||||
rm -f $ENGINE_TEMP
|
||||
|
||||
ratio=$(echo $passed*100/$total | bc)
|
||||
|
||||
echo "[summary] $ENGINE $ENGINE_ARGS $TESTS: $passed PASS, $failed FAIL, $total total, $ratio% success"
|
||||
|
||||
if [ $failed -ne 0 ]
|
||||
then
|
||||
echo "$0: see $TEST_FAILED for details about failures"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,136 +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.
|
||||
|
||||
TIMEOUT=${TIMEOUT:=30}
|
||||
|
||||
START_DIR=`pwd`
|
||||
|
||||
ENGINE=$START_DIR/$1
|
||||
shift
|
||||
|
||||
OUT_DIR=$1
|
||||
shift
|
||||
|
||||
ERROR_CODE=$1
|
||||
shift
|
||||
|
||||
TESTS=$START_DIR/$1/fail/$ERROR_CODE
|
||||
shift
|
||||
|
||||
ECHO_PROGRESS=1
|
||||
JERRY_ARGS=
|
||||
while (( "$#" ))
|
||||
do
|
||||
if [ "$1" = "--parse-only" ]
|
||||
then
|
||||
JERRY_ARGS="$JERRY_ARGS $1"
|
||||
fi
|
||||
if [ "$1" = "--output-to-log" ]
|
||||
then
|
||||
exec 1>$OUT_DIR/jerry_test.log
|
||||
ECHO_PROGRESS=0
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if [ ! -x $ENGINE ]
|
||||
then
|
||||
echo \"$ENGINE\" is not an executable file
|
||||
fi
|
||||
|
||||
if [ ! -d $OUT_DIR ]
|
||||
then
|
||||
mkdir -p $OUT_DIR
|
||||
fi
|
||||
cd $OUT_DIR
|
||||
|
||||
JS_FILES=js.fail.files
|
||||
JERRY_ERROR=jerry.error
|
||||
JERRY_OK=jerry.passed
|
||||
|
||||
rm -f $JS_FILES $JERRY_ERROR
|
||||
|
||||
if [ -d $TESTS ];
|
||||
then
|
||||
find $TESTS -name [^N]*.js -print | sort > $JS_FILES
|
||||
else
|
||||
if [ -f $TESTS ];
|
||||
then
|
||||
cp $TESTS $JS_FILES
|
||||
else
|
||||
exit 1
|
||||
fi;
|
||||
fi;
|
||||
total=$(cat $JS_FILES | wc -l)
|
||||
|
||||
tested=0
|
||||
failed=0
|
||||
passed=0
|
||||
|
||||
JERRY_TEMP=jerry.tmp
|
||||
|
||||
echo " Passed / Failed / Tested / Total / Percent"
|
||||
|
||||
for test in `cat $JS_FILES`
|
||||
do
|
||||
percent=$(echo $tested*100/$total | bc)
|
||||
|
||||
( ulimit -t $TIMEOUT; ${ENGINE} ${test} ${JERRY_ARGS} >&$JERRY_TEMP; exit $? );
|
||||
status_code=$?
|
||||
|
||||
if [ $ECHO_PROGRESS -eq 1 ]
|
||||
then
|
||||
printf "\r\e[2K[ %6d / %6d / %6d / %5d / %3d%% ]" ${passed} ${failed} ${tested} ${total} ${percent}
|
||||
fi
|
||||
|
||||
if [ $status_code -ne $ERROR_CODE ]
|
||||
then
|
||||
echo "$status_code: ${test}" >> $JERRY_ERROR
|
||||
echo "============================================" >> $JERRY_ERROR
|
||||
cat $JERRY_TEMP >> $JERRY_ERROR
|
||||
echo "============================================" >> $JERRY_ERROR
|
||||
echo >> $JERRY_ERROR
|
||||
echo >> $JERRY_ERROR
|
||||
|
||||
failed=$((failed+1))
|
||||
else
|
||||
echo "${test}" >> $JERRY_OK
|
||||
passed=$((passed+1))
|
||||
fi
|
||||
|
||||
tested=$((tested+1))
|
||||
done
|
||||
|
||||
rm $JERRY_TEMP
|
||||
|
||||
printf "\r\e[2K[ %6d / %6d / %6d / %5d / %3d%% ]\n" ${passed} ${failed} ${tested} ${total} ${percent}
|
||||
|
||||
ratio=$(echo $passed*100/$total | bc)
|
||||
|
||||
echo ==========================
|
||||
echo "Number of tests passed: ${passed}"
|
||||
echo "Number of tests failed: ${failed}"
|
||||
echo --------------------------
|
||||
echo "Total number of tests: ${total}"
|
||||
echo "Passed: ${ratio}%"
|
||||
|
||||
if [ ${failed} -ne 0 ]
|
||||
then
|
||||
echo "See $JERRY_ERROR for details about failures"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
# Copyright 2014-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.
|
||||
@@ -17,35 +18,69 @@
|
||||
DIR="$1"
|
||||
shift
|
||||
|
||||
OPTION_SILENT=disable
|
||||
while (( "$#" ))
|
||||
do
|
||||
if [ "$1" = "--silent" ]
|
||||
then
|
||||
OPTION_SILENT=enable
|
||||
fi
|
||||
mkdir -p $DIR/check
|
||||
|
||||
shift
|
||||
done
|
||||
UNITTEST_ERROR=$DIR/check/unittests.failed
|
||||
UNITTEST_OK=$DIR/check/unittests.passed
|
||||
|
||||
rm -f $DIR/unit_tests_run.log
|
||||
rm -f $UNITTEST_ERROR $UNITTEST_OK
|
||||
|
||||
UNITTESTS=$(ls $DIR/unit-*)
|
||||
total=$(ls $DIR/unit-* | wc -l)
|
||||
|
||||
for unit_test in $UNITTESTS;
|
||||
if [ "$total" -eq 0 ]
|
||||
then
|
||||
echo "$0: $DIR: no unit-* test to execute"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tested=1
|
||||
failed=0
|
||||
passed=0
|
||||
|
||||
UNITTEST_TEMP=`mktemp unittest-out.XXXXXXXXXX`
|
||||
|
||||
for unit_test in $UNITTESTS
|
||||
do
|
||||
[ $OPTION_SILENT = "enable" ] || echo -n "Running $unit_test... ";
|
||||
echo -n "[$tested/$total] $unit_test: "
|
||||
|
||||
$unit_test >&$DIR/unit_tests_run.log.tmp;
|
||||
$unit_test &>$UNITTEST_TEMP
|
||||
status_code=$?
|
||||
cat $DIR/unit_tests_run.log.tmp >> $DIR/unit_tests_run.log
|
||||
rm $DIR/unit_tests_run.log.tmp
|
||||
|
||||
if [ $status_code -eq 0 ];
|
||||
then
|
||||
[ $OPTION_SILENT = "enable" ] || echo OK;
|
||||
else
|
||||
[ $OPTION_SILENT = "enable" ] || echo FAILED;
|
||||
exit 1;
|
||||
fi;
|
||||
if [ $status_code -ne 0 ]
|
||||
then
|
||||
echo "FAIL ($status_code)"
|
||||
cat $UNITTEST_TEMP
|
||||
|
||||
echo "$status_code: $unit_test" >> $UNITTEST_ERROR
|
||||
echo "============================================" >> $UNITTEST_ERROR
|
||||
cat $UNITTEST_TEMP >> $UNITTEST_ERROR
|
||||
echo "============================================" >> $UNITTEST_ERROR
|
||||
echo >> $UNITTEST_ERROR
|
||||
echo >> $UNITTEST_ERROR
|
||||
|
||||
failed=$((failed+1))
|
||||
else
|
||||
echo "PASS"
|
||||
|
||||
echo "$unit_test" >> $UNITTEST_OK
|
||||
|
||||
passed=$((passed+1))
|
||||
fi
|
||||
|
||||
tested=$((tested+1))
|
||||
done
|
||||
|
||||
rm -f $UNITTEST_TEMP
|
||||
|
||||
ratio=$(echo $passed*100/$total | bc)
|
||||
|
||||
echo "[summary] $DIR/unit-*: $passed PASS, $failed FAIL, $total total, $ratio% success"
|
||||
|
||||
if [ $failed -ne 0 ]
|
||||
then
|
||||
echo "$0: see $UNITTEST_ERROR for details about failures"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user