Refinement of tools directory.

This commit is contained in:
Ruben Ayrapetyan
2015-02-10 20:18:25 +03:00
parent d2459398f5
commit f3ff78b81b
19 changed files with 149 additions and 2449 deletions
+56
View File
@@ -0,0 +1,56 @@
# 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.
#!/bin/bash
ENGINE=$1
function run ()
{
echo "Running test: $1.js"
./tools/perf.sh 5 $ENGINE ./tests/benchmarks/$1.js
./tools/rss-measure.sh $ENGINE ./tests/benchmarks/$1.js
}
echo "Running Sunspider:"
#run jerry/sunspider/3d-morph // too fast
run jerry/sunspider/bitops-3bit-bits-in-byte
run jerry/sunspider/bitops-bits-in-byte
run jerry/sunspider/bitops-bitwise-and
run jerry/sunspider/controlflow-recursive
run jerry/sunspider/math-cordic
run jerry/sunspider/math-partial-sums
run jerry/sunspider/math-spectral-norm
echo "Running Jerry:"
run jerry/cse
run jerry/cse_loop
run jerry/cse_ready_loop
run jerry/empty_loop
run jerry/function_loop
run jerry/loop_arithmetics_10kk
run jerry/loop_arithmetics_1kk
echo "Running UBench:"
run ubench/function-closure
run ubench/function-empty
run ubench/function-correct-args
run ubench/function-excess-args
run ubench/function-missing-args
run ubench/function-sum
run ubench/loop-empty-resolve
run ubench/loop-empty
run ubench/loop-sum
+41
View File
@@ -0,0 +1,41 @@
# 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.
#!/bin/bash
NUM_COMMITS=$1
BENCH=./tests/benchmarks/jerry/loop_arithmetics_1kk.js
TARGET=release.linux
trap ctrl_c INT
function ctrl_c() {
git checkout master >&/dev/null
exit 1
}
commits_to_push=`git log -$NUM_COMMITS | grep "^commit [0-9a-f]*$" | awk 'BEGIN { s = ""; } { s = $2" "s; } END { print s; }'`
for commit_hash in $commits_to_push
do
git checkout $commit_hash >&/dev/null
echo -e -n " > Testing...\n > "
echo `git log --format=%B -n 1 $commit_hash`
make -s $TARGET
./tools/rss-measure.sh $TARGET $BENCH
echo
done
git checkout master >&/dev/null
+130
View File
@@ -0,0 +1,130 @@
# 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.
#!/bin/bash
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
exec 2>/dev/null
echo " Passed / Failed / Tested / Total / Percent"
for test in `cat $JS_FILES`
do
percent=$(echo $tested*100/$total | bc)
( ulimit -t $TIMEOUT; $VALGRIND ${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 $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
+17
View File
@@ -0,0 +1,17 @@
# 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
+18
View File
@@ -0,0 +1,18 @@
# 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
+70
View File
@@ -0,0 +1,70 @@
# 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.
#!/bin/bash
TARGET=$1
PARSE=$2
TIMEOUT=5
TMP_DIR=`mktemp -d --tmpdir=./`
echo $TMP_DIR | grep -q tmp || exit 1
trap clean_on_exit INT
function clean_on_exit() {
rm -rf $TMP_DIR
[[ $1 == "OK" ]] || exit 1
}
TEST_SUITE_PATH="./tests/test262/test"
STA_JS="$TEST_SUITE_PATH/harness/sta-jerry.js"
MAX_THREADS=${MAX_CPUS:-32}
rm -f jerry.error.*
find $TEST_SUITE_PATH/suite -name *.js -printf "%p %D%i\0" | xargs -0 -n 1 -P $MAX_THREADS bash -c '
target=$0
sta_js_path=$1;
timeout=$2;
tmp_dir=$3;
test=`echo $4 | cut -d " " -f 1`;
test_id=`echo $4 | cut -d " " -f 2`;
chapter=`echo $test | cut -d "/" -f 6`;
grep "\* @negative" $test 2>&1 >/dev/null;
negative=$?;
cmd="$target $test $sta_js_path";
output=`ulimit -t $timeout; $cmd 2>&1`;
status=$?;
if [[ $status -eq 0 && $negative -eq 0 || $status -ne 0 && $negative -ne 0 ]];
then
(echo "====================";
echo "$cmd failed: $status";
echo "---------------------";
echo $output;
echo;) >> $tmp_dir/jerry.error."$chapter"."$test_id";
fi;
' "$TARGET $PARSE" $STA_JS $TIMEOUT $TMP_DIR 2>/dev/null;
for CHAPTER in `ls $TEST_SUITE_PATH/suite`;
do
cat $TMP_DIR/jerry.error."$CHAPTER".* > jerry.error."$CHAPTER"
done
clean_on_exit OK
+138
View File
@@ -0,0 +1,138 @@
# 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.
#!/bin/bash
TIMEOUT=${TIMEOUT:=5}
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
exec 2>/dev/null
echo " Passed / Failed / Tested / Total / Percent"
for test in `cat $JS_FILES`
do
percent=$(echo $tested*100/$total | bc)
( ulimit -t $TIMEOUT; $VALGRIND ${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
+52
View File
@@ -0,0 +1,52 @@
# 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.
#!/bin/bash
DIR="$1"
shift
OPTION_SILENT=disable
while (( "$#" ))
do
if [ "$1" = "--silent" ]
then
OPTION_SILENT=enable
fi
shift
done
rm -f $DIR/unit_tests_run.log
UNITTESTS=$(ls $DIR/unit_*)
for unit_test in $UNITTESTS;
do
[ $OPTION_SILENT = "enable" ] || echo -n "Running $unit_test... ";
$VALGRIND $unit_test >&$DIR/unit_tests_run.log.tmp;
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;
done