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

View File

@ -100,14 +100,14 @@ PRECOMMIT_CHECK_TARGETS_VALGRIND_LIST= debug.linux-valgrind.check \
release.linux-valgrind.check \
release.linux-cp-valgrind.check
push: ./tools/push.sh
@ ./tools/push.sh
push: ./tools/git-scripts/push.sh
@ ./tools/git-scripts/push.sh
pull: ./tools/pull.sh
@ ./tools/pull.sh
pull: ./tools/git-scripts/pull.sh
@ ./tools/git-scripts/pull.sh
log: ./tools/log.sh
@ ./tools/log.sh
log: ./tools/git-scripts/log.sh
@ ./tools/git-scripts/log.sh
precommit: clean
@ echo -e "\nBuilding...\n\n"

View File

@ -58,7 +58,7 @@ endif
.PHONY: unittests_run $(CHECK_TARGETS)
unittests_run:
@ VALGRIND=$(VALGRIND_CMD) ./tools/jerry_unittest.sh $(TARGET_DIR) $(TESTS_OPTS)
@ VALGRIND=$(VALGRIND_CMD) ./tools/runners/run-unittests.sh $(TARGET_DIR) $(TESTS_OPTS)
$(CHECK_TARGETS):
@ if [ ! -f $(TARGET_DIR)/$(ENGINE_NAME) ]; then echo $(TARGET_OF_ACTION) is not built yet; exit 1; fi;
@ -69,7 +69,7 @@ $(CHECK_TARGETS):
then \
ADD_OPTS="--output-to-log"; \
fi; \
VALGRIND=$(VALGRIND_CMD) TIMEOUT=$(VALGRIND_TIMEOUT) ./tools/jerry_test.sh $(TARGET_DIR)/$(ENGINE_NAME) $(TARGET_DIR)/check $(TESTS) $(TESTS_OPTS) $$ADD_OPTS; \
VALGRIND=$(VALGRIND_CMD) TIMEOUT=$(VALGRIND_TIMEOUT) ./tools/runners/run-test-pass.sh $(TARGET_DIR)/$(ENGINE_NAME) $(TARGET_DIR)/check $(TESTS) $(TESTS_OPTS) $$ADD_OPTS; \
status_code=$$?; \
if [ $$status_code -ne 0 ]; \
then \
@ -83,7 +83,7 @@ $(CHECK_TARGETS):
fi; \
if [ -d $(TESTS_DIR)/fail/ ]; \
then \
VALGRIND=$(VALGRIND_CMD) TIMEOUT=$(VALGRIND_TIMEOUT) ./tools/jerry_test_fail.sh $(TARGET_DIR)/$(ENGINE_NAME) $(TARGET_DIR)/check $(PARSER_ERROR_CODE) $(TESTS_DIR) $(TESTS_OPTS) $$ADD_OPTS; \
VALGRIND=$(VALGRIND_CMD) TIMEOUT=$(VALGRIND_TIMEOUT) ./tools/runners/run-test-xfail.sh $(TARGET_DIR)/$(ENGINE_NAME) $(TARGET_DIR)/check $(PARSER_ERROR_CODE) $(TESTS_DIR) $(TESTS_OPTS) $$ADD_OPTS; \
status_code=$$?; \
if [ $$status_code -ne 0 ]; \
then \

File diff suppressed because it is too large Load Diff

View File

@ -121,11 +121,11 @@ do
# echo "Starting pre-commit performance measurement for '$commit_hash'"
# echo
# BENCH_ENGINE="./out/release.linux/jerry"
# BENCH_ENGINE="./build/bin/release.linux/jerry"
# BENCH_SCRIPT="./tests/benchmarks/jerry/loop_arithmetics_1kk.js"
# PERF_ITERS="5"
# PERF_INFO=`echo -e "$BENCH_SCRIPT:\n\t"``./tools/perf.sh $PERF_ITERS $BENCH_ENGINE $BENCH_SCRIPT`" seconds"
# MEM_INFO=`echo -e "$BENCH_SCRIPT:\n"``./tools/rss_measure.sh $BENCH_ENGINE $BENCH_SCRIPT`
# MEM_INFO=`echo -e "$BENCH_SCRIPT:\n"``./tools/rss-measure.sh $BENCH_ENGINE $BENCH_SCRIPT`
# echo "Pre-commit performance measurement for '$commit_hash' completed"
# echo

View File

