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 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