From ff935ea417c7344ab35d2c91f7032b52827dcca1 Mon Sep 17 00:00:00 2001 From: "e.gavrin" Date: Sat, 11 Oct 2014 19:09:21 +0400 Subject: [PATCH] Add support scripts for testing and becnmarking --- tools/rss_measure.sh | 8 ++--- tools/run_benchmarks.sh | 55 +++++++++++++++++++++++++++++++++ tools/run_test_suite_test262.sh | 18 +++++++++++ 3 files changed, 77 insertions(+), 4 deletions(-) create mode 100755 tools/run_benchmarks.sh create mode 100755 tools/run_test_suite_test262.sh diff --git a/tools/rss_measure.sh b/tools/rss_measure.sh index 9c24cd8c5..e4c5a123c 100755 --- a/tools/rss_measure.sh +++ b/tools/rss_measure.sh @@ -36,8 +36,8 @@ function collect_entry() OUT_NAME="$1_OUT"; OUT=$OUT_NAME; - SUM=$(grep "$1" < /proc/"$PID"/smaps | awk '{sum += $2;} END { if (sum != 0) { print sum; }; }'); - + SUM=$(cat /proc/"$PID"/smaps 2>/dev/null | grep "$1" | awk '{sum += $2;} END { if (sum != 0) { print sum; }; }'); + if [ "$SUM" != "" ]; then eval "$OUT=\"\$$OUT $SUM\\n\""; @@ -48,7 +48,7 @@ function print_entry() { OUT_NAME="$1_OUT"; OUT=$OUT_NAME; - + eval "echo -e \"\$$OUT\"" | awk -v entry="$1" '{ if ($1 != "") { sum += $1; n += 1; if ($1 > max) { max = $1; } } } END { if (n == 0) { exit; }; printf "%19s:%8d Kb%19s:%8d Kb\n", entry, sum / n, entry, max; }'; } @@ -68,7 +68,7 @@ function run_test() collect_entry Share collect_entry Size collect_entry Swap - + sleep $SLEEP done diff --git a/tools/run_benchmarks.sh b/tools/run_benchmarks.sh new file mode 100755 index 000000000..e3dd32cf4 --- /dev/null +++ b/tools/run_benchmarks.sh @@ -0,0 +1,55 @@ +# 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 + +ENGINE=$1 + +function run () +{ + echo "Running test: $1.js" + ./tools/rss_measure.sh $ENGINE ./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 # work under mem-stats +run jerry/sunspider/math-cordic +run jerry/sunspider/math-partial-sums +#run jerry/sunspider/math-spectral-norm # fix + +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 + + diff --git a/tools/run_test_suite_test262.sh b/tools/run_test_suite_test262.sh new file mode 100755 index 000000000..648cfd816 --- /dev/null +++ b/tools/run_test_suite_test262.sh @@ -0,0 +1,18 @@ +# 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. + +TARGET=$1 +PARSE=$2 +rm ./js.files jerry.error jerry.passed; ./tools/jerry_test.sh ./out/$TARGET/jerry . ./tests/test262/test/suite/ $PARSE +