@ -1,67 +0,0 @@
# 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.
# A simple harness that downloads and runs 'jsfunfuzz' against d8. This
# takes a long time because it runs many iterations and is intended for
# automated usage. The package containing 'jsfunfuzz' can be found as an
# attachment to this bug:
# https://bugzilla.mozilla.org/show_bug.cgi?id=jsfunfuzz
JSFUNFUZZ_URL="https://bugzilla.mozilla.org/attachment.cgi?id=310631"
JSFUNFUZZ_MD5="d0e497201c5cd7bffbb1cdc1574f4e32"
engine=$1
jsfunfuzz_file="./tools/jsfunfuzz.zip"
if [ ! -f "$jsfunfuzz_file" ]; then
echo "Downloading $jsfunfuzz_file ..."
wget -q -O "$jsfunfuzz_file" $JSFUNFUZZ_URL || exit 1
fi
jsfunfuzz_sum=$(md5sum "$jsfunfuzz_file" | awk '{ print $1 }')
if [ $jsfunfuzz_sum != $JSFUNFUZZ_MD5 ]; then
echo "Failed to verify checksum!"
exit 1
fi
jsfunfuzz_dir="./tools/jsfunfuzz"
if [ ! -d "$jsfunfuzz_dir" ]; then
echo "Unpacking into $jsfunfuzz_dir ..."
unzip "$jsfunfuzz_file" -d "$jsfunfuzz_dir" || exit 1
echo "Patching runner ..."
cat << EOF | patch -s -p0 -d "."
--- tools/jsfunfuzz/jsfunfuzz/multi_timed_run.py~
+++ tools/jsfunfuzz/jsfunfuzz/multi_timed_run.py
@@ -125,7 +125,7 @@
def many_timed_runs():
iteration = 0
- while True:
+ while iteration < 100:
iteration += 1
logfilename = "w%d" % iteration
one_timed_run(logfilename)
EOF
fi
python -u "$jsfunfuzz_dir/jsfunfuzz/multi_timed_run.py" 300 \
$engine "$jsfunfuzz_dir/jsfunfuzz/jsfunfuzz.js"
exit_code=$(cat w* | grep " looking good" -c)
exit_code=$((100-exit_code))
tar -cjf fuzz-results-$(date +%y%m%d).tar.bz2 err-* w*
rm -f err-* w*
echo "Total failures: $exit_code"
exit $exit_code

View File

@ -1,16 +0,0 @@
# 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.
# tbd

View File

@ -20,7 +20,7 @@ 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
./tools/rss-measure.sh $ENGINE ./tests/benchmarks/$1.js
}
echo "Running Sunspider:"

View File

@ -34,7 +34,7 @@ do
echo -e -n " > Testing...\n > "
echo `git log --format=%B -n 1 $commit_hash`
make -s $TARGET
./tools/rss_measure.sh ./out/$TARGET/jerry $BENCH
./tools/rss-measure.sh $TARGET $BENCH
echo
done

130
tools/runners/run-test-pass.sh Executable file
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

View File

@ -1,4 +1,4 @@
# Copyright 2014 Samsung Electronics Co., Ltd.
# 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.
@ -14,4 +14,4 @@
TARGET=$1
PARSE=$2
rm ./js.files jerry.error jerry.passed; ./tools/jerry_test.sh ./out/$TARGET/jerry . ./tests/jerry-test-suite/compact_profile_list $PARSE
rm ./js.files jerry.error jerry.passed; ./tools/runners/run-test-pass.sh $TARGET . ./tests/jerry-test-suite/compact_profile_list $PARSE

View File

@ -1,4 +1,4 @@
# Copyright 2014 Samsung Electronics Co., Ltd.
# 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.
@ -14,5 +14,5 @@
TARGET=$1
PARSE=$2
rm ./js.files jerry.error jerry.passed; ./tools/jerry_test.sh ./out/$TARGET/jerry . ./tests/jerry-test-suite/ $PARSE
rm ./js.files jerry.error jerry.passed; ./tools/runners/run-test-pass.sh $TARGET . ./tests/jerry-test-suite/ $PARSE

View File

@ -1,4 +1,4 @@
# Copyright 2014 Samsung Electronics Co., Ltd.
# 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.
@ -60,7 +60,7 @@ find $TEST_SUITE_PATH/suite -name *.js -printf "%p %D%i\0" | xargs -0 -n 1 -P $M
echo $output;
echo;) >> $tmp_dir/jerry.error."$chapter"."$test_id";
fi;
' "./out/$TARGET/jerry $PARSE" $STA_JS $TIMEOUT $TMP_DIR 2>/dev/null;
' "$TARGET $PARSE" $STA_JS $TIMEOUT $TMP_DIR 2>/dev/null;
for CHAPTER in `ls $TEST_SUITE_PATH/suite`;
do

View File

@ -1,44 +0,0 @@
# 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
if [[ "$1" != "-y" || ! -d "$2" ]]
then
echo "Transformation validity was not checked for all cases."
echo "Please, check code after fixing it with this script".
echo "To run script pass -y in first argument and directory path in the second."
exit 1
fi
dir=$2
# Remove trailing spaces
find $dir/*.[chS] -exec sed -i 's/[[:space:]]\{1,\}$//g' {} \;
# Remove tabs
find $dir/*.[chS] -exec sed -i 's/\t/ /g' {} \;
# Add space between function name and opening parentheses
find $dir/*.[chS] -exec sed -i 's/\([a-z0-9_-]\)\((\)/\1 \2/g' {} \;
# Remove space after opening parentheses
find $dir/*.[chS] -exec sed -i 's/([ ]*/(/g' {} \;
# Remove space before closing parentheses
find $dir/*.[chS] -exec sed -i 's/[ ]*)/)/g' {} \;
# Place else on separate line
find $dir/*.[chS] -exec sed -i 's/\([ ]*\)} else\(.*\)/\1}\n\1else\2/g' {} \;