mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2026-02-07 17:16:25 +00:00
Fixes after review: simplification
This commit is contained in:
parent
306f111a28
commit
d927d3e320
1
.gitignore
vendored
1
.gitignore
vendored
@ -21,7 +21,6 @@ nbproject
|
||||
# Random Trash
|
||||
*~
|
||||
js.files
|
||||
jerry.error
|
||||
core
|
||||
vgcore.*
|
||||
**.orig
|
||||
|
||||
@ -293,7 +293,7 @@ $(PARSER_TESTS_TARGET): debug.$(TARGET_SYSTEM)
|
||||
@mkdir -p $(TARGET_DIR)/check
|
||||
@ echo "=== Running parser tests ==="
|
||||
@ if [ -f $(TARGET_DIR)/$(ENGINE_NAME) ]; then \
|
||||
./tools/jerry_test_parser.sh $(TARGET_DIR)/$(ENGINE_NAME) $(TARGET_DIR)/check; \
|
||||
./tools/jerry_test.sh $(TARGET_DIR)/$(ENGINE_NAME) $(TARGET_DIR)/check --parse-only; \
|
||||
fi
|
||||
|
||||
$(CHECK_TARGETS): $(TARGET_OF_ACTION)
|
||||
|
||||
32
src/main.c
32
src/main.c
@ -30,17 +30,14 @@
|
||||
#define MAX_STRINGS 100
|
||||
#define MAX_NUMS 25
|
||||
|
||||
static const OPCODE *opcodes;
|
||||
|
||||
static void
|
||||
static const OPCODE *
|
||||
parser_run (const char *script_source, size_t script_source_size __unused)
|
||||
{
|
||||
const char *strings[MAX_STRINGS];
|
||||
int32_t nums[MAX_NUMS];
|
||||
uint8_t strings_num, nums_count;
|
||||
uint8_t offset;
|
||||
|
||||
mem_init();
|
||||
const OPCODE *opcodes;
|
||||
|
||||
TODO( Consider using script_source_size in lexer to check buffer boundaries );
|
||||
|
||||
@ -65,12 +62,24 @@ parser_run (const char *script_source, size_t script_source_size __unused)
|
||||
#ifdef __HOST
|
||||
serializer_print_opcodes ();
|
||||
#endif
|
||||
|
||||
return opcodes;
|
||||
}
|
||||
|
||||
static void
|
||||
jerry_run (const char *script_source, size_t script_source_size)
|
||||
jerry_run (const char *script_source, size_t script_source_size, bool is_parse_only)
|
||||
{
|
||||
parser_run (script_source, script_source_size);
|
||||
const OPCODE *opcodes;
|
||||
|
||||
mem_init();
|
||||
|
||||
opcodes = parser_run (script_source, script_source_size);
|
||||
|
||||
if (is_parse_only)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
init_int (opcodes);
|
||||
run_int ();
|
||||
} /* jerry_run */
|
||||
@ -156,14 +165,7 @@ main (int argc __unused,
|
||||
size_t source_size;
|
||||
const char *source_p = read_source( file_name, &source_size);
|
||||
|
||||
if (parse_only)
|
||||
{
|
||||
parser_run (source_p, source_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
jerry_run (source_p, source_size);
|
||||
}
|
||||
jerry_run (source_p, source_size, parse_only);
|
||||
|
||||
mem_heap_print( false, false, true);
|
||||
|
||||
|
||||
@ -1,86 +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
|
||||
|
||||
TIMEOUT=3
|
||||
|
||||
START_DIR=`pwd`
|
||||
|
||||
ENGINE=$START_DIR/$1
|
||||
OUT_DIR=$2
|
||||
|
||||
|
||||
cd $OUT_DIR
|
||||
|
||||
JS_FILES=js.files
|
||||
JERRY_ERROR=jerry.error
|
||||
|
||||
rm -f $JS_FILES $JERRY_ERROR
|
||||
|
||||
find $START_DIR -name *.js -print > $JS_FILES
|
||||
total=$(cat $JS_FILES | wc -l)
|
||||
|
||||
tested=0
|
||||
failed=0
|
||||
passed=0
|
||||
|
||||
exec 2>/dev/null 3>/dev/stderr
|
||||
|
||||
echo " Passed / Failed / Tested / Total / Percent"
|
||||
|
||||
for test in `cat $JS_FILES`
|
||||
do
|
||||
percent=$(echo $tested*100/$total | bc)
|
||||
|
||||
( ulimit -t $TIMEOUT;
|
||||
${ENGINE} ${test} --parse-only > /dev/null;
|
||||
exit $? );
|
||||
status_code=$?
|
||||
|
||||
printf "\r\e[2K[ %6d / %6d / %6d / %5d / %3d%% ]" ${passed} ${failed} ${tested} ${total} ${percent}
|
||||
|
||||
if [ $status_code -ne 0 ]
|
||||
then
|
||||
echo "$status_code: ${test}" >> $JERRY_ERROR
|
||||
|
||||
failed=$((failed+1))
|
||||
else
|
||||
passed=$((passed+1))
|
||||
fi
|
||||
|
||||
tested=$((tested+1))
|
||||
done
|
||||
|
||||
exec 2>&3 2> /dev/null
|
||||
|
||||
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"
|
||||
# FIXME: When all tests will pass
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Loading…
x
Reference in New Issue
Block a user