mirror of
https://github.com/google/pebble.git
synced 2025-07-15 10:36:43 -04:00
Import of the watch repository from Pebble
This commit is contained in:
commit
3b92768480
10334 changed files with 2564465 additions and 0 deletions
22
third_party/jerryscript/tools/apt-get-install-deps.sh
vendored
Executable file
22
third_party/jerryscript/tools/apt-get-install-deps.sh
vendored
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -q -y \
|
||||
make cmake \
|
||||
gcc \
|
||||
cppcheck vera++ python
|
21
third_party/jerryscript/tools/apt-get-install-qemu-arm.sh
vendored
Executable file
21
third_party/jerryscript/tools/apt-get-install-qemu-arm.sh
vendored
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -q -y \
|
||||
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross \
|
||||
qemu-user-static
|
31
third_party/jerryscript/tools/brew-install-deps.sh
vendored
Executable file
31
third_party/jerryscript/tools/brew-install-deps.sh
vendored
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
brew update
|
||||
|
||||
PKGS="
|
||||
cmake
|
||||
cppcheck vera++
|
||||
"
|
||||
|
||||
for pkg in $PKGS
|
||||
do
|
||||
if ! ( brew list -1 | grep -q "^${pkg}\$" )
|
||||
then
|
||||
brew install $pkg
|
||||
fi
|
||||
done
|
169
third_party/jerryscript/tools/build.py
vendored
Executable file
169
third_party/jerryscript/tools/build.py
vendored
Executable file
|
@ -0,0 +1,169 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
import argparse
|
||||
import multiprocessing
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from os import makedirs, uname
|
||||
from settings import *
|
||||
|
||||
BUILD_DIR = path.join(PROJECT_DIR, 'build')
|
||||
|
||||
def default_toolchain():
|
||||
(sysname, _, _, _, machine) = uname()
|
||||
toolchain = path.join(PROJECT_DIR, 'cmake', 'toolchain_%s_%s.cmake' % (sysname.lower(), machine.lower()))
|
||||
return toolchain if path.isfile(toolchain) else None
|
||||
|
||||
def get_arguments():
|
||||
devhelp_preparser = argparse.ArgumentParser(add_help=False)
|
||||
devhelp_preparser.add_argument('--devhelp', action='store_true', default=False, help='show help with all options (including those, which are useful for developers only)')
|
||||
|
||||
devhelp_arguments, args = devhelp_preparser.parse_known_args()
|
||||
if devhelp_arguments.devhelp:
|
||||
args.append('--devhelp')
|
||||
|
||||
def devhelp(help):
|
||||
return help if devhelp_arguments.devhelp else argparse.SUPPRESS
|
||||
|
||||
parser = argparse.ArgumentParser(parents=[devhelp_preparser])
|
||||
parser.add_argument('-v', '--verbose', action='store_const', const='ON', default='OFF', help='increase verbosity')
|
||||
parser.add_argument('--clean', action='store_true', default=False, help='clean build')
|
||||
parser.add_argument('-j', '--jobs', metavar='N', action='store', type=int, default=multiprocessing.cpu_count() + 1, help='Allowed N build jobs at once (default: %(default)s)')
|
||||
parser.add_argument('--debug', action='store_const', const='Debug', default='Release', dest='build_type', help='debug build')
|
||||
parser.add_argument('--builddir', metavar='DIR', action='store', default=BUILD_DIR, help='specify output directory (default: %(default)s)')
|
||||
parser.add_argument('--lto', metavar='X', choices=['on', 'off'], default='on', help='enable link-time optimizations (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--all-in-one', metavar='X', choices=['on', 'off'], default='off', help='all-in-one build (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--profile', metavar='PROFILE', choices=['full', 'minimal'], default='full', help='specify the profile (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--error-messages', metavar='X', choices=['on', 'off'], default='off', help='enable error messages (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--snapshot-save', metavar='X', choices=['on', 'off'], default='off', help='enable saving snapshot files (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--snapshot-exec', metavar='X', choices=['on', 'off'], default='off', help='enable executing snapshot files (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--cpointer-32bit', metavar='X', choices=['on', 'off'], default='off', help='enable 32 bit compressed pointers (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--toolchain', metavar='FILE', action='store', default=default_toolchain(), help='add toolchain file (default: %(default)s)')
|
||||
parser.add_argument('--cmake-param', metavar='OPT', action='append', default=[], help='add custom argument to CMake')
|
||||
parser.add_argument('--compile-flag', metavar='OPT', action='append', default=[], help='add custom compile flag')
|
||||
parser.add_argument('--linker-flag', metavar='OPT', action='append', default=[], help='add custom linker flag')
|
||||
parser.add_argument('--link-lib', metavar='OPT', action='append', default=[], help='add custom library to be linked')
|
||||
parser.add_argument('--jerry-libc', metavar='X', choices=['on', 'off'], default='on', help='build and use jerry-libc (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--jerry-libm', metavar='X', choices=['on', 'off'], default='on', help='build and use jerry-libm (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--jerry-cmdline', metavar='X', choices=['on', 'off'], default='on', help='build jerry command line tool (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--static-link', metavar='X', choices=['on', 'off'], default='on', help='enable static linking of binaries (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--strip', metavar='X', choices=['on', 'off'], default='on', help='strip release binaries (%(choices)s; default: %(default)s)')
|
||||
parser.add_argument('--unittests', action='store_const', const='ON', default='OFF', help='build unittests')
|
||||
|
||||
devgroup = parser.add_argument_group('developer options')
|
||||
devgroup.add_argument('--valgrind', metavar='X', choices=['on', 'off'], default='off', help=devhelp('enable Valgrind support (%(choices)s; default: %(default)s)'))
|
||||
devgroup.add_argument('--valgrind-freya', metavar='X', choices=['on', 'off'], default='off', help=devhelp('enable Valgrind-Freya support (%(choices)s; default: %(default)s)'))
|
||||
devgroup.add_argument('--show-opcodes', metavar='X', choices=['on', 'off'], default='off', help=devhelp('enable parser byte-code dumps (%(choices)s; default: %(default)s)'))
|
||||
devgroup.add_argument('--show-regexp-opcodes', metavar='X', choices=['on', 'off'], default='off', help=devhelp('enable regexp byte-code dumps (%(choices)s; default: %(default)s)'))
|
||||
devgroup.add_argument('--mem-stats', metavar='X', choices=['on', 'off'], default='off', help=devhelp('enable memory statistics (%(choices)s; default: %(default)s)'))
|
||||
devgroup.add_argument('--mem-stress-test', metavar='X', choices=['on', 'off'], default='off', help=devhelp('enable mem-stress test (%(choices)s; default: %(default)s)'))
|
||||
devgroup.add_argument('--link-map', metavar='X', choices=['on', 'off'], default='off', help=devhelp('enable the generation of a link map file for jerry command line tool (%(choices)s; default: %(default)s)'))
|
||||
|
||||
arguments = parser.parse_args(args)
|
||||
if arguments.devhelp:
|
||||
parser.print_help()
|
||||
sys.exit(0)
|
||||
|
||||
return arguments
|
||||
|
||||
def generate_build_options(arguments):
|
||||
build_options = []
|
||||
|
||||
build_options.append('-DJERRY_LIBC=%s' % arguments.jerry_libc.upper())
|
||||
build_options.append('-DJERRY_LIBM=%s' % arguments.jerry_libm.upper())
|
||||
build_options.append('-DJERRY_CMDLINE=%s' % arguments.jerry_cmdline.upper())
|
||||
build_options.append('-DCMAKE_VERBOSE_MAKEFILE=%s' % arguments.verbose)
|
||||
build_options.append('-DCMAKE_BUILD_TYPE=%s' % arguments.build_type)
|
||||
build_options.append('-DFEATURE_PROFILE=%s' % arguments.profile)
|
||||
build_options.append('-DFEATURE_ERROR_MESSAGES=%s' % arguments.error_messages.upper())
|
||||
build_options.append('-DFEATURE_VALGRIND=%s' % arguments.valgrind.upper())
|
||||
build_options.append('-DFEATURE_VALGRIND_FREYA=%s' % arguments.valgrind_freya.upper())
|
||||
build_options.append('-DFEATURE_PARSER_DUMP=%s' % arguments.show_opcodes.upper())
|
||||
build_options.append('-DFEATURE_REGEXP_DUMP=%s' % arguments.show_regexp_opcodes.upper())
|
||||
build_options.append('-DFEATURE_CPOINTER_32_BIT=%s' % arguments.cpointer_32bit.upper())
|
||||
build_options.append('-DFEATURE_MEM_STATS=%s' % arguments.mem_stats.upper())
|
||||
build_options.append('-DFEATURE_MEM_STRESS_TEST=%s' % arguments.mem_stress_test.upper())
|
||||
build_options.append('-DFEATURE_SNAPSHOT_SAVE=%s' % arguments.snapshot_save.upper())
|
||||
build_options.append('-DFEATURE_SNAPSHOT_EXEC=%s' % arguments.snapshot_exec.upper())
|
||||
build_options.append('-DENABLE_ALL_IN_ONE=%s' % arguments.all_in_one.upper())
|
||||
build_options.append('-DENABLE_LTO=%s' % arguments.lto.upper())
|
||||
build_options.append('-DENABLE_STRIP=%s' % arguments.strip.upper())
|
||||
build_options.append('-DUNITTESTS=%s' % arguments.unittests)
|
||||
build_options.append('-DENABLE_STATIC_LINK=%s' % arguments.static_link.upper())
|
||||
build_options.append('-DENABLE_LINK_MAP=%s' % arguments.link_map.upper())
|
||||
|
||||
build_options.extend(arguments.cmake_param)
|
||||
|
||||
build_options.append('-DEXTERNAL_COMPILE_FLAGS=' + ' '.join(arguments.compile_flag))
|
||||
build_options.append('-DEXTERNAL_LINKER_FLAGS=' + ' '.join(arguments.linker_flag))
|
||||
build_options.append('-DEXTERNAL_LINK_LIBS=' + ' '.join(arguments.link_lib))
|
||||
|
||||
if arguments.toolchain:
|
||||
build_options.append('-DCMAKE_TOOLCHAIN_FILE=%s' % arguments.toolchain)
|
||||
|
||||
return build_options
|
||||
|
||||
def configure_output_dir(arguments):
|
||||
global BUILD_DIR
|
||||
|
||||
if path.isabs(arguments.builddir):
|
||||
BUILD_DIR = arguments.builddir
|
||||
else:
|
||||
BUILD_DIR = path.join(PROJECT_DIR, arguments.builddir)
|
||||
|
||||
if arguments.clean and path.exists(BUILD_DIR):
|
||||
shutil.rmtree(BUILD_DIR)
|
||||
|
||||
if not path.exists(BUILD_DIR):
|
||||
makedirs(BUILD_DIR)
|
||||
|
||||
def configure_build(arguments):
|
||||
configure_output_dir(arguments)
|
||||
|
||||
build_options = generate_build_options(arguments)
|
||||
|
||||
cmake_cmd = ['cmake', '-B' + BUILD_DIR, '-H' + PROJECT_DIR]
|
||||
cmake_cmd.extend(build_options)
|
||||
|
||||
return subprocess.call(cmake_cmd)
|
||||
|
||||
def build_jerry(arguments):
|
||||
return subprocess.call(['make', '--no-print-directory','-j', str(arguments.jobs), '-C', BUILD_DIR])
|
||||
|
||||
def print_result(ret):
|
||||
print('=' * 30)
|
||||
if ret:
|
||||
print('Build failed with exit code: %s' % (ret))
|
||||
else:
|
||||
print('Build succeeded!')
|
||||
print('=' * 30)
|
||||
|
||||
def main():
|
||||
arguments = get_arguments()
|
||||
ret = configure_build(arguments)
|
||||
|
||||
if not ret:
|
||||
ret = build_jerry(arguments)
|
||||
|
||||
print_result(ret)
|
||||
sys.exit(ret)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
45
third_party/jerryscript/tools/check-cppcheck.sh
vendored
Executable file
45
third_party/jerryscript/tools/check-cppcheck.sh
vendored
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
if [[ "$OSTYPE" == "linux"* ]]; then
|
||||
CPPCHECK_JOBS=${CPPCHECK_JOBS:=$(nproc)}
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
CPPCHECK_JOBS=${CPPCHECK_JOBS:=$(sysctl -n hw.ncpu)}
|
||||
else
|
||||
CPPCHECK_JOBS=${CPPCHECK_JOBS:=1}
|
||||
fi
|
||||
|
||||
JERRY_CORE_DIRS=`find jerry-core -type d`
|
||||
JERRY_PORT_DEFAULT_DIRS=`find targets/default -type d`
|
||||
JERRY_LIBC_DIRS=`find jerry-libc -type d`
|
||||
JERRY_LIBM_DIRS=`find jerry-libm -type d`
|
||||
|
||||
INCLUDE_DIRS=()
|
||||
for DIR in $JERRY_CORE_DIRS $JERRY_PORT_DEFAULT_DIRS $JERRY_LIBC_DIRS $JERRY_LIBM_DIRS
|
||||
do
|
||||
INCLUDE_DIRS=("${INCLUDE_DIRS[@]}" "-I$DIR")
|
||||
done
|
||||
|
||||
cppcheck -j$CPPCHECK_JOBS --force \
|
||||
--language=c --std=c99 \
|
||||
--enable=warning,style,performance,portability,information \
|
||||
--quiet --template="{file}:{line}: {severity}({id}): {message}" \
|
||||
--error-exitcode=1 \
|
||||
--exitcode-suppressions=tools/cppcheck/suppressions-list \
|
||||
--suppressions-list=tools/cppcheck/suppressions-list \
|
||||
"${INCLUDE_DIRS[@]}" \
|
||||
jerry-core targets/default jerry-libc jerry-libm *.c *h tests/unit
|
86
third_party/jerryscript/tools/check-license.py
vendored
Executable file
86
third_party/jerryscript/tools/check-license.py
vendored
Executable file
|
@ -0,0 +1,86 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 2015-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.
|
||||
# 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.
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
|
||||
license = re.compile(
|
||||
u"""((#|//|\*) Copyright .*
|
||||
)+\s?\\2
|
||||
\s?\\2 Licensed under the Apache License, Version 2.0 \(the "License"\);
|
||||
\s?\\2 you may not use this file except in compliance with the License.
|
||||
\s?\\2 You may obtain a copy of the License at
|
||||
\s?\\2
|
||||
\s?\\2 http://www.apache.org/licenses/LICENSE-2.0
|
||||
\s?\\2
|
||||
\s?\\2 Unless required by applicable law or agreed to in writing, software
|
||||
\s?\\2 distributed under the License is distributed on an "AS IS" BASIS
|
||||
\s?\\2 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\s?\\2 See the License for the specific language governing permissions and
|
||||
\s?\\2 limitations under the License.""")
|
||||
|
||||
dirs = [
|
||||
'cmake',
|
||||
'jerry-core',
|
||||
'jerry-libc',
|
||||
'jerry-libm',
|
||||
'jerry-main',
|
||||
'targets',
|
||||
'tests',
|
||||
'tools',
|
||||
]
|
||||
|
||||
exclude_dirs = [
|
||||
'targets/esp8266'
|
||||
]
|
||||
|
||||
exts = [
|
||||
'.c',
|
||||
'.cpp',
|
||||
'.h',
|
||||
'.S',
|
||||
'.js',
|
||||
'.py',
|
||||
'.sh',
|
||||
'.tcl',
|
||||
'.cmake',
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
is_ok = True
|
||||
|
||||
for dname in dirs:
|
||||
for root, _, files in os.walk(dname):
|
||||
if any(root.startswith(exclude) for exclude in exclude_dirs):
|
||||
continue
|
||||
for fname in files:
|
||||
if any(fname.endswith(ext) for ext in exts):
|
||||
fpath = os.path.join(root, fname)
|
||||
with open(fpath) as f:
|
||||
if not license.search(f.read()):
|
||||
print('%s: incorrect license' % fpath)
|
||||
is_ok = False
|
||||
|
||||
if not is_ok:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
111
third_party/jerryscript/tools/check-signed-off.sh
vendored
Executable file
111
third_party/jerryscript/tools/check-signed-off.sh
vendored
Executable file
|
@ -0,0 +1,111 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015-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.
|
||||
# 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.
|
||||
|
||||
# Usage
|
||||
function print_usage
|
||||
{
|
||||
echo "Usage: $0 [--help] [--tolerant] [--travis]"
|
||||
}
|
||||
|
||||
function print_help
|
||||
{
|
||||
echo "$0: Check Signed-off-by message of the latest commit"
|
||||
echo ""
|
||||
print_usage
|
||||
echo ""
|
||||
echo "Optional arguments:"
|
||||
echo " --help print this help message"
|
||||
echo " --tolerant check the existence of the message only but don't"
|
||||
echo " require the name and email address to match the author"
|
||||
echo " of the commit"
|
||||
echo " --travis perform check in tolerant mode if on Travis CI and not"
|
||||
echo " checking a pull request, perform strict check otherwise"
|
||||
echo ""
|
||||
echo "The last line of every commit message must follow the form of:"
|
||||
echo "'JerryScript-DCO-1.0-Signed-off-by: NAME EMAIL', where NAME and EMAIL must"
|
||||
echo "match the name and email address of the author of the commit (unless in"
|
||||
echo "tolerant mode)."
|
||||
}
|
||||
|
||||
# Processing command line
|
||||
TOLERANT="no"
|
||||
while [ "$#" -gt 0 ]
|
||||
do
|
||||
if [ "$1" == "--help" ]
|
||||
then
|
||||
print_help
|
||||
exit 0
|
||||
elif [ "$1" == "--tolerant" ]
|
||||
then
|
||||
TOLERANT="yes"
|
||||
shift
|
||||
elif [ "$1" == "--travis" ]
|
||||
then
|
||||
if [ "$TRAVIS_PULL_REQUEST" == "" ]
|
||||
then
|
||||
echo -e "\e[1;33mWarning! Travis-tolerant mode requested but not running on Travis CI! \e[0m"
|
||||
elif [ "$TRAVIS_PULL_REQUEST" == "false" ]
|
||||
then
|
||||
TOLERANT="yes"
|
||||
else
|
||||
TOLERANT="no"
|
||||
fi
|
||||
shift
|
||||
else
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# Determining latest commit
|
||||
parent_hashes=(`git show -s --format=%p HEAD | head -1`)
|
||||
|
||||
if [ "${#parent_hashes[@]}" -eq 1 ]
|
||||
then
|
||||
commit_hash=`git show -s --format=%h HEAD | head -1`
|
||||
elif [ "${#parent_hashes[@]}" -eq 2 ]
|
||||
then
|
||||
commit_hash=${parent_hashes[1]}
|
||||
else
|
||||
echo "$0: cannot handle commit with ${#parent_hashes[@]} parents ${parent_hashes[@]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Checking the last line
|
||||
actual_signed_off_by_line=`git show -s --format=%B $commit_hash | sed '/^$/d' | tr -d '\015' | tail -n 1`
|
||||
|
||||
if [ "$TOLERANT" == "no" ]
|
||||
then
|
||||
author_name=`git show -s --format=%an $commit_hash`
|
||||
author_email=`git show -s --format=%ae $commit_hash`
|
||||
required_signed_off_by_line="JerryScript-DCO-1.0-Signed-off-by: $author_name $author_email"
|
||||
|
||||
if [ "$actual_signed_off_by_line" != "$required_signed_off_by_line" ]
|
||||
then
|
||||
echo -e "\e[1;33mSigned-off-by message is incorrect. The following line should be at the end of the $commit_hash commit's message: '$required_signed_off_by_line'. \e[0m"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo -e "\e[1;33mWarning! The name and email address of the author of the $commit_hash commit is not checked in tolerant mode! \e[0m"
|
||||
if echo "$actual_signed_off_by_line" | grep -q -v '^JerryScript-DCO-1.0-Signed-off-by:'
|
||||
then
|
||||
echo -e "\e[1;33mSigned-off-by message is incorrect. The following line should be at the end of the $commit_hash commit's message: '$required_signed_off_by_line'. \e[0m"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
32
third_party/jerryscript/tools/check-vera.sh
vendored
Executable file
32
third_party/jerryscript/tools/check-vera.sh
vendored
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015-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.
|
||||
# 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.
|
||||
|
||||
JERRY_CORE_FILES=`find ./jerry-core -name "*.c" -or -name "*.h"`
|
||||
JERRY_PORT_DEFAULT_FILES=`find ./targets/default -name "*.c" -or -name "*.h"`
|
||||
JERRY_LIBC_FILES=`find ./jerry-libc -name "*.c" -or -name "*.h"`
|
||||
JERRY_LIBM_FILES=`find ./jerry-libm -name "*.c" -or -name "*.h"`
|
||||
JERRY_MAIN_FILES=`find ./jerry-main -name "*.c" -or -name "*.h"`
|
||||
UNIT_TEST_FILES=`find ./tests/unit -name "*.c" -or -name "*.h"`
|
||||
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
MANUAL_CHECK_FILES=`find $1 -name "*.c" -or -name "*.h"`
|
||||
fi
|
||||
|
||||
vera++ -r tools/vera++ -p jerry \
|
||||
-e --no-duplicate \
|
||||
$MANUAL_CHECK_FILES $JERRY_CORE_FILES $JERRY_PORT_DEFAULT_FILES $JERRY_LIBC_FILES $JERRY_LIBM_FILES $JERRY_MAIN_FILES $UNIT_TEST_FILES
|
3
third_party/jerryscript/tools/cppcheck/suppressions-list
vendored
Normal file
3
third_party/jerryscript/tools/cppcheck/suppressions-list
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
wrongmathcall:tests/unit/test-libm.inc.h
|
||||
variableScope:jerry-libm/*.c
|
||||
invalidPointerCast:jerry-libm/*.c
|
20
third_party/jerryscript/tools/gen-test-libm.sh
vendored
Executable file
20
third_party/jerryscript/tools/gen-test-libm.sh
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
make -C tools/unit-tests build
|
||||
tools/unit-tests/gen-test-libm >tests/unit/test-libm.inc.h
|
||||
make -C tools/unit-tests clean
|
20
third_party/jerryscript/tools/generator.sh
vendored
Executable file
20
third_party/jerryscript/tools/generator.sh
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
echo "#define JERRY_MCU_SCRIPT \\" > $2
|
||||
# escape all " characters, wrap each line in double quotes and end the line with '\'
|
||||
sed 's/"/\\"/g' $1 | sed 's/^.*$/"\0" \\/g' >> $2
|
||||
echo >> $2
|
61
third_party/jerryscript/tools/make-log-perf-compare.sh
vendored
Executable file
61
third_party/jerryscript/tools/make-log-perf-compare.sh
vendored
Executable file
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
commit_first=$1
|
||||
shift
|
||||
|
||||
commit_second=$1
|
||||
shift
|
||||
|
||||
exceptions="-e '' $*"
|
||||
|
||||
if [[ "$commit_first" == "" ]] || [[ "$commit_second" == "" ]]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
perf_first=`git notes --ref=arm-linux-perf show $commit_first | grep -v $exceptions`
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
perf_second=`git notes --ref=arm-linux-perf show $commit_second | grep -v $exceptions`
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
n=0
|
||||
rel_mult=1.0
|
||||
for bench in `echo "$perf_first" | cut -d ':' -f 1`
|
||||
do
|
||||
value1=`echo "$perf_first" | grep "^$bench: " | cut -d ':' -f 2 | cut -d 's' -f 1`
|
||||
value2=`echo "$perf_second" | grep "^$bench: " | cut -d ':' -f 2 | cut -d 's' -f 1`
|
||||
rel=`echo $value1 $value2 | awk '{print $2 / $1; }'`
|
||||
percent=`echo $rel | awk '{print (1.0 - $1) * 100; }'`
|
||||
|
||||
n=`echo $n | awk '{print $1 + 1;}'`;
|
||||
rel_mult=`echo $rel_mult $rel | awk '{print $1 * $2;}'`
|
||||
|
||||
echo $bench":"$value1"s ->"$value2"s ("$percent" %)"
|
||||
done
|
||||
|
||||
rel_gmean=`echo $rel_mult $n | awk '{print $1 ^ (1.0 / $2);}'`
|
||||
percent_gmean=`echo $rel_gmean | awk '{print (1.0 - $1) * 100;}'`
|
||||
|
||||
echo
|
||||
echo $n $rel_mult $rel_gmean "("$percent_gmean "%)"
|
23
third_party/jerryscript/tools/mem-stats-measure.sh
vendored
Executable file
23
third_party/jerryscript/tools/mem-stats-measure.sh
vendored
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
JERRY=$1
|
||||
TEST=$2
|
||||
|
||||
MEM_PEAK=`$JERRY $TEST --mem-stats | grep "Peak allocated =" | awk '{print $4}'`
|
||||
|
||||
echo $MEM_PEAK
|
195
third_party/jerryscript/tools/perf.sh
vendored
Executable file
195
third_party/jerryscript/tools/perf.sh
vendored
Executable file
|
@ -0,0 +1,195 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2014-2016 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.
|
||||
|
||||
ITERS="$1"
|
||||
ENGINE="$2"
|
||||
BENCHMARK="$3"
|
||||
PRINT_MIN="$4"
|
||||
OS=`uname -s | tr [:upper:] [:lower:]`
|
||||
|
||||
if [ "$OS" == "darwin" ]
|
||||
then
|
||||
time_regexp='s/user[ ]*\([0-9]*\)m\([0-9.]*\)s/\1 \2/g'
|
||||
else
|
||||
time_regexp='s/user[ \t]*\([0-9]*\)m\([0-9.]*\)s/\1 \2/g'
|
||||
fi
|
||||
|
||||
perf_values=$( (( for i in `seq 1 1 $ITERS`; do time $ENGINE "$BENCHMARK"; if [ $? -ne 0 ]; then exit 1; fi; done ) 2>&1 ) | \
|
||||
grep user | \
|
||||
sed "$time_regexp" | \
|
||||
awk '{ print ($1 * 60 + $2); }';
|
||||
if [ ${PIPESTATUS[0]} -ne 0 ]; then exit 1; fi; );
|
||||
|
||||
if [ "$PRINT_MIN" == "-min" ]
|
||||
then
|
||||
perf_values=$( echo "$perf_values" | \
|
||||
awk "BEGIN {
|
||||
min_v = -1;
|
||||
}
|
||||
{
|
||||
if (min_v == -1 || $1 < min_v) {
|
||||
min_v = $1;
|
||||
}
|
||||
}
|
||||
END {
|
||||
print min_v
|
||||
}" || exit 1;
|
||||
);
|
||||
calc_status=$?
|
||||
else
|
||||
perf_values=$( echo "$perf_values" | \
|
||||
awk "BEGIN {
|
||||
n = 0
|
||||
}
|
||||
{
|
||||
n++
|
||||
a[n] = \$1
|
||||
}
|
||||
END {
|
||||
#
|
||||
# Values of 99% quantiles of two-sided t-distribution for given number of degrees of freedom
|
||||
#
|
||||
t_gamma_n_m1 [1] = 63.657
|
||||
t_gamma_n_m1 [2] = 9.9248
|
||||
t_gamma_n_m1 [3] = 5.8409
|
||||
t_gamma_n_m1 [4] = 4.6041
|
||||
t_gamma_n_m1 [5] = 4.0321
|
||||
t_gamma_n_m1 [6] = 3.7074
|
||||
t_gamma_n_m1 [7] = 3.4995
|
||||
t_gamma_n_m1 [8] = 3.3554
|
||||
t_gamma_n_m1 [9] = 3.2498
|
||||
t_gamma_n_m1 [10] = 3.1693
|
||||
t_gamma_n_m1 [11] = 3.1058
|
||||
t_gamma_n_m1 [12] = 3.0545
|
||||
t_gamma_n_m1 [13] = 3.0123
|
||||
t_gamma_n_m1 [14] = 2.9768
|
||||
t_gamma_n_m1 [15] = 2.9467
|
||||
t_gamma_n_m1 [16] = 2.9208
|
||||
t_gamma_n_m1 [17] = 2.8982
|
||||
t_gamma_n_m1 [18] = 2.8784
|
||||
t_gamma_n_m1 [19] = 2.8609
|
||||
t_gamma_n_m1 [20] = 2.8453
|
||||
t_gamma_n_m1 [21] = 2.8314
|
||||
t_gamma_n_m1 [22] = 2.8188
|
||||
t_gamma_n_m1 [23] = 2.8073
|
||||
t_gamma_n_m1 [24] = 2.7969
|
||||
t_gamma_n_m1 [25] = 2.7874
|
||||
t_gamma_n_m1 [26] = 2.7787
|
||||
t_gamma_n_m1 [27] = 2.7707
|
||||
t_gamma_n_m1 [28] = 2.7633
|
||||
t_gamma_n_m1 [29] = 2.7564
|
||||
t_gamma_n_m1 [30] = 2.75
|
||||
t_gamma_n_m1 [31] = 2.744
|
||||
t_gamma_n_m1 [32] = 2.7385
|
||||
t_gamma_n_m1 [33] = 2.7333
|
||||
t_gamma_n_m1 [34] = 2.7284
|
||||
t_gamma_n_m1 [35] = 2.7238
|
||||
t_gamma_n_m1 [36] = 2.7195
|
||||
t_gamma_n_m1 [37] = 2.7154
|
||||
t_gamma_n_m1 [38] = 2.7116
|
||||
t_gamma_n_m1 [39] = 2.7079
|
||||
t_gamma_n_m1 [40] = 2.7045
|
||||
t_gamma_n_m1 [41] = 2.7012
|
||||
t_gamma_n_m1 [42] = 2.6981
|
||||
t_gamma_n_m1 [43] = 2.6951
|
||||
t_gamma_n_m1 [44] = 2.6923
|
||||
t_gamma_n_m1 [45] = 2.6896
|
||||
t_gamma_n_m1 [46] = 2.687
|
||||
t_gamma_n_m1 [47] = 2.6846
|
||||
t_gamma_n_m1 [48] = 2.6822
|
||||
t_gamma_n_m1 [49] = 2.68
|
||||
t_gamma_n_m1 [50] = 2.6778
|
||||
|
||||
#
|
||||
# Sort array of measurements
|
||||
#
|
||||
for (i = 2; i <= n; i++) {
|
||||
j = i
|
||||
k = a [j]
|
||||
while (j > 1 && a [j - 1] > k) {
|
||||
a [j] = a [j - 1]
|
||||
j--
|
||||
}
|
||||
a [j] = k
|
||||
}
|
||||
|
||||
#
|
||||
# Remove 20% of lowest and 20% of highest values
|
||||
#
|
||||
n_20_percent = int (n / 5)
|
||||
|
||||
for (i = 1; i <= n_20_percent; i++) {
|
||||
delete a[n]
|
||||
n--
|
||||
}
|
||||
|
||||
for (i = 1; i <= n - n_20_percent; i++) {
|
||||
a[i] = a[i + n_20_percent]
|
||||
}
|
||||
|
||||
n -= n_20_percent
|
||||
|
||||
#
|
||||
# Calculate average
|
||||
#
|
||||
sum = 0
|
||||
for (i = 1; i <= n; i++) {
|
||||
sum += a[i]
|
||||
}
|
||||
|
||||
avg = sum / n
|
||||
|
||||
if (n > 1) {
|
||||
if (n - 1 <= 50) {
|
||||
t_coef = t_gamma_n_m1 [n - 1]
|
||||
} else {
|
||||
# For greater degrees of freedom, values of corresponding quantiles
|
||||
# are insignificantly less than the value.
|
||||
#
|
||||
# For example, the value for infinite number of freedoms is 2.5758
|
||||
#
|
||||
# So, to reduce table size, we take this, greater value,
|
||||
# overestimating inaccuracy for no more than 4%.
|
||||
#
|
||||
t_coef = t_gamma_n_m1 [50]
|
||||
}
|
||||
|
||||
#
|
||||
# Calculate inaccuracy estimation
|
||||
#
|
||||
sum_delta_squares = 0
|
||||
for (i = 1; i <= n; i++) {
|
||||
sum_delta_squares += (avg - a[i]) ^ 2
|
||||
}
|
||||
|
||||
delta = t_coef * sqrt (sum_delta_squares / (n * (n - 1)))
|
||||
|
||||
print avg, delta
|
||||
} else {
|
||||
print avg
|
||||
}
|
||||
}
|
||||
" || exit 1;
|
||||
);
|
||||
calc_status=$?
|
||||
fi
|
||||
|
||||
echo "$perf_values"
|
||||
|
||||
if [ $? -ne 0 ];
|
||||
then
|
||||
exit 1;
|
||||
fi;
|
186
third_party/jerryscript/tools/print-unicode-ranges.sh
vendored
Executable file
186
third_party/jerryscript/tools/print-unicode-ranges.sh
vendored
Executable file
|
@ -0,0 +1,186 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
#
|
||||
# http://www.unicode.org/Public/3.0-Update/UnicodeData-3.0.0.txt
|
||||
#
|
||||
|
||||
# unicode categories: Lu Ll Lt Mn Mc Me Nd Nl No Zs Zl Zp Cc Cf Cs Co Lm Lo Pc Pd Ps Pe Pi Pf Po Sm Sc Sk So
|
||||
# letter: Lu Ll Lt Lm Lo Nl
|
||||
# non-letter-indent-part:
|
||||
# digit: Nd
|
||||
# punctuation mark: Mn Mc
|
||||
# connector punctuation: Pc
|
||||
# separators: Zs
|
||||
|
||||
if [ $# -le 4 ]; then
|
||||
echo "useage: print-unicode-ranges.sh <unicode-data-path> <-i y sp|y len|n> <-cat letters|non-let-indent-parts|separators>"
|
||||
echo " -i: y sp - print interval starting points"
|
||||
echo " y len - print interval lengths"
|
||||
echo " n - print individual characters"
|
||||
echo " -cat: whether print letters|non-let-indent-parts|separators category"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STARTING_POINT="len"
|
||||
|
||||
UNICODE_DATA_PATH="$1"
|
||||
shift
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
if [ $1 == "-i" ]; then
|
||||
shift
|
||||
PRINT_INTERVALS="$1"
|
||||
if [ $PRINT_INTERVALS == "y" ]; then
|
||||
shift
|
||||
STARTING_POINT="$1"
|
||||
echo $STARTING_POINT
|
||||
fi
|
||||
elif [ $1 == "-cat" ]; then
|
||||
shift
|
||||
CATEGORY="$1"
|
||||
echo $CATEGORY
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
awk -v desired_category="$CATEGORY" \
|
||||
'BEGIN \
|
||||
{ \
|
||||
FS=";"; OFS=";" \
|
||||
} \
|
||||
{ \
|
||||
cat=$3; \
|
||||
if (desired_category == "letters" && (cat == "Lu" || cat == "Ll" || cat == "Lt" || cat == "Lm" || cat == "Lo" || cat == "Nl")) \
|
||||
{ \
|
||||
print "0x"$1, $2, $3; \
|
||||
} \
|
||||
else if (desired_category == "non-let-indent-parts" && (cat == "Nd" || cat == "Mn" || cat == "Mc" || cat == "Pc")) \
|
||||
{ \
|
||||
print "0x"$1, $2, $3; \
|
||||
} \
|
||||
else if (desired_category == "separators" && cat == "Zs") \
|
||||
{ \
|
||||
print "0x"$1, $2, $3; \
|
||||
} \
|
||||
}' $UNICODE_DATA_PATH \
|
||||
| gawk --non-decimal-data -v print_intervals="$PRINT_INTERVALS" -v sp="$STARTING_POINT" \
|
||||
'BEGIN \
|
||||
{ \
|
||||
FS = ";"; \
|
||||
OFS = ";"; \
|
||||
is_in_range = 0; \
|
||||
print_count = 0; \
|
||||
} \
|
||||
\
|
||||
function print_Nl() \
|
||||
{ \
|
||||
++print_count; \
|
||||
if (print_count == 10) \
|
||||
{ \
|
||||
printf "\n"; \
|
||||
print_count = 0; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
function output_next_range () \
|
||||
{ \
|
||||
if (range_begin != range_prev && print_intervals=="y") \
|
||||
{ \
|
||||
i1 = strtonum(range_begin); \
|
||||
i2 = strtonum(range_prev); \
|
||||
len = i2 - i1; \
|
||||
# if the length of an interval is > 255 have to spilt it into 255-lenth ones
|
||||
if (len > 255) \
|
||||
{ \
|
||||
numOfSubintervals = (len / 255); # more precisely number of subintervals - 1 \
|
||||
for (i = 1; i <= numOfSubintervals; ++i) \
|
||||
{ \
|
||||
if (sp == "sp") \
|
||||
{ \
|
||||
printf "0X%X, ", i1; \
|
||||
print_Nl(); \
|
||||
}
|
||||
else \
|
||||
{ \
|
||||
printf "%d, ", 255; \
|
||||
print_Nl(); \
|
||||
} \
|
||||
i1 = i1 + 256; # next interval begins on the ending of the previous + 1 \
|
||||
} \
|
||||
if (sp == "sp") \
|
||||
{ \
|
||||
printf "0X%X, ", i1; \
|
||||
print_Nl(); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
printf "%d, ", len % 255 - (i-1); \
|
||||
print_Nl(); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (sp == "sp") \
|
||||
{ \
|
||||
printf "%s, ", range_begin; \
|
||||
print_Nl(); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
printf "%d, ", len; \
|
||||
print_Nl(); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
else if (range_begin == range_prev && print_intervals != "y")\
|
||||
{ \
|
||||
printf "%s, ", range_begin; \
|
||||
print_Nl(); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
{ \
|
||||
if (is_in_range == 0) \
|
||||
{ \
|
||||
is_in_range = 1; \
|
||||
range_begin = $1; \
|
||||
range_prev = $1; \
|
||||
range_begin_name = $2; \
|
||||
range_prev_name = $2; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (range_prev + 1 == $1) \
|
||||
{ \
|
||||
range_prev = $1; \
|
||||
range_prev_name = $2
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
output_next_range(); \
|
||||
range_begin = $1; \
|
||||
range_prev=$1; \
|
||||
range_begin_name = $2; \
|
||||
range_prev_name = $2; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
END \
|
||||
{ \
|
||||
output_next_range(); \
|
||||
}'
|
67
third_party/jerryscript/tools/rss-measure.sh
vendored
Executable file
67
third_party/jerryscript/tools/rss-measure.sh
vendored
Executable file
|
@ -0,0 +1,67 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
JERRY=$1
|
||||
TEST=$2
|
||||
SLEEP=0.1
|
||||
OS=`uname -s | tr [:upper:] [:lower:]`
|
||||
|
||||
Rss_OUT=""
|
||||
|
||||
function collect_entry()
|
||||
{
|
||||
OUT_NAME="$1_OUT";
|
||||
OUT=$OUT_NAME;
|
||||
|
||||
if [ "$OS" == "darwin" ]
|
||||
then
|
||||
SUM=`ps -o rss $PID | grep [0-9]`
|
||||
else
|
||||
SUM=$(grep -o -e "^[0-9a-f][0-9a-f]*.*" -e "^Rss.*" /proc/$PID/smaps 2>/dev/null | grep -A 1 -- "r[w-]-p " | grep "^Rss"|awk '{s += $2;} END {print s;}')
|
||||
fi;
|
||||
|
||||
if [ "$SUM" != "" ];
|
||||
then
|
||||
eval "$OUT=\"\$$OUT $SUM\\n\"";
|
||||
fi;
|
||||
}
|
||||
|
||||
function print_entry()
|
||||
{
|
||||
OUT_NAME="$1_OUT";
|
||||
OUT=$OUT_NAME;
|
||||
|
||||
eval "echo -e \"\$$OUT\"" | awk -v entry="$1" '{ if ($1 != "") { n += 1; if ($1 > max) { max = $1; } } } END { if (n == 0) { exit; }; printf "%d\n", max; }';
|
||||
}
|
||||
|
||||
function run_test()
|
||||
{
|
||||
$JERRY $TEST &
|
||||
PID=$!
|
||||
|
||||
while kill -0 "$PID" > /dev/null 2>&1;
|
||||
do
|
||||
collect_entry Rss
|
||||
|
||||
sleep $SLEEP
|
||||
done
|
||||
|
||||
wait "$PID" || exit 1
|
||||
}
|
||||
|
||||
run_test
|
||||
|
||||
print_entry Rss
|
85
third_party/jerryscript/tools/run-mem-stats-test.sh
vendored
Executable file
85
third_party/jerryscript/tools/run-mem-stats-test.sh
vendored
Executable file
|
@ -0,0 +1,85 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015-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.
|
||||
# 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.
|
||||
|
||||
# Choosing table or semicolon-separated output mode
|
||||
if [ "$1" == "-d" ]
|
||||
then
|
||||
TABLE="no"
|
||||
PRINT_TEST_NAME_AWK_SCRIPT='{printf "%s;", $1}'
|
||||
PRINT_TOTAL_AWK_SCRIPT='{printf "%d;%d;%d\n", $1, $2, $3 * 1024}'
|
||||
|
||||
shift
|
||||
else
|
||||
PRINT_TEST_NAME_AWK_SCRIPT='{printf "%30s", $1}'
|
||||
PRINT_TOTAL_AWK_SCRIPT='{printf "%25d%25d%25d\n", $1, $2, $3 * 1024}'
|
||||
TABLE="yes"
|
||||
fi
|
||||
|
||||
function fail_msg
|
||||
{
|
||||
echo "$1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Engine
|
||||
|
||||
# Check if the specified build supports memory statistics options
|
||||
function is_mem_stats_build
|
||||
{
|
||||
[ -x "$1" ] || fail_msg "Engine '$1' is not executable"
|
||||
|
||||
tmpfile=`mktemp`
|
||||
"$1" --mem-stats $tmpfile 2>&1 | grep -- "Ignoring JERRY_INIT_MEM_STATS flag because of !JMEM_STATS configuration." 2>&1 > /dev/null
|
||||
code=$?
|
||||
rm $tmpfile
|
||||
|
||||
return $code
|
||||
}
|
||||
|
||||
JERRY="$1"
|
||||
shift
|
||||
is_mem_stats_build "$JERRY" || fail_msg "First engine specified should be built without memory statistics support"
|
||||
|
||||
JERRY_MEM_STATS="$1"
|
||||
shift
|
||||
is_mem_stats_build "$JERRY_MEM_STATS" && fail_msg "Second engine specified should be built with memory statistics support"
|
||||
|
||||
# Benchmarks list
|
||||
BENCHMARKS=""
|
||||
|
||||
while [ $# -ne 0 ]
|
||||
do
|
||||
BENCHMARKS="$BENCHMARKS $1"
|
||||
shift
|
||||
done
|
||||
|
||||
# Running
|
||||
if [ "$TABLE" == "yes" ]
|
||||
then
|
||||
awk 'BEGIN {printf "%30s%25s%25s%25s\n", "Test name", "Peak Heap (parser)", "Peak Heap (execution)", "Maximum RSS"}'
|
||||
echo
|
||||
fi
|
||||
|
||||
for bench in $BENCHMARKS
|
||||
do
|
||||
test=`basename $bench .js`
|
||||
|
||||
echo "$test" | awk "$PRINT_TEST_NAME_AWK_SCRIPT"
|
||||
MEM_STATS=$("$JERRY_MEM_STATS" --mem-stats --mem-stats-separate $bench | grep -e "Peak allocated =" | grep -o "[0-9]*")
|
||||
RSS=$(./tools/rss-measure.sh "$JERRY" $bench | tail -n 1 | grep -o "[0-9]*")
|
||||
echo $MEM_STATS $RSS | xargs | awk "$PRINT_TOTAL_AWK_SCRIPT"
|
||||
done
|
349
third_party/jerryscript/tools/run-perf-test.sh
vendored
Executable file
349
third_party/jerryscript/tools/run-perf-test.sh
vendored
Executable file
|
@ -0,0 +1,349 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
|
||||
trap "exit 2" INT
|
||||
|
||||
function pr_err() {
|
||||
echo -e "\e[91mError: $@\e[39m"
|
||||
}
|
||||
|
||||
function exit_err() {
|
||||
pr_err $@
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Check if the specified build supports memory statistics options
|
||||
function is_mem_stats_build() {
|
||||
[ -x "$1" ] || fail_msg "Engine '$1' is not executable"
|
||||
|
||||
tmpfile=`mktemp`
|
||||
"$1" --mem-stats $tmpfile 2>&1 | grep -- "Ignoring JERRY_INIT_MEM_STATS flag because of !JMEM_STATS configuration." 2>&1 > /dev/null
|
||||
code=$?
|
||||
rm $tmpfile
|
||||
|
||||
return $code
|
||||
}
|
||||
|
||||
USAGE="Usage:\n tools/run-perf-test.sh OLD_ENGINE NEW_ENGINE REPEATS TIMEOUT BENCH_FOLDER [-m result-file-name.md]"
|
||||
|
||||
if [ "$#" -lt 5 ]
|
||||
then
|
||||
echo -e "${USAGE}"
|
||||
exit_err "Argument number mismatch..."
|
||||
fi
|
||||
|
||||
ENGINE_OLD="$1"
|
||||
ENGINE_NEW="$2"
|
||||
REPEATS="$3"
|
||||
TIMEOUT="$4"
|
||||
BENCH_FOLDER="$5"
|
||||
OUTPUT_FORMAT="$6"
|
||||
OUTPUT_FILE="$7"
|
||||
|
||||
if [ "$#" -gt 5 ]
|
||||
then
|
||||
if [ "${OUTPUT_FORMAT}" != "-m" ]
|
||||
then
|
||||
exit_err "Please, use '-m result-file-name.md' as last arguments"
|
||||
fi
|
||||
if [ -z "${OUTPUT_FILE}" ]
|
||||
then
|
||||
exit_err "Missing md file name. Please, define the filename. Ex.: '-m result-file-name.md'"
|
||||
fi
|
||||
|
||||
rm -rf "${OUTPUT_FILE}"
|
||||
fi
|
||||
|
||||
if [ "${REPEATS}" -lt 1 ]
|
||||
then
|
||||
exit_err "REPEATS must be greater than 0"
|
||||
fi
|
||||
|
||||
if [ "${TIMEOUT}" -lt 1 ]
|
||||
then
|
||||
exit_err "TIMEOUT must be greater than 0"
|
||||
fi
|
||||
|
||||
perf_n=0
|
||||
mem_n=0
|
||||
|
||||
perf_rel_mult=1.0
|
||||
perf_rel_inaccuracy_tmp=0
|
||||
mem_rel_mult=1.0
|
||||
mem_rel_inaccuracy_tmp="-1"
|
||||
|
||||
# Unicode "figure space" character
|
||||
FIGURE_SPACE=$(echo -e -n "\xE2\x80\x87")
|
||||
|
||||
# Unicode "approximately equal" character
|
||||
APPROXIMATELY_EQUAL=$(echo -n -e "\xE2\x89\x88")
|
||||
|
||||
function run-compare()
|
||||
{
|
||||
COMMAND=$1
|
||||
PRE=$2
|
||||
TEST=$3
|
||||
PRECISION=$4
|
||||
UNIT=$5
|
||||
|
||||
ABS_FP_FMT="%$((PRECISION + 4)).$((PRECISION))f$UNIT"
|
||||
REL_FP_FMT="%0.3f"
|
||||
REL_SHOW_PLUS_SIGN_FP_FMT="%+0.3f"
|
||||
|
||||
OLD=$(timeout "${TIMEOUT}" ${COMMAND} "${ENGINE_OLD}" "${TEST}") || return 1
|
||||
NEW=$(timeout "${TIMEOUT}" ${COMMAND} "${ENGINE_NEW}" "${TEST}") || return 1
|
||||
|
||||
#check result
|
||||
! $OLD || ! $NEW || return 1
|
||||
|
||||
OLD_value=$(echo "$OLD " | cut -d ' ' -f 1)
|
||||
OLD_inaccuracy=$(echo "$OLD " | cut -d ' ' -f 2)
|
||||
|
||||
NEW_value=$(echo "$NEW " | cut -d ' ' -f 1)
|
||||
NEW_inaccuracy=$(echo "$NEW " | cut -d ' ' -f 2)
|
||||
|
||||
#calc relative speedup
|
||||
eval "rel_mult=\$${PRE}_rel_mult"
|
||||
|
||||
rel=$(echo "${OLD_value}" "${NEW_value}" | awk '{ print $2 / $1; }')
|
||||
|
||||
#increment n
|
||||
((${PRE}_n++))
|
||||
|
||||
#calc percent to display
|
||||
PERCENT=$(echo "$rel" | awk '{print (1.0 - $1) * 100; }')
|
||||
|
||||
if [[ "$OLD_inaccuracy" != "" && "$NEW_inaccuracy" != "" ]]
|
||||
then
|
||||
DIFF=$(printf "$ABS_FP_FMT -> $ABS_FP_FMT" $OLD_value $NEW_value)
|
||||
rel_inaccuracy=$(echo "$OLD_value $OLD_inaccuracy $NEW_value $NEW_inaccuracy" | \
|
||||
awk "{
|
||||
OLD_value=\$1
|
||||
OLD_inaccuracy=\$2
|
||||
NEW_value=\$3
|
||||
NEW_inaccuracy=\$4
|
||||
|
||||
rel_inaccuracy = (NEW_value / OLD_value) * sqrt ((OLD_inaccuracy / OLD_value) ^ 2 + (NEW_inaccuracy / NEW_value) ^ 2)
|
||||
if (rel_inaccuracy < 0) {
|
||||
rel_inaccuracy = -rel_inaccuracy
|
||||
}
|
||||
|
||||
print rel_inaccuracy
|
||||
}")
|
||||
PERCENT_inaccuracy=$(echo "$rel_inaccuracy" | awk '{ print $1 * 100.0 }')
|
||||
|
||||
ext=$(echo "$PERCENT $PERCENT_inaccuracy" | \
|
||||
awk "{
|
||||
PERCENT=\$1
|
||||
PERCENT_inaccuracy=\$2
|
||||
|
||||
if (PERCENT > 0.0 && PERCENT > PERCENT_inaccuracy) {
|
||||
print \"[+]\"
|
||||
} else if (PERCENT < 0 && -PERCENT > PERCENT_inaccuracy) {
|
||||
print \"[-]\"
|
||||
} else {
|
||||
print \"[$APPROXIMATELY_EQUAL]\"
|
||||
}
|
||||
}")
|
||||
|
||||
if [[ $rel_inaccuracy_tmp -lt 0 ]]
|
||||
then
|
||||
return 1
|
||||
fi
|
||||
|
||||
eval "rel_inaccuracy_tmp=\$${PRE}_rel_inaccuracy_tmp"
|
||||
|
||||
rel_inaccuracy_tmp=$(echo "$rel $rel_inaccuracy $rel_inaccuracy_tmp" | \
|
||||
awk "{
|
||||
rel=\$1
|
||||
rel_inaccuracy=\$2
|
||||
rel_inaccuracy_tmp=\$3
|
||||
print rel_inaccuracy_tmp + (rel_inaccuracy / rel) ^ 2
|
||||
}")
|
||||
|
||||
eval "${PRE}_rel_inaccuracy_tmp=\$rel_inaccuracy_tmp"
|
||||
|
||||
PERCENT=$(printf "%8s %11s" $(printf "$REL_SHOW_PLUS_SIGN_FP_FMT%%" $PERCENT) $(printf "(+-$REL_FP_FMT%%)" $PERCENT_inaccuracy))
|
||||
PERCENT="$PERCENT : $ext"
|
||||
|
||||
if [ "${OUTPUT_FORMAT}" == "-m" ]
|
||||
then
|
||||
WIDTH=42
|
||||
MD_DIFF=$(printf "%s%s" "$DIFF" "$(printf "%$(($WIDTH - ${#DIFF}))s")")
|
||||
MD_PERCENT=$(printf "%s%s" "$(printf "%$(($WIDTH - ${#PERCENT}))s")" "$PERCENT")
|
||||
|
||||
MD_FORMAT="\`%s\`<br>\`%s\`"
|
||||
fi
|
||||
|
||||
CONSOLE_FORMAT="%20s : %19s"
|
||||
else
|
||||
ext=""
|
||||
|
||||
if [[ "$OLD_inaccuracy" != "" || "$NEW_inaccuracy" != "" ]]
|
||||
then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
DIFF=$(printf "$ABS_FP_FMT -> $ABS_FP_FMT" $OLD_value $NEW_value)
|
||||
PERCENT=$(printf "$REL_SHOW_PLUS_SIGN_FP_FMT%%" $PERCENT)
|
||||
|
||||
if [ "${OUTPUT_FORMAT}" == "-m" ]
|
||||
then
|
||||
WIDTH=20
|
||||
MD_DIFF=$(printf "%s%s" "$DIFF" "$(printf "%$(($WIDTH - ${#DIFF}))s")")
|
||||
MD_PERCENT=$(printf "%s%s" "$(printf "%$(($WIDTH - ${#PERCENT}))s")" "$PERCENT")
|
||||
|
||||
MD_FORMAT="\`%s\`<br>\`%s\`"
|
||||
fi
|
||||
|
||||
CONSOLE_FORMAT="%14s : %8s"
|
||||
fi
|
||||
|
||||
rel_mult=$(echo "$rel_mult" "$rel" | awk '{print $1 * $2;}')
|
||||
|
||||
eval "${PRE}_rel_mult=\$rel_mult"
|
||||
|
||||
if [ "${OUTPUT_FORMAT}" == "-m" ]
|
||||
then
|
||||
printf "$MD_FORMAT" "$MD_DIFF" "$MD_PERCENT" | sed "s/ /$FIGURE_SPACE/g" >> "${OUTPUT_FILE}"
|
||||
fi
|
||||
|
||||
printf "$CONSOLE_FORMAT" "$DIFF" "$PERCENT"
|
||||
}
|
||||
|
||||
function run-test()
|
||||
{
|
||||
TEST=$1
|
||||
|
||||
# print only filename
|
||||
if [ "${OUTPUT_FORMAT}" == "-m" ]
|
||||
then
|
||||
printf "%s | " "${TEST##*/}" >> "${OUTPUT_FILE}"
|
||||
fi
|
||||
|
||||
printf "%50s | " "${TEST##*/}"
|
||||
|
||||
if [ "$IS_MEM_STAT" -ne 0 ]
|
||||
then
|
||||
run-compare "./tools/mem-stats-measure.sh" "mem" "${TEST}" 0 || return 1
|
||||
else
|
||||
run-compare "./tools/rss-measure.sh" "mem" "${TEST}" 0 k || return 1
|
||||
fi
|
||||
|
||||
if [ "${OUTPUT_FORMAT}" == "-m" ]
|
||||
then
|
||||
printf " | " >> "${OUTPUT_FILE}"
|
||||
fi
|
||||
|
||||
printf " | "
|
||||
run-compare "./tools/perf.sh ${REPEATS}" "perf" "${TEST}" 3 s || return 1
|
||||
|
||||
if [ "${OUTPUT_FORMAT}" == "-m" ]
|
||||
then
|
||||
printf "\n" >> "${OUTPUT_FILE}"
|
||||
fi
|
||||
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
function run-suite()
|
||||
{
|
||||
FOLDER=$1
|
||||
|
||||
for BENCHMARK in ${FOLDER}/*.js
|
||||
do
|
||||
run-test "${BENCHMARK}" 2> /dev/null || printf "<FAILED>\n" "${BENCHMARK}";
|
||||
done
|
||||
}
|
||||
|
||||
date
|
||||
|
||||
is_mem_stats_build "${ENGINE_OLD}" || is_mem_stats_build "${ENGINE_NEW}"
|
||||
IS_MEM_STAT=$?
|
||||
|
||||
if [ "${OUTPUT_FORMAT}" == "-m" ]
|
||||
then
|
||||
if [ "$IS_MEM_STAT" -ne 0 ]
|
||||
then
|
||||
echo "Benchmark | Peak alloc.<br>(+ is better) | Perf<br>(+ is better)" >> "${OUTPUT_FILE}"
|
||||
else
|
||||
echo "Benchmark | RSS<br>(+ is better) | Perf<br>(+ is better)" >> "${OUTPUT_FILE}"
|
||||
fi
|
||||
echo "---------: | --------- | ---------" >> "${OUTPUT_FILE}"
|
||||
fi
|
||||
|
||||
if [ "$IS_MEM_STAT" -ne 0 ]
|
||||
then
|
||||
printf "%50s | %25s | %35s\n" "Benchmark" "Peak alloc.(+ is better)" "Perf(+ is better)"
|
||||
else
|
||||
printf "%50s | %25s | %35s\n" "Benchmark" "RSS(+ is better)" "Perf(+ is better)"
|
||||
fi
|
||||
|
||||
run-suite "${BENCH_FOLDER}"
|
||||
|
||||
mem_rel_gmean=$(echo "$mem_rel_mult" "$mem_n" | awk '{print $1 ^ (1.0 / $2);}')
|
||||
mem_percent_gmean=$(echo "$mem_rel_gmean" | awk '{print (1.0 - $1) * 100;}')
|
||||
if [[ $mem_rel_inaccuracy_tmp != "-1" ]]
|
||||
then
|
||||
exit_err "Incorrect inaccuracy calculation for memory consumption geometric mean"
|
||||
fi
|
||||
|
||||
perf_rel_gmean=$(echo "$perf_rel_mult" "$perf_n" | awk '{print $1 ^ (1.0 / $2);}')
|
||||
perf_percent_gmean=$(echo "$perf_rel_gmean" | awk '{print (1.0 - $1) * 100;}')
|
||||
if [[ "$perf_rel_inaccuracy_tmp" == "-1" ]]
|
||||
then
|
||||
exit_err "Incorrect inaccuracy calculation for performance geometric mean"
|
||||
else
|
||||
perf_percent_inaccuracy=$(echo "$perf_rel_gmean $perf_rel_inaccuracy_tmp $perf_n" | \
|
||||
awk "{
|
||||
perf_rel_gmean=\$1
|
||||
perf_rel_inaccuracy_tmp=\$2
|
||||
perf_n=\$3
|
||||
|
||||
print 100.0 * (perf_rel_gmean ^ (1.0 / perf_n) * sqrt (perf_rel_inaccuracy_tmp) / perf_n)
|
||||
}")
|
||||
perf_ext=$(echo "$perf_percent_gmean $perf_percent_inaccuracy" | \
|
||||
awk "{
|
||||
perf_percent_gmean=\$1
|
||||
perf_percent_inaccuracy=\$2
|
||||
|
||||
if (perf_percent_gmean > 0.0 && perf_percent_gmean > perf_percent_inaccuracy) {
|
||||
print \"[+]\"
|
||||
} else if (perf_percent_gmean < 0 && -perf_percent_gmean > perf_percent_inaccuracy) {
|
||||
print \"[-]\"
|
||||
} else {
|
||||
print \"[$APPROXIMATELY_EQUAL]\"
|
||||
}
|
||||
}")
|
||||
perf_percent_inaccuracy=$(printf "(+-%0.3f%%) : $perf_ext" $perf_percent_inaccuracy)
|
||||
fi
|
||||
|
||||
gmean_label_text="Geometric mean:"
|
||||
|
||||
if [ "${OUTPUT_FORMAT}" == "-m" ]
|
||||
then
|
||||
mem_percent_gmean_text=$(printf "RSS reduction: \`%0.3f%%\`" "$mem_percent_gmean")
|
||||
perf_percent_gmean_text=$(printf "Speed up: \`%0.3f%% %s\`" "$perf_percent_gmean" "$perf_percent_inaccuracy")
|
||||
printf "%s | %s | %s\n" "$gmean_label_text" "$mem_percent_gmean_text" "$perf_percent_gmean_text" >> "${OUTPUT_FILE}"
|
||||
fi
|
||||
|
||||
mem_percent_gmean_text=$(printf "RSS reduction: %0.3f%%" "$mem_percent_gmean")
|
||||
perf_percent_gmean_text=$(printf "Speed up: %0.3f%% %s" "$perf_percent_gmean" "$perf_percent_inaccuracy")
|
||||
printf "%50s | %25s | %51s\n" "$gmean_label_text" "$mem_percent_gmean_text" "$perf_percent_gmean_text"
|
||||
|
||||
date
|
222
third_party/jerryscript/tools/run-tests.py
vendored
Executable file
222
third_party/jerryscript/tools/run-tests.py
vendored
Executable file
|
@ -0,0 +1,222 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from settings import *
|
||||
|
||||
OUTPUT_DIR = path.join(PROJECT_DIR, 'build', 'tests')
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--toolchain', action='store', default='', help='Add toolchain file')
|
||||
parser.add_argument('--outdir', action='store', default=OUTPUT_DIR, help='Specify output directory (default: %(default)s)')
|
||||
parser.add_argument('--check-signed-off', action='store_true', default=False, help='Run signed-off check')
|
||||
parser.add_argument('--check-signed-off-tolerant', action='store_true', default=False, help='Run signed-off check in tolerant mode')
|
||||
parser.add_argument('--check-signed-off-travis', action='store_true', default=False, help='Run signed-off check in tolerant mode if on Travis CI and not checking a pull request')
|
||||
parser.add_argument('--check-cppcheck', action='store_true', default=False, help='Run cppcheck')
|
||||
parser.add_argument('--check-vera', action='store_true', default=False, help='Run vera check')
|
||||
parser.add_argument('--check-license', action='store_true', default=False, help='Run license check')
|
||||
parser.add_argument('--buildoption-test', action='store_true', default=False, help='Run buildoption-test')
|
||||
parser.add_argument('--jerry-tests', action='store_true', default=False, help='Run jerry-tests')
|
||||
parser.add_argument('--jerry-test-suite', action='store_true', default=False, help='Run jerry-test-suite')
|
||||
parser.add_argument('--unittests', action='store_true', default=False, help='Run unittests')
|
||||
parser.add_argument('--precommit', action='store_true', default=False, dest='all', help='Run all test')
|
||||
|
||||
if len(sys.argv) == 1:
|
||||
parser.print_help()
|
||||
sys.exit(1)
|
||||
|
||||
script_args = parser.parse_args()
|
||||
|
||||
if path.isabs(script_args.outdir):
|
||||
OUTPUT_DIR = script_args.outdir
|
||||
else:
|
||||
OUTPUT_DIR = path.join(PROJECT_DIR, script_args.outdir)
|
||||
|
||||
class Options:
|
||||
out_dir = ''
|
||||
build_args = []
|
||||
test_args = []
|
||||
|
||||
def __init__(self, name = '', build_args = [], test_args = []):
|
||||
self.out_dir = path.join(OUTPUT_DIR, name)
|
||||
self.build_args = build_args
|
||||
self.build_args.append('--builddir=%s' % self.out_dir)
|
||||
self.test_args = test_args
|
||||
|
||||
|
||||
# Test options for unittests
|
||||
jerry_unittests_options = [
|
||||
Options('unittests', ['--unittests', '--error-messages=on', '--snapshot-save=on', '--snapshot-exec=on']),
|
||||
Options('unittests-debug', ['--unittests', '--debug', '--error-messages=on', '--snapshot-save=on', '--snapshot-exec=on']),
|
||||
]
|
||||
|
||||
# Test options for jerry-tests
|
||||
jerry_tests_options = [
|
||||
Options('jerry_tests'),
|
||||
Options('jerry_tests-snapshot', ['--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']),
|
||||
Options('jerry_tests-debug', ['--debug']),
|
||||
Options('jerry_tests-debug-snapshot', ['--debug', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']),
|
||||
]
|
||||
|
||||
# Test options for jerry-test-suite
|
||||
jerry_test_suite_options = jerry_tests_options[:]
|
||||
jerry_test_suite_options.append(Options('jerry_test_suite-minimal', ['--profile=minimal']))
|
||||
jerry_test_suite_options.append(Options('jerry_test_suite-minimal-snapshot', ['--profile=minimal', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']))
|
||||
jerry_test_suite_options.append(Options('jerry_test_suite-minimal-debug', ['--debug', '--profile=minimal']))
|
||||
jerry_test_suite_options.append(Options('jerry_test_suite-minimal-debug-snapshot', ['--debug', '--profile=minimal', '--snapshot-save=on', '--snapshot-exec=on'], ['--snapshot']))
|
||||
|
||||
# Test options for buildoption-test
|
||||
jerry_buildoptions = [
|
||||
Options('buildoption_test-lto', ['--lto=on']),
|
||||
Options('buildoption_test-error_messages', ['--error-messages=on']),
|
||||
Options('buildoption_test-all_in_one', ['--all-in-one=on']),
|
||||
Options('buildoption_test-valgrind', ['--valgrind=on']),
|
||||
Options('buildoption_test-valgrind_freya', ['--valgrind-freya=on']),
|
||||
Options('buildoption_test-mem_stats', ['--mem-stats=on']),
|
||||
Options('buildoption_test-show_opcodes', ['--show-opcodes=on']),
|
||||
Options('buildoption_test-show_regexp_opcodes', ['--show-regexp-opcodes=on']),
|
||||
Options('buildoption_test-compiler_default_libc', ['--jerry-libc=off']),
|
||||
]
|
||||
|
||||
def get_bin_dir_path(out_dir):
|
||||
return path.join(out_dir, 'bin')
|
||||
|
||||
def get_binary_path(out_dir):
|
||||
return path.join(get_bin_dir_path(out_dir), 'jerry')
|
||||
|
||||
def create_binary(buildoptions):
|
||||
build_cmd = [BUILD_SCRIPT]
|
||||
build_cmd.extend(buildoptions)
|
||||
|
||||
if script_args.toolchain:
|
||||
build_cmd.append('--toolchain=%s' % script_args.toolchain)
|
||||
|
||||
sys.stderr.write('Build command: %s\n' % ' '.join(build_cmd))
|
||||
|
||||
try:
|
||||
script_output = subprocess.check_output(build_cmd)
|
||||
except subprocess.CalledProcessError as e:
|
||||
return e.returncode
|
||||
|
||||
return 0
|
||||
|
||||
def run_check(runnable):
|
||||
sys.stderr.write('Test command: %s\n' % ' '.join(runnable))
|
||||
|
||||
try:
|
||||
ret = subprocess.check_call(runnable)
|
||||
except subprocess.CalledProcessError as e:
|
||||
return e.returncode
|
||||
|
||||
return ret
|
||||
|
||||
def run_jerry_tests():
|
||||
ret_build = ret_test = 0
|
||||
for job in jerry_tests_options:
|
||||
ret_build = create_binary(job.build_args)
|
||||
if ret_build:
|
||||
break
|
||||
|
||||
test_cmd = [TEST_RUNNER_SCRIPT, get_binary_path(job.out_dir), JERRY_TESTS_DIR]
|
||||
if job.test_args:
|
||||
test_cmd.extend(job.test_args)
|
||||
|
||||
ret_test |= run_check(test_cmd)
|
||||
|
||||
return ret_build | ret_test
|
||||
|
||||
def run_jerry_test_suite():
|
||||
ret_build = ret_test = 0
|
||||
for job in jerry_test_suite_options:
|
||||
ret_build = create_binary(job.build_args)
|
||||
if ret_build:
|
||||
break
|
||||
|
||||
test_cmd = [TEST_RUNNER_SCRIPT, get_binary_path(job.out_dir)]
|
||||
|
||||
if '--profile=minimal' in job.build_args:
|
||||
test_cmd.append(JERRY_TEST_SUITE_MINIMAL_LIST)
|
||||
else:
|
||||
test_cmd.append(JERRY_TEST_SUITE_DIR)
|
||||
|
||||
if job.test_args:
|
||||
test_cmd.extend(job.test_args)
|
||||
|
||||
ret_test |= run_check(test_cmd)
|
||||
|
||||
return ret_build | ret_test
|
||||
|
||||
def run_unittests():
|
||||
ret_build = ret_test = 0
|
||||
for job in jerry_unittests_options:
|
||||
ret_build = create_binary(job.build_args)
|
||||
if ret_build:
|
||||
break
|
||||
|
||||
ret_test |= run_check([UNITTEST_RUNNER_SCRIPT, get_bin_dir_path(job.out_dir)])
|
||||
|
||||
return ret_build | ret_test
|
||||
|
||||
def run_buildoption_test():
|
||||
for job in jerry_buildoptions:
|
||||
ret = create_binary(job.build_args)
|
||||
if ret:
|
||||
break
|
||||
|
||||
return ret
|
||||
|
||||
def main():
|
||||
ret = 0
|
||||
|
||||
if script_args.check_signed_off_tolerant:
|
||||
ret = run_check([SIGNED_OFF_SCRIPT, '--tolerant'])
|
||||
|
||||
if not ret and script_args.check_signed_off_travis:
|
||||
ret = run_check([SIGNED_OFF_SCRIPT, '--travis'])
|
||||
|
||||
if not ret and (script_args.all or script_args.check_signed_off):
|
||||
ret = run_check([SIGNED_OFF_SCRIPT])
|
||||
|
||||
if not ret and (script_args.all or script_args.check_cppcheck):
|
||||
ret = run_check([CPPCHECK_SCRIPT])
|
||||
|
||||
if not ret and (script_args.all or script_args.check_vera):
|
||||
ret = run_check([VERA_SCRIPT])
|
||||
|
||||
if not ret and (script_args.all or script_args.check_license):
|
||||
ret = run_check([LICENSE_SCRIPT])
|
||||
|
||||
if not ret and (script_args.all or script_args.jerry_tests):
|
||||
ret = run_jerry_tests()
|
||||
|
||||
if not ret and (script_args.all or script_args.jerry_test_suite):
|
||||
ret = run_jerry_test_suite()
|
||||
|
||||
if not ret and (script_args.all or script_args.unittests):
|
||||
ret = run_unittests()
|
||||
|
||||
if not ret and (script_args.all or script_args.buildoption_test):
|
||||
ret = run_buildoption_test()
|
||||
|
||||
sys.exit(ret)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
56
third_party/jerryscript/tools/runners/run-benchmarks.sh
vendored
Executable file
56
third_party/jerryscript/tools/runners/run-benchmarks.sh
vendored
Executable file
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
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
third_party/jerryscript/tools/runners/run-stability-test.sh
vendored
Executable file
41
third_party/jerryscript/tools/runners/run-stability-test.sh
vendored
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
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
|
118
third_party/jerryscript/tools/runners/run-test-suite-test262.sh
vendored
Executable file
118
third_party/jerryscript/tools/runners/run-test-suite-test262.sh
vendored
Executable file
|
@ -0,0 +1,118 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
ENGINE="$1"
|
||||
PATH_TO_TEST262="$2"
|
||||
REPORT_PREFIX="report"
|
||||
RUN_PIDS=""
|
||||
RESULT_OK=1
|
||||
TIMEOUT="5s"
|
||||
|
||||
if [ $# -lt 2 ]
|
||||
then
|
||||
echo "This script performs parallel test262 compliance testing of the specified engine."
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " 1st parameter: JavaScript engine to be tested."
|
||||
echo " 2nd parameter: path to the directory with official test262 testsuite."
|
||||
echo " 3rd parameter: (optional) call this script with the '--sub-chapters' flag to print the detailed report."
|
||||
echo ""
|
||||
echo "Example:"
|
||||
echo " ./run-test-suite-test262.sh <engine> <test262_dir> --sub-chapters"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
rm "${REPORT_PREFIX}".* &> /dev/null
|
||||
|
||||
declare -a CHAPTER07_TO_TEST=("7.1" "7.2" "7.3" "7.4" "7.5" "7.6" "7.6.1" "7.7" \
|
||||
"7.8" "7.8.1" "7.8.2" "7.8.3" "7.8.4" "7.8.5" "7.9" "7.9.2")
|
||||
declare -a CHAPTER08_TO_TEST=("8.1" "8.2" "8.3" "8.4" "8.5" "8.6" "8.6.1" "8.6.2" "8.7" "8.7.1" "8.7.2" "8.8" "8.12" \
|
||||
"8.12.1" "8.12.3" "8.12.4" "8.12.5" "8.12.6" "8.12.7" "8.12.8" "8.12.9")
|
||||
declare -a CHAPTER09_TO_TEST=("9.1" "9.2" "9.3" "9.3.1" "9.4" "9.5" "9.6" "9.7" "9.8" "9.8.1" "9.9")
|
||||
declare -a CHAPTER10_TO_TEST=("10.1" "10.1.1" "10.2" "10.2.1" "10.2.2" "10.2.3" "10.3" "10.3.1" "10.4" "10.4.1" \
|
||||
"10.4.2" "10.4.3" "10.5" "10.6")
|
||||
declare -a CHAPTER11_TO_TEST=("11.1" "11.1.1" "11.1.2" "11.1.3" "11.1.4" "11.1.5" "11.1.6" "11.2" "11.2.1" "11.2.2" \
|
||||
"11.2.3" "11.2.4" "11.3" "11.3.1" "11.3.2" "11.4" "11.4.1" "11.4.2" "11.4.3" \
|
||||
"11.4.4" "11.4.5" "11.4.6" "11.4.7" "11.4.8" "11.4.9" "11.5" "11.5.1" "11.5.2" "11.5.3" \
|
||||
"11.6" "11.6.1" "11.6.2" "11.7" "11.7.1" "11.7.2" "11.7.3" "11.8" "11.8.1" "11.8.2" \
|
||||
"11.8.3" "11.8.4" "11.8.6" "11.8.7" "11.9" "11.9.1" "11.9.2" "11.9.4" "11.9.5" "11.10" \
|
||||
"11.11" "11.12" "11.13" "11.13.1" "11.13.2" "11.14")
|
||||
declare -a CHAPTER12_TO_TEST=("12.1" "12.2" "12.2.1" "12.3" "12.4" "12.5" "12.6" "12.6.1" "12.6.2" "12.6.3" "12.6.4" \
|
||||
"12.7" "12.8" "12.9" "12.10" "12.10.1" "12.11" "12.12" "12.13" "12.14" "12.14.1")
|
||||
declare -a CHAPTER13_TO_TEST=("13.1" "13.2" "13.2.1" "13.2.2" "13.2.3")
|
||||
declare -a CHAPTER14_TO_TEST=("14.1")
|
||||
declare -a CHAPTER14_TO_TEST=("12.6.4")
|
||||
declare -a CHAPTER15_TO_TEST=("15.1" "15.1.1" "15.1.2" "15.1.3" "15.1.4" "15.1.5" "15.2" "15.2.1" "15.2.2" "15.2.3" \
|
||||
"15.2.4" "15.2.5" "15.3" "15.3.1" "15.3.2" "15.3.3" "15.3.4" "15.3.5" "15.4" "15.4.1" \
|
||||
"15.4.2" "15.4.3" "15.4.4" "15.4.5" "15.5" "15.5.1" "15.5.2" "15.5.3" "15.5.4" "15.5.5" \
|
||||
"15.6" "15.6.1" "15.6.2" "15.6.3" "15.6.4" "15.6.5" "15.7" "15.7.1" "15.7.2" "15.7.3" \
|
||||
"15.7.4" "15.7.5" "15.8" "15.8.1" "15.8.2" "15.9" "15.9.1" "15.9.2" "15.9.3" "15.9.4" \
|
||||
"15.9.5" "15.9.6" "15.10" "15.10.1" "15.10.2" "15.10.3" "15.10.4" "15.10.5" "15.10.6" \
|
||||
"15.10.7" "15.11" "15.11.1" "15.11.2" "15.11.3" "15.11.4" "15.11.5" "15.11.6" "15.11.7" \
|
||||
"15.12" "15.12.1" "15.12.2" "15.12.3")
|
||||
declare -a FULL_CHAPTERS_TO_TEST=("ch06" "ch07" "ch08" "ch09" "ch10" "ch11" "ch12" "ch13" "ch14" "ch15")
|
||||
declare -a SUB_CHAPTERS_TO_TEST=("${CHAPTER07_TO_TEST[@]}" "${CHAPTER08_TO_TEST[@]}" "${CHAPTER09_TO_TEST[@]}" \
|
||||
"${CHAPTER10_TO_TEST[@]}" "${CHAPTER11_TO_TEST[@]}" "${CHAPTER12_TO_TEST[@]}" \
|
||||
"${CHAPTER13_TO_TEST[@]}" "${CHAPTER14_TO_TEST[@]}" "${CHAPTER15_TO_TEST[@]}")
|
||||
|
||||
declare -a CHAPTERS_TO_TEST=("${FULL_CHAPTERS_TO_TEST[@]}")
|
||||
|
||||
if [[ $* == *--sub-chapters* ]]
|
||||
then
|
||||
declare -a CHAPTERS_TO_TEST=("${SUB_CHAPTERS_TO_TEST[@]}")
|
||||
fi
|
||||
|
||||
function run_test262 () {
|
||||
ARG_ENGINE="$1"
|
||||
ARG_TEST262_PATH="$2"
|
||||
ARG_CHAPTER="$3"
|
||||
|
||||
"${ARG_TEST262_PATH}"/tools/packaging/test262.py --command "timeout ${TIMEOUT} ${ARG_ENGINE}" \
|
||||
--tests="${ARG_TEST262_PATH}" --full-summary "${ARG_CHAPTER}" \
|
||||
> "${REPORT_PREFIX}"."${ARG_CHAPTER}"
|
||||
}
|
||||
|
||||
function show_report_results () {
|
||||
ARG_CHAPTER="$1"
|
||||
|
||||
echo ""
|
||||
echo "Chapter ${ARG_CHAPTER}:"
|
||||
grep -A3 "=== Summary ===" "${REPORT_PREFIX}"."${ARG_CHAPTER}"
|
||||
echo "==============="
|
||||
}
|
||||
|
||||
echo "Starting test262 testing for ${ENGINE}."
|
||||
|
||||
for TEST_NAME in "${CHAPTERS_TO_TEST[@]}"
|
||||
do
|
||||
run_test262 "${ENGINE}" "${PATH_TO_TEST262}" "$TEST_NAME" &
|
||||
RUN_PIDS="$RUN_PIDS $!";
|
||||
done
|
||||
|
||||
for RUN_PIDS in $RUN_PIDS
|
||||
do
|
||||
wait "$RUN_PIDS" || RESULT_OK=0
|
||||
done;
|
||||
#[ $RESULT_OK -eq 1 ] || exit 1
|
||||
|
||||
echo "Testing is completed."
|
||||
|
||||
for TEST_NAME in "${CHAPTERS_TO_TEST[@]}"
|
||||
do
|
||||
echo "$TEST_NAME"
|
||||
show_report_results "$TEST_NAME"
|
||||
done
|
181
third_party/jerryscript/tools/runners/run-test-suite.sh
vendored
Executable file
181
third_party/jerryscript/tools/runners/run-test-suite.sh
vendored
Executable file
|
@ -0,0 +1,181 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015-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.
|
||||
# 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.
|
||||
|
||||
# Usage:
|
||||
# ./tools/runners/run-test-suite.sh ENGINE TESTS [--snapshot] ENGINE_ARGS....
|
||||
|
||||
TIMEOUT=${TIMEOUT:=5}
|
||||
|
||||
ENGINE="$1"
|
||||
shift
|
||||
|
||||
TESTS="$1"
|
||||
shift
|
||||
|
||||
OUTPUT_DIR=`dirname $ENGINE`
|
||||
TESTS_BASENAME=`basename $TESTS`
|
||||
|
||||
TEST_FILES=$OUTPUT_DIR/$TESTS_BASENAME.files
|
||||
TEST_FAILED=$OUTPUT_DIR/$TESTS_BASENAME.failed
|
||||
TEST_PASSED=$OUTPUT_DIR/$TESTS_BASENAME.passed
|
||||
|
||||
if [ "$1" == "--snapshot" ]
|
||||
then
|
||||
TEST_FILES="$TEST_FILES.snapshot"
|
||||
TEST_FAILED="$TEST_FAILED.snapshot"
|
||||
TEST_PASSED="$TEST_PASSED.snapshot"
|
||||
IS_SNAPSHOT=true;
|
||||
shift
|
||||
fi
|
||||
|
||||
ENGINE_ARGS="$@"
|
||||
|
||||
if [ ! -x $ENGINE ]
|
||||
then
|
||||
echo "$0: $ENGINE: not an executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d $TESTS ]
|
||||
then
|
||||
TESTS_DIR=$TESTS
|
||||
|
||||
( cd $TESTS; find . -name "[^N]*.js" ) | sort > $TEST_FILES
|
||||
elif [ -f $TESTS ]
|
||||
then
|
||||
TESTS_DIR=`dirname $TESTS`
|
||||
|
||||
grep -e '.js\s*$' $TESTS | sort > $TEST_FILES
|
||||
else
|
||||
echo "$0: $TESTS: not a test suite"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
total=$(cat $TEST_FILES | wc -l)
|
||||
if [ "$total" -eq 0 ]
|
||||
then
|
||||
echo "$0: $TESTS: no test in test suite"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -f $TEST_FAILED $TEST_PASSED
|
||||
|
||||
ROOT_DIR=""
|
||||
CURRENT_DIR=`pwd`
|
||||
PATH_STEP=2
|
||||
while true
|
||||
do
|
||||
TMP_ROOT_DIR=`(echo "$CURRENT_DIR"; echo "$0"; echo "$ENGINE"; echo "$TESTS") | cut -f1-$PATH_STEP -d/ | uniq -d`
|
||||
if [ -z "$TMP_ROOT_DIR" ]
|
||||
then
|
||||
break
|
||||
else
|
||||
ROOT_DIR="$TMP_ROOT_DIR"
|
||||
fi
|
||||
PATH_STEP=$((PATH_STEP+1))
|
||||
done
|
||||
if [ -n "$ROOT_DIR" ]
|
||||
then
|
||||
ROOT_DIR="$ROOT_DIR/"
|
||||
fi
|
||||
|
||||
tested=1
|
||||
failed=0
|
||||
passed=0
|
||||
|
||||
ENGINE_TEMP=`mktemp engine-out.XXXXXXXXXX`
|
||||
|
||||
for test in `cat $TEST_FILES`
|
||||
do
|
||||
error_code=`echo $test | grep -e "^.\/fail\/[0-9]*\/" -o | cut -d / -f 3`
|
||||
if [ "$error_code" = "" ]
|
||||
then
|
||||
PASS="PASS"
|
||||
error_code=0
|
||||
else
|
||||
PASS="PASS (XFAIL)"
|
||||
fi
|
||||
|
||||
full_test=$TESTS_DIR/${test#./}
|
||||
|
||||
if [ "$IS_SNAPSHOT" == true ]
|
||||
then
|
||||
# Testing snapshot
|
||||
SNAPSHOT_TEMP=`mktemp $(basename -s .js $test).snapshot.XXXXXXXXXX`
|
||||
|
||||
cmd_line="${ENGINE#$ROOT_DIR} $ENGINE_ARGS --save-snapshot-for-global $SNAPSHOT_TEMP ${full_test#$ROOT_DIR}"
|
||||
( ulimit -t $TIMEOUT; $ENGINE $ENGINE_ARGS --save-snapshot-for-global $SNAPSHOT_TEMP $full_test &> $ENGINE_TEMP )
|
||||
status_code=$?
|
||||
|
||||
if [ $status_code -eq 0 ]
|
||||
then
|
||||
echo "[$tested/$total] $cmd_line: PASS"
|
||||
|
||||
cmd_line="${ENGINE#$ROOT_DIR} $ENGINE_ARGS --exec-snapshot $SNAPSHOT_TEMP"
|
||||
( ulimit -t $TIMEOUT; $ENGINE $ENGINE_ARGS --exec-snapshot $SNAPSHOT_TEMP &> $ENGINE_TEMP )
|
||||
status_code=$?
|
||||
fi
|
||||
|
||||
rm -f $SNAPSHOT_TEMP
|
||||
else
|
||||
cmd_line="${ENGINE#$ROOT_DIR} $ENGINE_ARGS ${full_test#$ROOT_DIR}"
|
||||
( ulimit -t $TIMEOUT; $ENGINE $ENGINE_ARGS $full_test &> $ENGINE_TEMP )
|
||||
status_code=$?
|
||||
fi
|
||||
|
||||
if [ $status_code -ne $error_code ]
|
||||
then
|
||||
echo "[$tested/$total] $cmd_line: FAIL ($status_code)"
|
||||
cat $ENGINE_TEMP
|
||||
|
||||
echo "$status_code: $test" >> $TEST_FAILED
|
||||
echo "============================================" >> $TEST_FAILED
|
||||
cat $ENGINE_TEMP >> $TEST_FAILED
|
||||
echo "============================================" >> $TEST_FAILED
|
||||
echo >> $TEST_FAILED
|
||||
echo >> $TEST_FAILED
|
||||
|
||||
failed=$((failed+1))
|
||||
else
|
||||
echo "[$tested/$total] $cmd_line: $PASS"
|
||||
|
||||
echo "$test" >> $TEST_PASSED
|
||||
|
||||
passed=$((passed+1))
|
||||
fi
|
||||
|
||||
tested=$((tested+1))
|
||||
done
|
||||
|
||||
rm -f $ENGINE_TEMP
|
||||
|
||||
ratio=$(echo $passed*100/$total | bc)
|
||||
|
||||
if [ "$IS_SNAPSHOT" == true ]
|
||||
then
|
||||
ENGINE_ARGS="--snapshot $ENGINE_ARGS"
|
||||
fi
|
||||
|
||||
echo "[summary] ${ENGINE#$ROOT_DIR} $ENGINE_ARGS ${TESTS#$ROOT_DIR}: $passed PASS, $failed FAIL, $total total, $ratio% success"
|
||||
|
||||
if [ $failed -ne 0 ]
|
||||
then
|
||||
echo "$0: see $TEST_FAILED for details about failures"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
80
third_party/jerryscript/tools/runners/run-tests-remote.sh
vendored
Executable file
80
third_party/jerryscript/tools/runners/run-tests-remote.sh
vendored
Executable file
|
@ -0,0 +1,80 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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" #debug.linux release.linux
|
||||
TARGET_IP="$2" # ip address of target board
|
||||
TARGET_USER="$3" # login
|
||||
TARGET_PASS="$4" # password
|
||||
|
||||
if [ $# -lt 4 ]
|
||||
then
|
||||
echo "This script runs ./jerry/* and ./jerry-test-suite/* tests on the remote board."
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " 1st parameter: target to be tested: {debug.linux, release.linux}"
|
||||
echo " 2nd parameter: ip address of target board: {110.110.110.110}"
|
||||
echo " 3rd parameter: ssh login to target board: {login}"
|
||||
echo " 4th parameter: ssh password to target board: {password}"
|
||||
echo ""
|
||||
echo "Example:"
|
||||
echo " ./tools/runners/run-tests-remote.sh debug.linux 110.110.110.110 login password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BASE_DIR=$(dirname "$(readlink -f "$0")" )
|
||||
|
||||
OUT_DIR="${BASE_DIR}"/../.././build/bin
|
||||
LOGS_PATH_FULL="${OUT_DIR}"/"${TARGET}"/check
|
||||
|
||||
export SSHPASS="${TARGET_PASS}"
|
||||
|
||||
rm -rf "${LOGS_PATH_FULL}"
|
||||
|
||||
mkdir -p "${LOGS_PATH_FULL}"
|
||||
|
||||
REMOTE_TMP_DIR=$(sshpass -e ssh "${TARGET_USER}"@"${TARGET_IP}" 'mktemp -d')
|
||||
REMOTE_TMP_TAR=$(sshpass -e ssh "${TARGET_USER}"@"${TARGET_IP}" 'mktemp')
|
||||
LOCAL_TMP_TAR=$(mktemp)
|
||||
|
||||
tar -zcf "${LOCAL_TMP_TAR}" \
|
||||
"${BASE_DIR}"/../.././build/bin/"${TARGET}" \
|
||||
"${BASE_DIR}"/../.././tests/benchmarks \
|
||||
"${BASE_DIR}"/../.././tests/jerry \
|
||||
"${BASE_DIR}"/../.././tests/jerry-test-suite \
|
||||
"${BASE_DIR}"/../.././tools/runners \
|
||||
"${BASE_DIR}"/../.././tools/precommit-full-testing.sh > /dev/null 2>&1
|
||||
|
||||
sshpass -e scp "${LOCAL_TMP_TAR}" "${TARGET_USER}"@"${TARGET_IP}":"${REMOTE_TMP_TAR}"
|
||||
|
||||
sshpass -e ssh "${TARGET_USER}"@"${TARGET_IP}" \
|
||||
"tar -zxf \"${REMOTE_TMP_TAR}\" -C \"${REMOTE_TMP_DIR}\"; rm \"${REMOTE_TMP_TAR}\";\
|
||||
cd \"${REMOTE_TMP_DIR}\"; \
|
||||
./tools/precommit-full-testing.sh ./build/bin \"$TARGET\" > ./build/bin/\"${TARGET}\"/check/run.log 2>&1; \
|
||||
echo \$? > ./build/bin/\"${TARGET}\"/check/IS_TEST_OK"
|
||||
|
||||
sshpass -e scp -r "${TARGET_USER}"@"${TARGET_IP}":"${REMOTE_TMP_DIR}"/build/bin/"${TARGET}"/check/* "${LOGS_PATH_FULL}"
|
||||
sshpass -e ssh "${TARGET_USER}"@"${TARGET_IP}" "rm -rf \"${REMOTE_TMP_DIR}\""
|
||||
|
||||
STATUS=$(cat "${LOGS_PATH_FULL}"/IS_TEST_OK)
|
||||
|
||||
if [ "${STATUS}" == 0 ] ; then
|
||||
echo "${TARGET} testing passed."
|
||||
exit 0
|
||||
else
|
||||
echo "${TARGET} testing failed."
|
||||
echo "See logs in ${LOGS_PATH_FULL} directory for details."
|
||||
exit 1
|
||||
fi
|
65
third_party/jerryscript/tools/runners/run-unittests-remote.sh
vendored
Executable file
65
third_party/jerryscript/tools/runners/run-unittests-remote.sh
vendored
Executable file
|
@ -0,0 +1,65 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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_IP="$1"
|
||||
TARGET_USER="$2"
|
||||
TARGET_PASS="$3"
|
||||
|
||||
if [ $# -lt 3 ]
|
||||
then
|
||||
echo "This script runs unittests on the remote board."
|
||||
echo ""
|
||||
echo "Usage:"
|
||||
echo " 1st parameter: ip address of target board: {110.110.110.110}"
|
||||
echo " 2nd parameter: ssh login to target board: {login}"
|
||||
echo " 3rd parameter: ssh password to target board: {password}"
|
||||
echo ""
|
||||
echo "Example:"
|
||||
echo " ./tools/runners/run-unittests-remote.sh 110.110.110.110 login password"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BASE_DIR=$(dirname "$(readlink -f "$0")" )
|
||||
|
||||
OUT_DIR="${BASE_DIR}"/../.././build/bin
|
||||
|
||||
rm -rf "${OUT_DIR}"/unittests/check
|
||||
|
||||
mkdir -p "${OUT_DIR}"/unittests/check
|
||||
|
||||
export SSHPASS="${TARGET_PASS}"
|
||||
REMOTE_TMP_DIR=$(sshpass -e ssh "${TARGET_USER}"@"${TARGET_IP}" 'mktemp -d')
|
||||
|
||||
sshpass -e scp "${BASE_DIR}"/../../tools/runners/run-unittests.sh "${TARGET_USER}"@"${TARGET_IP}":"${REMOTE_TMP_DIR}"
|
||||
sshpass -e scp -r "${OUT_DIR}"/unittests/* "${TARGET_USER}"@"${TARGET_IP}":"${REMOTE_TMP_DIR}"
|
||||
|
||||
sshpass -e ssh "${TARGET_USER}"@"${TARGET_IP}" "mkdir -p \"${REMOTE_TMP_DIR}\"/check; \
|
||||
\"${REMOTE_TMP_DIR}\"/run-unittests.sh \"${REMOTE_TMP_DIR}\"; \
|
||||
echo \$? > \"${REMOTE_TMP_DIR}\"/check/IS_REMOTE_TEST_OK"
|
||||
|
||||
sshpass -e scp -r "${TARGET_USER}"@$"{TARGET_IP}":"${REMOTE_TMP_DIR}"/check "${OUT_DIR}"/unittests
|
||||
|
||||
sshpass -e ssh "${TARGET_USER}"@"${TARGET_IP}" "rm -rf \"${REMOTE_TMP_DIR}\""
|
||||
|
||||
STATUS=$(cat "${OUT_DIR}"/unittests/check/IS_REMOTE_TEST_OK)
|
||||
|
||||
if [ "${STATUS}" == 0 ] ; then
|
||||
echo "Unit tests run passed."
|
||||
exit 0
|
||||
else
|
||||
echo "Unit tests run failed. See ${OUT_DIR}/unittests/unit_tests_run.log for details."
|
||||
exit 1
|
||||
fi
|
102
third_party/jerryscript/tools/runners/run-unittests.sh
vendored
Executable file
102
third_party/jerryscript/tools/runners/run-unittests.sh
vendored
Executable file
|
@ -0,0 +1,102 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
|
||||
DIR="$1"
|
||||
shift
|
||||
|
||||
UNITTEST_ERROR=$DIR/unittests.failed
|
||||
UNITTEST_OK=$DIR/unittests.passed
|
||||
|
||||
rm -f $UNITTEST_ERROR $UNITTEST_OK
|
||||
|
||||
UNITTESTS=$(ls $DIR/unit-*)
|
||||
total=$(ls $DIR/unit-* | wc -l)
|
||||
|
||||
if [ "$total" -eq 0 ]
|
||||
then
|
||||
echo "$0: $DIR: no unit-* test to execute"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOT_DIR=""
|
||||
CURRENT_DIR=`pwd`
|
||||
PATH_STEP=2
|
||||
while true
|
||||
do
|
||||
TMP_ROOT_DIR=`(echo "$CURRENT_DIR"; echo "$0"; echo "$DIR") | cut -f1-$PATH_STEP -d/ | uniq -d`
|
||||
if [ -z "$TMP_ROOT_DIR" ]
|
||||
then
|
||||
break
|
||||
else
|
||||
ROOT_DIR="$TMP_ROOT_DIR"
|
||||
fi
|
||||
PATH_STEP=$((PATH_STEP+1))
|
||||
done
|
||||
if [ -n "$ROOT_DIR" ]
|
||||
then
|
||||
ROOT_DIR="$ROOT_DIR/"
|
||||
fi
|
||||
|
||||
tested=1
|
||||
failed=0
|
||||
passed=0
|
||||
|
||||
UNITTEST_TEMP=`mktemp unittest-out.XXXXXXXXXX`
|
||||
|
||||
for unit_test in $UNITTESTS
|
||||
do
|
||||
cmd_line="${unit_test#$ROOT_DIR}"
|
||||
$unit_test &>$UNITTEST_TEMP
|
||||
status_code=$?
|
||||
|
||||
if [ $status_code -ne 0 ]
|
||||
then
|
||||
echo "[$tested/$total] $cmd_line: 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 "[$tested/$total] $cmd_line: 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#$ROOT_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
|
32
third_party/jerryscript/tools/settings.py
vendored
Executable file
32
third_party/jerryscript/tools/settings.py
vendored
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
from os import path
|
||||
|
||||
TOOLS_DIR = path.dirname(path.abspath(__file__))
|
||||
PROJECT_DIR = path.normpath(path.join(TOOLS_DIR, '..'))
|
||||
JERRY_TESTS_DIR = path.join(PROJECT_DIR, 'tests/jerry')
|
||||
JERRY_TEST_SUITE_DIR = path.join(PROJECT_DIR, 'tests/jerry-test-suite')
|
||||
JERRY_TEST_SUITE_MINIMAL_LIST = path.join(PROJECT_DIR, 'tests/jerry-test-suite/minimal-profile-list')
|
||||
|
||||
BUILD_SCRIPT = path.join(TOOLS_DIR, 'build.py')
|
||||
CPPCHECK_SCRIPT = path.join(TOOLS_DIR, 'check-cppcheck.sh')
|
||||
SIGNED_OFF_SCRIPT = path.join(TOOLS_DIR, 'check-signed-off.sh')
|
||||
VERA_SCRIPT = path.join(TOOLS_DIR, 'check-vera.sh')
|
||||
LICENSE_SCRIPT = path.join(TOOLS_DIR, 'check-license.py')
|
||||
TEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-test-suite.sh')
|
||||
UNITTEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-unittests.sh')
|
83
third_party/jerryscript/tools/sort-fails.sh
vendored
Executable file
83
third_party/jerryscript/tools/sort-fails.sh
vendored
Executable file
|
@ -0,0 +1,83 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 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.
|
||||
|
||||
INPUT_PATH="$1"
|
||||
VERSION=$(git log -n 1 --pretty=format:"%H")
|
||||
SYSTEM=$(uname -a)
|
||||
TMP_DIR="afl-testing"
|
||||
USAGE="Usage:\n\t./tools/sort-fails.sh PATH_TO_DIR_WITH_FAILS"
|
||||
|
||||
if [ "$#" -ne 1 ]
|
||||
then
|
||||
echo -e "${USAGE}";
|
||||
echo "Argument number mismatch...";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
rm "$TMP_DIR" -r; mkdir "$TMP_DIR";
|
||||
|
||||
make debug.linux VALGRIND=ON -j && echo "Build OK";
|
||||
|
||||
for file in "$INPUT_PATH"/*;
|
||||
do
|
||||
key1=$(./build/bin/debug.linux/jerry --abort-on-fail $file 2>&1);
|
||||
key2=$(valgrind --default-suppressions=yes ./build/bin/debug.linux/jerry --abort-on-fail $file 2>&1 \
|
||||
| sed -e 's/^==*[0-9][0-9]*==*//g' \
|
||||
| sed -e 's/^ Command: .*//g');
|
||||
|
||||
hash1=$(echo -n $key1 | md5sum);
|
||||
hash2=$(echo -n $key2 | md5sum);
|
||||
|
||||
dir="$TMP_DIR/$hash1";
|
||||
head="$TMP_DIR/$hash1.err.md";
|
||||
body="$dir/$hash2.err.md";
|
||||
|
||||
if [ ! -s "$dir" ]; then
|
||||
mkdir -p "$dir"; touch "$head";
|
||||
echo "###### Version: $VERSION" >> "$head";
|
||||
echo "###### System:" >> "$head";
|
||||
echo '```' >> "$head";
|
||||
echo "$SYSTEM" >> "$head";
|
||||
echo '```' >> "$head";
|
||||
echo "###### Output:" >> "$head";
|
||||
echo '```' >> "$head";
|
||||
echo "$key1" >> "$head";
|
||||
echo '```' >> "$head";
|
||||
fi
|
||||
|
||||
if [ ! -s "$body" ]; then
|
||||
touch "$body";
|
||||
echo '###### Unique backtrace:```' >> "$body";
|
||||
echo '```' >> "$body";
|
||||
echo "$key2" >> "$body"
|
||||
echo '```' >> "$body";
|
||||
fi
|
||||
|
||||
echo "###### Test case($file):" >> "$body";
|
||||
echo '```js' >> "$body";
|
||||
cat "$file" >> "$body";
|
||||
echo '```' >> "$body";
|
||||
|
||||
done
|
||||
|
||||
cd "$TMP_DIR";
|
||||
for dir in */ ; do
|
||||
for file in "$dir"/*;
|
||||
do
|
||||
cat "$file" >> "${dir%/*}.err.md"
|
||||
done
|
||||
rm $dir -r;
|
||||
done
|
29
third_party/jerryscript/tools/unit-tests/Makefile
vendored
Normal file
29
third_party/jerryscript/tools/unit-tests/Makefile
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
CC=gcc
|
||||
LDFLAGS=-lm
|
||||
|
||||
GENS=gen-test-libm
|
||||
|
||||
.PHONY: build
|
||||
build: $(GENS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f $(GENS)
|
||||
|
||||
gen-test-libm: gen-test-libm.c
|
||||
$(CC) $< -o $@ $(LDFLAGS)
|
769
third_party/jerryscript/tools/unit-tests/gen-test-libm.c
vendored
Normal file
769
third_party/jerryscript/tools/unit-tests/gen-test-libm.c
vendored
Normal file
|
@ -0,0 +1,769 @@
|
|||
/* Copyright 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Unit test generator for jerry-libm.
|
||||
* To be compiled separately from the rest of jerry and to be linked to a trusted libm.
|
||||
* Its output should be redirected to test-libm.inc.h.
|
||||
*
|
||||
* Example:
|
||||
* gcc gen-test-libm.c -o gen-test-libm -lm
|
||||
* ./gen-test-libm >test-libm.inc.h
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define GEN_INT_TEST(EXPR) printf("check_int (\"%s\", %s, %d);\n", #EXPR, #EXPR, EXPR);
|
||||
#define GEN_DBL_TEST(EXPR) printf("check_double (\"%s\", %s, %.20E);\n", #EXPR, #EXPR, EXPR);
|
||||
|
||||
int
|
||||
main (int argc, char **args)
|
||||
{
|
||||
printf ("/* Copyright 2016 Samsung Electronics Co., Ltd.\n"
|
||||
" * Copyright 2016 University of Szeged.\n"
|
||||
" *\n"
|
||||
" * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
|
||||
" * you may not use this file except in compliance with the License.\n"
|
||||
" * You may obtain a copy of the License at\n"
|
||||
" *\n"
|
||||
" * http://www.apache.org/licenses/LICENSE-2.0\n"
|
||||
" *\n"
|
||||
" * Unless required by applicable law or agreed to in writing, software\n"
|
||||
" * distributed under the License is distributed on an \"AS IS\" BASIS\n"
|
||||
" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
|
||||
" * See the License for the specific language governing permissions and\n"
|
||||
" * limitations under the License.\n"
|
||||
" */\n"
|
||||
"\n"
|
||||
"/*\n"
|
||||
" * Generated by tools/gen-test-libm.sh\n"
|
||||
" * DO NOT EDIT!!!\n"
|
||||
" */\n");
|
||||
|
||||
/* acos tests */
|
||||
GEN_DBL_TEST (acos (0.0));
|
||||
GEN_DBL_TEST (acos (-0.0));
|
||||
GEN_DBL_TEST (acos (1.0));
|
||||
GEN_DBL_TEST (acos (-1.0));
|
||||
GEN_DBL_TEST (acos (0.5));
|
||||
GEN_DBL_TEST (acos (-0.5));
|
||||
GEN_DBL_TEST (acos (INFINITY));
|
||||
GEN_DBL_TEST (acos (-INFINITY));
|
||||
GEN_DBL_TEST (acos (NAN));
|
||||
GEN_DBL_TEST (acos (6.9e-18));
|
||||
GEN_DBL_TEST (acos (-6.9e-18));
|
||||
GEN_DBL_TEST (acos (7.0e-18));
|
||||
GEN_DBL_TEST (acos (-7.0e-18));
|
||||
GEN_DBL_TEST (acos (7.4e-9));
|
||||
GEN_DBL_TEST (acos (-7.4e-9));
|
||||
GEN_DBL_TEST (acos (7.5e-9));
|
||||
GEN_DBL_TEST (acos (-7.5e-9));
|
||||
GEN_DBL_TEST (acos (0.1));
|
||||
GEN_DBL_TEST (acos (-0.1));
|
||||
GEN_DBL_TEST (acos (0.4));
|
||||
GEN_DBL_TEST (acos (-0.4));
|
||||
GEN_DBL_TEST (acos (0.6));
|
||||
GEN_DBL_TEST (acos (-0.6));
|
||||
GEN_DBL_TEST (acos (0.99));
|
||||
GEN_DBL_TEST (acos (-0.99));
|
||||
GEN_DBL_TEST (acos (1.1));
|
||||
GEN_DBL_TEST (acos (-1.1));
|
||||
GEN_DBL_TEST (acos (0.7));
|
||||
|
||||
/* asin tests*/
|
||||
GEN_DBL_TEST (asin (0.0));
|
||||
GEN_DBL_TEST (asin (-0.0));
|
||||
GEN_DBL_TEST (asin (1.0));
|
||||
GEN_DBL_TEST (asin (-1.0));
|
||||
GEN_DBL_TEST (asin (0.5));
|
||||
GEN_DBL_TEST (asin (-0.5));
|
||||
GEN_DBL_TEST (asin (0.98));
|
||||
GEN_DBL_TEST (asin (-0.98));
|
||||
GEN_DBL_TEST (asin (INFINITY));
|
||||
GEN_DBL_TEST (asin (-INFINITY));
|
||||
GEN_DBL_TEST (asin (NAN));
|
||||
GEN_DBL_TEST (asin (6.9e-18));
|
||||
GEN_DBL_TEST (asin (-6.9e-18));
|
||||
GEN_DBL_TEST (asin (7.0e-18));
|
||||
GEN_DBL_TEST (asin (-7.0e-18));
|
||||
GEN_DBL_TEST (asin (7.4e-9));
|
||||
GEN_DBL_TEST (asin (-7.4e-9));
|
||||
GEN_DBL_TEST (asin (7.5e-9));
|
||||
GEN_DBL_TEST (asin (-7.5e-9));
|
||||
GEN_DBL_TEST (asin (0.1));
|
||||
GEN_DBL_TEST (asin (-0.1));
|
||||
GEN_DBL_TEST (asin (0.4));
|
||||
GEN_DBL_TEST (asin (-0.4));
|
||||
GEN_DBL_TEST (asin (0.6));
|
||||
GEN_DBL_TEST (asin (-0.6));
|
||||
GEN_DBL_TEST (asin (0.97));
|
||||
GEN_DBL_TEST (asin (-0.97));
|
||||
GEN_DBL_TEST (asin (0.99));
|
||||
GEN_DBL_TEST (asin (-0.99));
|
||||
GEN_DBL_TEST (asin (1.1));
|
||||
GEN_DBL_TEST (asin (-1.1));
|
||||
GEN_DBL_TEST (asin (0.7));
|
||||
|
||||
/* atan tests*/
|
||||
GEN_DBL_TEST (atan (0.0));
|
||||
GEN_DBL_TEST (atan (-0.0));
|
||||
GEN_DBL_TEST (atan (7.0 / 16.0));
|
||||
GEN_DBL_TEST (atan (-7.0 / 16.0));
|
||||
GEN_DBL_TEST (atan (11.0 / 16.0));
|
||||
GEN_DBL_TEST (atan (-11.0 / 16.0));
|
||||
GEN_DBL_TEST (atan (19.0 / 16.0));
|
||||
GEN_DBL_TEST (atan (-19.0 / 16.0));
|
||||
GEN_DBL_TEST (atan (39.0 / 16.0));
|
||||
GEN_DBL_TEST (atan (-39.0 / 16.0));
|
||||
GEN_DBL_TEST (atan (1.0));
|
||||
GEN_DBL_TEST (atan (-1.0));
|
||||
GEN_DBL_TEST (atan (INFINITY));
|
||||
GEN_DBL_TEST (atan (-INFINITY));
|
||||
GEN_DBL_TEST (atan (NAN));
|
||||
GEN_DBL_TEST (atan (6.9 / 16.0));
|
||||
GEN_DBL_TEST (atan (-6.9 / 16.0));
|
||||
GEN_DBL_TEST (atan (7.1 / 16.0));
|
||||
GEN_DBL_TEST (atan (-7.1 / 16.0));
|
||||
GEN_DBL_TEST (atan (10.9 / 16.0));
|
||||
GEN_DBL_TEST (atan (-10.9 / 16.0));
|
||||
GEN_DBL_TEST (atan (11.1 / 16.0));
|
||||
GEN_DBL_TEST (atan (-11.1 / 16.0));
|
||||
GEN_DBL_TEST (atan (18.9 / 16.0));
|
||||
GEN_DBL_TEST (atan (-18.9 / 16.0));
|
||||
GEN_DBL_TEST (atan (19.1 / 16.0));
|
||||
GEN_DBL_TEST (atan (-19.1 / 16.0));
|
||||
GEN_DBL_TEST (atan (38.9 / 16.0));
|
||||
GEN_DBL_TEST (atan (-38.9 / 16.0));
|
||||
GEN_DBL_TEST (atan (39.1 / 16.0));
|
||||
GEN_DBL_TEST (atan (-39.1 / 16.0));
|
||||
GEN_DBL_TEST (atan (0.99));
|
||||
GEN_DBL_TEST (atan (-0.99));
|
||||
GEN_DBL_TEST (atan (1.1));
|
||||
GEN_DBL_TEST (atan (-1.1));
|
||||
GEN_DBL_TEST (atan (7.37e+19));
|
||||
GEN_DBL_TEST (atan (-7.37e+19));
|
||||
GEN_DBL_TEST (atan (7.38e+19));
|
||||
GEN_DBL_TEST (atan (-7.38e+19));
|
||||
GEN_DBL_TEST (atan (0.7));
|
||||
|
||||
/* atan2 tests*/
|
||||
GEN_DBL_TEST (atan2 (NAN, NAN));
|
||||
GEN_DBL_TEST (atan2 (0.0, NAN));
|
||||
GEN_DBL_TEST (atan2 (-0.0, NAN));
|
||||
GEN_DBL_TEST (atan2 (1.0, NAN));
|
||||
GEN_DBL_TEST (atan2 (-1.0, NAN));
|
||||
GEN_DBL_TEST (atan2 (INFINITY, NAN));
|
||||
GEN_DBL_TEST (atan2 (-INFINITY, NAN));
|
||||
GEN_DBL_TEST (atan2 (NAN, 0.0));
|
||||
GEN_DBL_TEST (atan2 (NAN, -0.0));
|
||||
GEN_DBL_TEST (atan2 (NAN, 1.0));
|
||||
GEN_DBL_TEST (atan2 (NAN, -1.0));
|
||||
GEN_DBL_TEST (atan2 (NAN, INFINITY));
|
||||
GEN_DBL_TEST (atan2 (NAN, -INFINITY));
|
||||
GEN_DBL_TEST (atan2 (0.0, 0.0));
|
||||
GEN_DBL_TEST (atan2 (0.0, -0.0));
|
||||
GEN_DBL_TEST (atan2 (-0.0, 0.0));
|
||||
GEN_DBL_TEST (atan2 (-0.0, -0.0));
|
||||
GEN_DBL_TEST (atan2 (0.0, 1.0));
|
||||
GEN_DBL_TEST (atan2 (0.0, -1.0));
|
||||
GEN_DBL_TEST (atan2 (0.0, INFINITY));
|
||||
GEN_DBL_TEST (atan2 (0.0, -INFINITY));
|
||||
GEN_DBL_TEST (atan2 (-0.0, 1.0));
|
||||
GEN_DBL_TEST (atan2 (-0.0, -1.0));
|
||||
GEN_DBL_TEST (atan2 (-0.0, INFINITY));
|
||||
GEN_DBL_TEST (atan2 (-0.0, -INFINITY));
|
||||
GEN_DBL_TEST (atan2 (1.0, 0.0));
|
||||
GEN_DBL_TEST (atan2 (1.0, -0.0));
|
||||
GEN_DBL_TEST (atan2 (INFINITY, 0.0));
|
||||
GEN_DBL_TEST (atan2 (INFINITY, -0.0));
|
||||
GEN_DBL_TEST (atan2 (-1.0, 0.0));
|
||||
GEN_DBL_TEST (atan2 (-1.0, -0.0));
|
||||
GEN_DBL_TEST (atan2 (-INFINITY, 0.0));
|
||||
GEN_DBL_TEST (atan2 (-INFINITY, -0.0));
|
||||
GEN_DBL_TEST (atan2 (1.0, INFINITY));
|
||||
GEN_DBL_TEST (atan2 (-1.0, INFINITY));
|
||||
GEN_DBL_TEST (atan2 (1.0, -INFINITY));
|
||||
GEN_DBL_TEST (atan2 (-1.0, -INFINITY));
|
||||
GEN_DBL_TEST (atan2 (INFINITY, INFINITY));
|
||||
GEN_DBL_TEST (atan2 (INFINITY, -INFINITY));
|
||||
GEN_DBL_TEST (atan2 (-INFINITY, INFINITY));
|
||||
GEN_DBL_TEST (atan2 (-INFINITY, -INFINITY));
|
||||
GEN_DBL_TEST (atan2 (INFINITY, 1.0));
|
||||
GEN_DBL_TEST (atan2 (INFINITY, -1.0));
|
||||
GEN_DBL_TEST (atan2 (-INFINITY, 1.0));
|
||||
GEN_DBL_TEST (atan2 (-INFINITY, -1.0));
|
||||
GEN_DBL_TEST (atan2 (0.7, 1.0));
|
||||
GEN_DBL_TEST (atan2 (-0.7, 1.0));
|
||||
GEN_DBL_TEST (atan2 (0.7, -1.0));
|
||||
GEN_DBL_TEST (atan2 (-0.7, -1.0));
|
||||
GEN_DBL_TEST (atan2 (0.4, 0.0003));
|
||||
GEN_DBL_TEST (atan2 (1.4, -0.93));
|
||||
|
||||
/* ceil tests */
|
||||
GEN_DBL_TEST (ceil (0.0));
|
||||
GEN_DBL_TEST (ceil (-0.0));
|
||||
GEN_DBL_TEST (ceil (INFINITY));
|
||||
GEN_DBL_TEST (ceil (-INFINITY));
|
||||
GEN_DBL_TEST (ceil (NAN));
|
||||
GEN_DBL_TEST (ceil (3.14));
|
||||
GEN_DBL_TEST (ceil (-3.14));
|
||||
GEN_DBL_TEST (ceil (3.72e-09));
|
||||
GEN_DBL_TEST (ceil (-3.72e-09));
|
||||
GEN_DBL_TEST (ceil (7.37e+19));
|
||||
GEN_DBL_TEST (ceil (-7.37e+19));
|
||||
|
||||
/* copysign tests */
|
||||
/* SKIPPED: not publicly declared in jerry-libm
|
||||
GEN_DBL_TEST (copysign (0.0, 0.0));
|
||||
GEN_DBL_TEST (copysign (0.0, -0.0));
|
||||
GEN_DBL_TEST (copysign (-0.0, 0.0));
|
||||
GEN_DBL_TEST (copysign (-0.0, -0.0));
|
||||
GEN_DBL_TEST (copysign (0.0, 1.0));
|
||||
GEN_DBL_TEST (copysign (0.0, -1.0));
|
||||
GEN_DBL_TEST (copysign (-0.0, 1.0));
|
||||
GEN_DBL_TEST (copysign (-0.0, -1.0));
|
||||
GEN_DBL_TEST (copysign (0.0, INFINITY));
|
||||
GEN_DBL_TEST (copysign (0.0, -INFINITY));
|
||||
GEN_DBL_TEST (copysign (-0.0, INFINITY));
|
||||
GEN_DBL_TEST (copysign (-0.0, -INFINITY));
|
||||
GEN_DBL_TEST (copysign (0.0, NAN));
|
||||
GEN_DBL_TEST (copysign (-0.0, NAN));
|
||||
GEN_DBL_TEST (copysign (1.0, 0.0));
|
||||
GEN_DBL_TEST (copysign (1.0, -0.0));
|
||||
GEN_DBL_TEST (copysign (-1.0, 0.0));
|
||||
GEN_DBL_TEST (copysign (-1.0, -0.0));
|
||||
GEN_DBL_TEST (copysign (1.0, 1.0));
|
||||
GEN_DBL_TEST (copysign (1.0, -1.0));
|
||||
GEN_DBL_TEST (copysign (-1.0, 1.0));
|
||||
GEN_DBL_TEST (copysign (-1.0, -1.0));
|
||||
GEN_DBL_TEST (copysign (1.0, INFINITY));
|
||||
GEN_DBL_TEST (copysign (1.0, -INFINITY));
|
||||
GEN_DBL_TEST (copysign (-1.0, INFINITY));
|
||||
GEN_DBL_TEST (copysign (-1.0, -INFINITY));
|
||||
GEN_DBL_TEST (copysign (1.0, NAN));
|
||||
GEN_DBL_TEST (copysign (-1.0, NAN));
|
||||
GEN_DBL_TEST (copysign (INFINITY, 0.0));
|
||||
GEN_DBL_TEST (copysign (INFINITY, -0.0));
|
||||
GEN_DBL_TEST (copysign (-INFINITY, 0.0));
|
||||
GEN_DBL_TEST (copysign (-INFINITY, -0.0));
|
||||
GEN_DBL_TEST (copysign (INFINITY, 1.0));
|
||||
GEN_DBL_TEST (copysign (INFINITY, -1.0));
|
||||
GEN_DBL_TEST (copysign (-INFINITY, 1.0));
|
||||
GEN_DBL_TEST (copysign (-INFINITY, -1.0));
|
||||
GEN_DBL_TEST (copysign (INFINITY, INFINITY));
|
||||
GEN_DBL_TEST (copysign (INFINITY, -INFINITY));
|
||||
GEN_DBL_TEST (copysign (-INFINITY, INFINITY));
|
||||
GEN_DBL_TEST (copysign (-INFINITY, -INFINITY));
|
||||
GEN_DBL_TEST (copysign (INFINITY, NAN));
|
||||
GEN_DBL_TEST (copysign (-INFINITY, NAN));
|
||||
GEN_DBL_TEST (copysign (NAN, 0.0));
|
||||
GEN_DBL_TEST (copysign (NAN, -0.0));
|
||||
GEN_DBL_TEST (copysign (NAN, 1.0));
|
||||
GEN_DBL_TEST (copysign (NAN, -1.0));
|
||||
GEN_DBL_TEST (copysign (NAN, INFINITY));
|
||||
GEN_DBL_TEST (copysign (NAN, -INFINITY));
|
||||
GEN_DBL_TEST (copysign (NAN, NAN));
|
||||
GEN_DBL_TEST (copysign (3.14, -1.0));
|
||||
GEN_DBL_TEST (copysign (-3.14, 1.0));
|
||||
GEN_DBL_TEST (copysign (1.0, -3.14));
|
||||
GEN_DBL_TEST (copysign (-1.0, 3.14));
|
||||
*/
|
||||
|
||||
/* exp tests */
|
||||
GEN_DBL_TEST (exp (0.0));
|
||||
GEN_DBL_TEST (exp (-0.0));
|
||||
GEN_DBL_TEST (exp (1.0));
|
||||
GEN_DBL_TEST (exp (-1.0));
|
||||
GEN_DBL_TEST (exp (INFINITY));
|
||||
GEN_DBL_TEST (exp (-INFINITY));
|
||||
GEN_DBL_TEST (exp (NAN));
|
||||
GEN_DBL_TEST (exp (7.08e+02));
|
||||
GEN_DBL_TEST (exp (7.10e+02));
|
||||
GEN_DBL_TEST (exp (-7.40e+02));
|
||||
GEN_DBL_TEST (exp (-7.50e+02));
|
||||
GEN_DBL_TEST (exp (0.34));
|
||||
GEN_DBL_TEST (exp (-0.34));
|
||||
GEN_DBL_TEST (exp (0.35));
|
||||
GEN_DBL_TEST (exp (-0.35));
|
||||
GEN_DBL_TEST (exp (1.03));
|
||||
GEN_DBL_TEST (exp (-1.03));
|
||||
GEN_DBL_TEST (exp (1.04));
|
||||
GEN_DBL_TEST (exp (-1.04));
|
||||
GEN_DBL_TEST (exp (3.72e-09));
|
||||
GEN_DBL_TEST (exp (-3.72e-09));
|
||||
GEN_DBL_TEST (exp (3.73e-09));
|
||||
GEN_DBL_TEST (exp (-3.73e-09));
|
||||
GEN_DBL_TEST (exp (2.0));
|
||||
GEN_DBL_TEST (exp (3.0));
|
||||
GEN_DBL_TEST (exp (0.7));
|
||||
GEN_DBL_TEST (exp (38.0));
|
||||
|
||||
/* fabs tests */
|
||||
GEN_DBL_TEST (fabs (0.0));
|
||||
GEN_DBL_TEST (fabs (-0.0));
|
||||
GEN_DBL_TEST (fabs (1.0));
|
||||
GEN_DBL_TEST (fabs (-1.0));
|
||||
GEN_DBL_TEST (fabs (INFINITY));
|
||||
GEN_DBL_TEST (fabs (-INFINITY));
|
||||
GEN_DBL_TEST (fabs (NAN));
|
||||
GEN_DBL_TEST (fabs (3.14));
|
||||
GEN_DBL_TEST (fabs (-3.14));
|
||||
GEN_DBL_TEST (fabs (0.7));
|
||||
GEN_DBL_TEST (fabs (-0.7));
|
||||
GEN_DBL_TEST (fabs (3.72e-09));
|
||||
GEN_DBL_TEST (fabs (-3.72e-09));
|
||||
GEN_DBL_TEST (fabs (7.37e+19));
|
||||
GEN_DBL_TEST (fabs (-7.37e+19));
|
||||
|
||||
/* finite tests */
|
||||
/* SKIPPED: not publicly declared in jerry-libm
|
||||
GEN_INT_TEST (finite (0.0));
|
||||
GEN_INT_TEST (finite (-0.0));
|
||||
GEN_INT_TEST (finite (1.0));
|
||||
GEN_INT_TEST (finite (-1.0));
|
||||
GEN_INT_TEST (finite (INFINITY));
|
||||
GEN_INT_TEST (finite (-INFINITY));
|
||||
GEN_INT_TEST (finite (NAN));
|
||||
GEN_INT_TEST (finite (3.14));
|
||||
GEN_INT_TEST (finite (-3.14));
|
||||
GEN_INT_TEST (finite (0.7));
|
||||
GEN_INT_TEST (finite (-0.7));
|
||||
GEN_INT_TEST (finite (3.72e-09));
|
||||
GEN_INT_TEST (finite (-3.72e-09));
|
||||
GEN_INT_TEST (finite (7.37e+19));
|
||||
GEN_INT_TEST (finite (-7.37e+19));
|
||||
*/
|
||||
|
||||
/* floor tests */
|
||||
GEN_DBL_TEST (floor (0.0));
|
||||
GEN_DBL_TEST (floor (-0.0));
|
||||
GEN_DBL_TEST (floor (INFINITY));
|
||||
GEN_DBL_TEST (floor (-INFINITY));
|
||||
GEN_DBL_TEST (floor (NAN));
|
||||
GEN_DBL_TEST (floor (3.14));
|
||||
GEN_DBL_TEST (floor (-3.14));
|
||||
GEN_DBL_TEST (floor (3.72e-09));
|
||||
GEN_DBL_TEST (floor (-3.72e-09));
|
||||
GEN_DBL_TEST (floor (7.37e+19));
|
||||
GEN_DBL_TEST (floor (-7.37e+19));
|
||||
|
||||
/* fmod tests */
|
||||
GEN_DBL_TEST (fmod (0.0, 0.0));
|
||||
GEN_DBL_TEST (fmod (0.0, -0.0));
|
||||
GEN_DBL_TEST (fmod (-0.0, 0.0));
|
||||
GEN_DBL_TEST (fmod (-0.0, -0.0));
|
||||
GEN_DBL_TEST (fmod (0.0, 3.0));
|
||||
GEN_DBL_TEST (fmod (0.0, -3.0));
|
||||
GEN_DBL_TEST (fmod (-0.0, 3.0));
|
||||
GEN_DBL_TEST (fmod (-0.0, -3.0));
|
||||
GEN_DBL_TEST (fmod (0.0, INFINITY));
|
||||
GEN_DBL_TEST (fmod (0.0, -INFINITY));
|
||||
GEN_DBL_TEST (fmod (-0.0, INFINITY));
|
||||
GEN_DBL_TEST (fmod (-0.0, -INFINITY));
|
||||
GEN_DBL_TEST (fmod (0.0, NAN));
|
||||
GEN_DBL_TEST (fmod (-0.0, NAN));
|
||||
GEN_DBL_TEST (fmod (3.0, 0.0));
|
||||
GEN_DBL_TEST (fmod (3.0, -0.0));
|
||||
GEN_DBL_TEST (fmod (-3.0, 0.0));
|
||||
GEN_DBL_TEST (fmod (-3.0, -0.0));
|
||||
GEN_DBL_TEST (fmod (3.0, 3.0));
|
||||
GEN_DBL_TEST (fmod (3.0, -3.0));
|
||||
GEN_DBL_TEST (fmod (-3.0, 3.0));
|
||||
GEN_DBL_TEST (fmod (-3.0, -3.0));
|
||||
GEN_DBL_TEST (fmod (3.0, INFINITY));
|
||||
GEN_DBL_TEST (fmod (3.0, -INFINITY));
|
||||
GEN_DBL_TEST (fmod (-3.0, INFINITY));
|
||||
GEN_DBL_TEST (fmod (-3.0, -INFINITY));
|
||||
GEN_DBL_TEST (fmod (3.0, NAN));
|
||||
GEN_DBL_TEST (fmod (-3.0, NAN));
|
||||
GEN_DBL_TEST (fmod (INFINITY, 0.0));
|
||||
GEN_DBL_TEST (fmod (INFINITY, -0.0));
|
||||
GEN_DBL_TEST (fmod (-INFINITY, 0.0));
|
||||
GEN_DBL_TEST (fmod (-INFINITY, -0.0));
|
||||
GEN_DBL_TEST (fmod (INFINITY, 3.0));
|
||||
GEN_DBL_TEST (fmod (INFINITY, -3.0));
|
||||
GEN_DBL_TEST (fmod (-INFINITY, 3.0));
|
||||
GEN_DBL_TEST (fmod (-INFINITY, -3.0));
|
||||
GEN_DBL_TEST (fmod (INFINITY, INFINITY));
|
||||
GEN_DBL_TEST (fmod (INFINITY, -INFINITY));
|
||||
GEN_DBL_TEST (fmod (-INFINITY, INFINITY));
|
||||
GEN_DBL_TEST (fmod (-INFINITY, -INFINITY));
|
||||
GEN_DBL_TEST (fmod (INFINITY, NAN));
|
||||
GEN_DBL_TEST (fmod (-INFINITY, NAN));
|
||||
GEN_DBL_TEST (fmod (NAN, 0.0));
|
||||
GEN_DBL_TEST (fmod (NAN, -0.0));
|
||||
GEN_DBL_TEST (fmod (NAN, 3.0));
|
||||
GEN_DBL_TEST (fmod (NAN, -3.0));
|
||||
GEN_DBL_TEST (fmod (NAN, INFINITY));
|
||||
GEN_DBL_TEST (fmod (NAN, -INFINITY));
|
||||
GEN_DBL_TEST (fmod (NAN, NAN));
|
||||
GEN_DBL_TEST (fmod (3.0, 1.0));
|
||||
GEN_DBL_TEST (fmod (3.0, -1.0));
|
||||
GEN_DBL_TEST (fmod (-3.0, 1.0));
|
||||
GEN_DBL_TEST (fmod (-3.0, -1.0));
|
||||
GEN_DBL_TEST (fmod (6.5, 2.3));
|
||||
GEN_DBL_TEST (fmod (6.5, -2.3));
|
||||
GEN_DBL_TEST (fmod (-6.5, 2.3));
|
||||
GEN_DBL_TEST (fmod (-6.5, -2.3));
|
||||
|
||||
/* isnan tests */
|
||||
GEN_INT_TEST (isnan (0.0));
|
||||
GEN_INT_TEST (isnan (-0.0));
|
||||
GEN_INT_TEST (isnan (1.0));
|
||||
GEN_INT_TEST (isnan (-1.0));
|
||||
GEN_INT_TEST (isnan (INFINITY));
|
||||
GEN_INT_TEST (isnan (-INFINITY));
|
||||
GEN_INT_TEST (isnan (NAN));
|
||||
GEN_INT_TEST (isnan (3.14));
|
||||
GEN_INT_TEST (isnan (-3.14));
|
||||
GEN_INT_TEST (isnan (0.7));
|
||||
GEN_INT_TEST (isnan (-0.7));
|
||||
GEN_INT_TEST (isnan (3.72e-09));
|
||||
GEN_INT_TEST (isnan (-3.72e-09));
|
||||
GEN_INT_TEST (isnan (7.37e+19));
|
||||
GEN_INT_TEST (isnan (-7.37e+19));
|
||||
|
||||
/* log tests */
|
||||
GEN_DBL_TEST (log (0.0));
|
||||
GEN_DBL_TEST (log (-0.0));
|
||||
GEN_DBL_TEST (log (1.0));
|
||||
GEN_DBL_TEST (log (-1.0));
|
||||
GEN_DBL_TEST (log (INFINITY));
|
||||
GEN_DBL_TEST (log (-INFINITY));
|
||||
GEN_DBL_TEST (log (NAN));
|
||||
GEN_DBL_TEST (log (M_E));
|
||||
GEN_DBL_TEST (log (1.0 / M_E));
|
||||
GEN_DBL_TEST (log (2));
|
||||
GEN_DBL_TEST (log (10));
|
||||
GEN_DBL_TEST (log (0.7));
|
||||
GEN_DBL_TEST (log (2.22e-308));
|
||||
GEN_DBL_TEST (log (2.23e-308));
|
||||
GEN_DBL_TEST (log (0.17));
|
||||
GEN_DBL_TEST (log (0.18));
|
||||
GEN_DBL_TEST (log (1999.0));
|
||||
GEN_DBL_TEST (log (2000.0));
|
||||
GEN_DBL_TEST (log (2001.0));
|
||||
|
||||
/* pow tests */
|
||||
GEN_DBL_TEST (pow (0.0, 0.0));
|
||||
GEN_DBL_TEST (pow (0.0, -0.0));
|
||||
GEN_DBL_TEST (pow (-0.0, 0.0));
|
||||
GEN_DBL_TEST (pow (-0.0, -0.0));
|
||||
GEN_DBL_TEST (pow (0.0, 1.0));
|
||||
GEN_DBL_TEST (pow (0.0, -1.0));
|
||||
GEN_DBL_TEST (pow (-0.0, 1.0));
|
||||
GEN_DBL_TEST (pow (-0.0, -1.0));
|
||||
GEN_DBL_TEST (pow (0.0, INFINITY));
|
||||
GEN_DBL_TEST (pow (0.0, -INFINITY));
|
||||
GEN_DBL_TEST (pow (-0.0, INFINITY));
|
||||
GEN_DBL_TEST (pow (-0.0, -INFINITY));
|
||||
GEN_DBL_TEST (pow (0.0, NAN));
|
||||
GEN_DBL_TEST (pow (-0.0, NAN));
|
||||
GEN_DBL_TEST (pow (1.0, 0.0));
|
||||
GEN_DBL_TEST (pow (1.0, -0.0));
|
||||
GEN_DBL_TEST (pow (-1.0, 0.0));
|
||||
GEN_DBL_TEST (pow (-1.0, -0.0));
|
||||
GEN_DBL_TEST (pow (1.0, 1.0));
|
||||
GEN_DBL_TEST (pow (1.0, -1.0));
|
||||
GEN_DBL_TEST (pow (-1.0, 1.0));
|
||||
GEN_DBL_TEST (pow (-1.0, -1.0));
|
||||
GEN_DBL_TEST (pow (1.0, INFINITY));
|
||||
GEN_DBL_TEST (pow (1.0, -INFINITY));
|
||||
GEN_DBL_TEST (pow (-1.0, INFINITY));
|
||||
GEN_DBL_TEST (pow (-1.0, -INFINITY));
|
||||
GEN_DBL_TEST (pow (1.0, NAN));
|
||||
GEN_DBL_TEST (pow (-1.0, NAN));
|
||||
GEN_DBL_TEST (pow (INFINITY, 0.0));
|
||||
GEN_DBL_TEST (pow (INFINITY, -0.0));
|
||||
GEN_DBL_TEST (pow (-INFINITY, 0.0));
|
||||
GEN_DBL_TEST (pow (-INFINITY, -0.0));
|
||||
GEN_DBL_TEST (pow (INFINITY, 1.0));
|
||||
GEN_DBL_TEST (pow (INFINITY, -1.0));
|
||||
GEN_DBL_TEST (pow (-INFINITY, 1.0));
|
||||
GEN_DBL_TEST (pow (-INFINITY, -1.0));
|
||||
GEN_DBL_TEST (pow (INFINITY, INFINITY));
|
||||
GEN_DBL_TEST (pow (INFINITY, -INFINITY));
|
||||
GEN_DBL_TEST (pow (-INFINITY, INFINITY));
|
||||
GEN_DBL_TEST (pow (-INFINITY, -INFINITY));
|
||||
GEN_DBL_TEST (pow (INFINITY, NAN));
|
||||
GEN_DBL_TEST (pow (-INFINITY, NAN));
|
||||
GEN_DBL_TEST (pow (NAN, 0.0));
|
||||
GEN_DBL_TEST (pow (NAN, -0.0));
|
||||
GEN_DBL_TEST (pow (NAN, 1.0));
|
||||
GEN_DBL_TEST (pow (NAN, -1.0));
|
||||
GEN_DBL_TEST (pow (NAN, INFINITY));
|
||||
GEN_DBL_TEST (pow (NAN, -INFINITY));
|
||||
GEN_DBL_TEST (pow (NAN, NAN));
|
||||
GEN_DBL_TEST (pow (0.9, INFINITY));
|
||||
GEN_DBL_TEST (pow (0.9, -INFINITY));
|
||||
GEN_DBL_TEST (pow (-0.9, INFINITY));
|
||||
GEN_DBL_TEST (pow (-0.9, -INFINITY));
|
||||
GEN_DBL_TEST (pow (1.1, INFINITY));
|
||||
GEN_DBL_TEST (pow (1.1, -INFINITY));
|
||||
GEN_DBL_TEST (pow (-1.1, INFINITY));
|
||||
GEN_DBL_TEST (pow (-1.1, -INFINITY));
|
||||
GEN_DBL_TEST (pow (0.0, 2.0));
|
||||
GEN_DBL_TEST (pow (0.0, -2.0));
|
||||
GEN_DBL_TEST (pow (-0.0, 2.0));
|
||||
GEN_DBL_TEST (pow (-0.0, -2.0));
|
||||
GEN_DBL_TEST (pow (0.0, 3.0));
|
||||
GEN_DBL_TEST (pow (0.0, -3.0));
|
||||
GEN_DBL_TEST (pow (-0.0, 3.0));
|
||||
GEN_DBL_TEST (pow (-0.0, -3.0));
|
||||
GEN_DBL_TEST (pow (0.0, 3.14));
|
||||
GEN_DBL_TEST (pow (0.0, -3.14));
|
||||
GEN_DBL_TEST (pow (-0.0, 3.14));
|
||||
GEN_DBL_TEST (pow (-0.0, -3.14));
|
||||
GEN_DBL_TEST (pow (1.0, 3.14));
|
||||
GEN_DBL_TEST (pow (1.0, -3.14));
|
||||
GEN_DBL_TEST (pow (-1.0, 3.14));
|
||||
GEN_DBL_TEST (pow (-1.0, -3.14));
|
||||
GEN_DBL_TEST (pow (3.14, 0.0));
|
||||
GEN_DBL_TEST (pow (3.14, -0.0));
|
||||
GEN_DBL_TEST (pow (-3.14, 0.0));
|
||||
GEN_DBL_TEST (pow (-3.14, -0.0));
|
||||
GEN_DBL_TEST (pow (3.14, 1.0));
|
||||
GEN_DBL_TEST (pow (3.14, -1.0));
|
||||
GEN_DBL_TEST (pow (-3.14, 1.0));
|
||||
GEN_DBL_TEST (pow (-3.14, -1.0));
|
||||
GEN_DBL_TEST (pow (3.14, 2.0));
|
||||
GEN_DBL_TEST (pow (3.14, -2.0));
|
||||
GEN_DBL_TEST (pow (-3.14, 2.0));
|
||||
GEN_DBL_TEST (pow (-3.14, -2.0));
|
||||
GEN_DBL_TEST (pow (3.14, 3.0));
|
||||
GEN_DBL_TEST (pow (3.14, -3.0));
|
||||
GEN_DBL_TEST (pow (-3.14, 3.0));
|
||||
GEN_DBL_TEST (pow (-3.14, -3.0));
|
||||
GEN_DBL_TEST (pow (3.14, 3.14));
|
||||
GEN_DBL_TEST (pow (3.14, -3.14));
|
||||
GEN_DBL_TEST (pow (-3.14, 3.14));
|
||||
GEN_DBL_TEST (pow (-3.14, -3.14));
|
||||
GEN_DBL_TEST (pow (INFINITY, 2.0));
|
||||
GEN_DBL_TEST (pow (INFINITY, -2.0));
|
||||
GEN_DBL_TEST (pow (-INFINITY, 2.0));
|
||||
GEN_DBL_TEST (pow (-INFINITY, -2.0));
|
||||
GEN_DBL_TEST (pow (INFINITY, 3.0));
|
||||
GEN_DBL_TEST (pow (INFINITY, -3.0));
|
||||
GEN_DBL_TEST (pow (-INFINITY, 3.0));
|
||||
GEN_DBL_TEST (pow (-INFINITY, -3.0));
|
||||
GEN_DBL_TEST (pow (INFINITY, 3.14));
|
||||
GEN_DBL_TEST (pow (INFINITY, -3.14));
|
||||
GEN_DBL_TEST (pow (-INFINITY, 3.14));
|
||||
GEN_DBL_TEST (pow (-INFINITY, -3.14));
|
||||
GEN_DBL_TEST (pow (0.7, 1.2));
|
||||
|
||||
/* scalbn tests */
|
||||
/* SKIPPED: not publicly declared in jerry-libm
|
||||
GEN_DBL_TEST (scalbn (0.0, 0));
|
||||
GEN_DBL_TEST (scalbn (-0.0, 0));
|
||||
GEN_DBL_TEST (scalbn (0.0, 1));
|
||||
GEN_DBL_TEST (scalbn (0.0, -1));
|
||||
GEN_DBL_TEST (scalbn (-0.0, 1));
|
||||
GEN_DBL_TEST (scalbn (-0.0, -1));
|
||||
GEN_DBL_TEST (scalbn (1.0, 0));
|
||||
GEN_DBL_TEST (scalbn (-1.0, 0));
|
||||
GEN_DBL_TEST (scalbn (1.0, 1));
|
||||
GEN_DBL_TEST (scalbn (1.0, -1));
|
||||
GEN_DBL_TEST (scalbn (-1.0, 1));
|
||||
GEN_DBL_TEST (scalbn (-1.0, -1));
|
||||
GEN_DBL_TEST (scalbn (INFINITY, 0));
|
||||
GEN_DBL_TEST (scalbn (-INFINITY, 0));
|
||||
GEN_DBL_TEST (scalbn (INFINITY, 1));
|
||||
GEN_DBL_TEST (scalbn (INFINITY, -1));
|
||||
GEN_DBL_TEST (scalbn (-INFINITY, 1));
|
||||
GEN_DBL_TEST (scalbn (-INFINITY, -1));
|
||||
GEN_DBL_TEST (scalbn (NAN, 0));
|
||||
GEN_DBL_TEST (scalbn (NAN, 1));
|
||||
GEN_DBL_TEST (scalbn (NAN, -1));
|
||||
GEN_DBL_TEST (scalbn (3.14, -1));
|
||||
GEN_DBL_TEST (scalbn (-3.14, 1));
|
||||
GEN_DBL_TEST (scalbn (0.7, 4));
|
||||
GEN_DBL_TEST (scalbn (0.7, -4));
|
||||
GEN_DBL_TEST (scalbn (-0.7, 4));
|
||||
GEN_DBL_TEST (scalbn (-0.7, -4));
|
||||
GEN_DBL_TEST (scalbn (0.8, 5));
|
||||
GEN_DBL_TEST (scalbn (0.8, -5));
|
||||
GEN_DBL_TEST (scalbn (-0.8, 5));
|
||||
GEN_DBL_TEST (scalbn (-0.8, -5));
|
||||
GEN_DBL_TEST (scalbn (5.55e-18, 49999));
|
||||
GEN_DBL_TEST (scalbn (5.55e-18, 50000));
|
||||
GEN_DBL_TEST (scalbn (5.55e-18, 50001));
|
||||
GEN_DBL_TEST (scalbn (1.0, -49999));
|
||||
GEN_DBL_TEST (scalbn (1.0, -50000));
|
||||
GEN_DBL_TEST (scalbn (1.0, -50001));
|
||||
*/
|
||||
|
||||
/* sqrt tests */
|
||||
GEN_DBL_TEST (sqrt (0.0));
|
||||
GEN_DBL_TEST (sqrt (-0.0));
|
||||
GEN_DBL_TEST (sqrt (1.0));
|
||||
GEN_DBL_TEST (sqrt (-1.0));
|
||||
GEN_DBL_TEST (sqrt (INFINITY));
|
||||
GEN_DBL_TEST (sqrt (-INFINITY));
|
||||
GEN_DBL_TEST (sqrt (NAN));
|
||||
GEN_DBL_TEST (sqrt (0.7));
|
||||
GEN_DBL_TEST (sqrt (2));
|
||||
GEN_DBL_TEST (sqrt (10));
|
||||
GEN_DBL_TEST (sqrt (2.22e-308));
|
||||
GEN_DBL_TEST (sqrt (2.23e-308));
|
||||
GEN_DBL_TEST (sqrt (3.72e-09));
|
||||
GEN_DBL_TEST (sqrt (7.37e+19));
|
||||
GEN_DBL_TEST (sqrt (2209));
|
||||
GEN_DBL_TEST (sqrt (4));
|
||||
GEN_DBL_TEST (sqrt (0.25));
|
||||
GEN_DBL_TEST (sqrt (6642.25));
|
||||
GEN_DBL_TEST (sqrt (15239.9025));
|
||||
|
||||
/* sin tests */
|
||||
GEN_DBL_TEST (sin (0.0));
|
||||
GEN_DBL_TEST (sin (-0.0));
|
||||
GEN_DBL_TEST (sin (1.0));
|
||||
GEN_DBL_TEST (sin (-1.0));
|
||||
GEN_DBL_TEST (sin (INFINITY));
|
||||
GEN_DBL_TEST (sin (-INFINITY));
|
||||
GEN_DBL_TEST (sin (NAN));
|
||||
GEN_DBL_TEST (sin (M_PI));
|
||||
GEN_DBL_TEST (sin (-M_PI));
|
||||
GEN_DBL_TEST (sin (2.0 * M_PI));
|
||||
GEN_DBL_TEST (sin (-2.0 * M_PI));
|
||||
GEN_DBL_TEST (sin (M_PI / 2.0));
|
||||
GEN_DBL_TEST (sin (-M_PI / 2.0));
|
||||
GEN_DBL_TEST (sin (M_PI / 3.0));
|
||||
GEN_DBL_TEST (sin (-M_PI / 3.0));
|
||||
GEN_DBL_TEST (sin (M_PI / 4.0));
|
||||
GEN_DBL_TEST (sin (-M_PI / 4.0));
|
||||
GEN_DBL_TEST (sin (M_PI / 6.0));
|
||||
GEN_DBL_TEST (sin (-M_PI / 6.0));
|
||||
GEN_DBL_TEST (sin (M_PI * 2.0 / 3.0));
|
||||
GEN_DBL_TEST (sin (-M_PI * 2.0 / 3.0));
|
||||
GEN_DBL_TEST (sin (M_PI * 5.0 / 6.0));
|
||||
GEN_DBL_TEST (sin (-M_PI * 5.0 / 6.0));
|
||||
GEN_DBL_TEST (sin (6.9e-18));
|
||||
GEN_DBL_TEST (sin (-6.9e-18));
|
||||
GEN_DBL_TEST (sin (7.0e-18));
|
||||
GEN_DBL_TEST (sin (-7.0e-18));
|
||||
GEN_DBL_TEST (sin (7.4e-9));
|
||||
GEN_DBL_TEST (sin (-7.4e-9));
|
||||
GEN_DBL_TEST (sin (7.5e-9));
|
||||
GEN_DBL_TEST (sin (-7.5e-9));
|
||||
GEN_DBL_TEST (sin (0.2));
|
||||
GEN_DBL_TEST (sin (-0.2));
|
||||
GEN_DBL_TEST (sin (0.4));
|
||||
GEN_DBL_TEST (sin (-0.4));
|
||||
GEN_DBL_TEST (sin (0.7));
|
||||
GEN_DBL_TEST (sin (-0.7));
|
||||
GEN_DBL_TEST (sin (0.8));
|
||||
GEN_DBL_TEST (sin (-0.8));
|
||||
GEN_DBL_TEST (sin (3.0));
|
||||
GEN_DBL_TEST (sin (-3.0));
|
||||
GEN_DBL_TEST (sin (4.0));
|
||||
GEN_DBL_TEST (sin (-4.0));
|
||||
GEN_DBL_TEST (sin (6.0));
|
||||
GEN_DBL_TEST (sin (-6.0));
|
||||
GEN_DBL_TEST (sin (7.0));
|
||||
GEN_DBL_TEST (sin (-7.0));
|
||||
|
||||
/* cos tests */
|
||||
GEN_DBL_TEST (cos (0.0));
|
||||
GEN_DBL_TEST (cos (-0.0));
|
||||
GEN_DBL_TEST (cos (1.0));
|
||||
GEN_DBL_TEST (cos (-1.0));
|
||||
GEN_DBL_TEST (cos (INFINITY));
|
||||
GEN_DBL_TEST (cos (-INFINITY));
|
||||
GEN_DBL_TEST (cos (NAN));
|
||||
GEN_DBL_TEST (cos (M_PI));
|
||||
GEN_DBL_TEST (cos (-M_PI));
|
||||
GEN_DBL_TEST (cos (2.0 * M_PI));
|
||||
GEN_DBL_TEST (cos (-2.0 * M_PI));
|
||||
GEN_DBL_TEST (cos (M_PI / 2.0));
|
||||
GEN_DBL_TEST (cos (-M_PI / 2.0));
|
||||
GEN_DBL_TEST (cos (M_PI / 3.0));
|
||||
GEN_DBL_TEST (cos (-M_PI / 3.0));
|
||||
GEN_DBL_TEST (cos (M_PI / 4.0));
|
||||
GEN_DBL_TEST (cos (-M_PI / 4.0));
|
||||
GEN_DBL_TEST (cos (M_PI / 6.0));
|
||||
GEN_DBL_TEST (cos (-M_PI / 6.0));
|
||||
GEN_DBL_TEST (cos (M_PI * 2.0 / 3.0));
|
||||
GEN_DBL_TEST (cos (-M_PI * 2.0 / 3.0));
|
||||
GEN_DBL_TEST (cos (M_PI * 5.0 / 6.0));
|
||||
GEN_DBL_TEST (cos (-M_PI * 5.0 / 6.0));
|
||||
GEN_DBL_TEST (cos (6.9e-18));
|
||||
GEN_DBL_TEST (cos (-6.9e-18));
|
||||
GEN_DBL_TEST (cos (7.0e-18));
|
||||
GEN_DBL_TEST (cos (-7.0e-18));
|
||||
GEN_DBL_TEST (cos (7.4e-9));
|
||||
GEN_DBL_TEST (cos (-7.4e-9));
|
||||
GEN_DBL_TEST (cos (7.5e-9));
|
||||
GEN_DBL_TEST (cos (-7.5e-9));
|
||||
GEN_DBL_TEST (cos (0.2));
|
||||
GEN_DBL_TEST (cos (-0.2));
|
||||
GEN_DBL_TEST (cos (0.4));
|
||||
GEN_DBL_TEST (cos (-0.4));
|
||||
GEN_DBL_TEST (cos (0.7));
|
||||
GEN_DBL_TEST (cos (-0.7));
|
||||
GEN_DBL_TEST (cos (0.8));
|
||||
GEN_DBL_TEST (cos (-0.8));
|
||||
GEN_DBL_TEST (cos (3.0));
|
||||
GEN_DBL_TEST (cos (-3.0));
|
||||
GEN_DBL_TEST (cos (4.0));
|
||||
GEN_DBL_TEST (cos (-4.0));
|
||||
GEN_DBL_TEST (cos (6.0));
|
||||
GEN_DBL_TEST (cos (-6.0));
|
||||
GEN_DBL_TEST (cos (7.0));
|
||||
GEN_DBL_TEST (cos (-7.0));
|
||||
|
||||
/* tan tests */
|
||||
GEN_DBL_TEST (tan (0.0));
|
||||
GEN_DBL_TEST (tan (-0.0));
|
||||
GEN_DBL_TEST (tan (1.0));
|
||||
GEN_DBL_TEST (tan (-1.0));
|
||||
GEN_DBL_TEST (tan (INFINITY));
|
||||
GEN_DBL_TEST (tan (-INFINITY));
|
||||
GEN_DBL_TEST (tan (NAN));
|
||||
GEN_DBL_TEST (tan (M_PI));
|
||||
GEN_DBL_TEST (tan (-M_PI));
|
||||
GEN_DBL_TEST (tan (2.0 * M_PI));
|
||||
GEN_DBL_TEST (tan (-2.0 * M_PI));
|
||||
GEN_DBL_TEST (tan (M_PI / 2.0));
|
||||
GEN_DBL_TEST (tan (-M_PI / 2.0));
|
||||
GEN_DBL_TEST (tan (M_PI / 3.0));
|
||||
GEN_DBL_TEST (tan (-M_PI / 3.0));
|
||||
GEN_DBL_TEST (tan (M_PI / 4.0));
|
||||
GEN_DBL_TEST (tan (-M_PI / 4.0));
|
||||
GEN_DBL_TEST (tan (M_PI / 6.0));
|
||||
GEN_DBL_TEST (tan (-M_PI / 6.0));
|
||||
GEN_DBL_TEST (tan (M_PI * 2.0 / 3.0));
|
||||
GEN_DBL_TEST (tan (-M_PI * 2.0 / 3.0));
|
||||
GEN_DBL_TEST (tan (M_PI * 5.0 / 6.0));
|
||||
GEN_DBL_TEST (tan (-M_PI * 5.0 / 6.0));
|
||||
GEN_DBL_TEST (tan (3.7e-9));
|
||||
GEN_DBL_TEST (tan (-3.7e-9));
|
||||
GEN_DBL_TEST (tan (3.8e-9));
|
||||
GEN_DBL_TEST (tan (-3.8e-9));
|
||||
GEN_DBL_TEST (tan (0.6));
|
||||
GEN_DBL_TEST (tan (-0.6));
|
||||
GEN_DBL_TEST (tan (0.7));
|
||||
GEN_DBL_TEST (tan (-0.7));
|
||||
GEN_DBL_TEST (tan (3.0));
|
||||
GEN_DBL_TEST (tan (-3.0));
|
||||
GEN_DBL_TEST (tan (4.0));
|
||||
GEN_DBL_TEST (tan (-4.0));
|
||||
GEN_DBL_TEST (tan (6.0));
|
||||
GEN_DBL_TEST (tan (-6.0));
|
||||
GEN_DBL_TEST (tan (7.0));
|
||||
GEN_DBL_TEST (tan (-7.0));
|
||||
} /* main */
|
92
third_party/jerryscript/tools/update-webpage.sh
vendored
Executable file
92
third_party/jerryscript/tools/update-webpage.sh
vendored
Executable file
|
@ -0,0 +1,92 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2015-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.
|
||||
# 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.
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "Please, specify your gh-pages clone directory: update-webpage <gh-pages clone dir>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
gh_pages_dir=$1
|
||||
docs_dir=`dirname $(readlink -f $0)`"/../docs"
|
||||
|
||||
GETTING_STARTED_MD="01.GETTING-STARTED.md"
|
||||
API_REFERENCE_MD="02.API-REFERENCE.md"
|
||||
API_EXAMPLES_MD="03.API-EXAMPLE.md"
|
||||
INTERNALS_MD="04.INTERNALS.md"
|
||||
PORT_API_MD="05.PORT-API.md"
|
||||
|
||||
declare -A titles
|
||||
|
||||
titles[$GETTING_STARTED_MD]="Getting Started"
|
||||
titles[$API_REFERENCE_MD]="API Reference"
|
||||
titles[$API_EXAMPLES_MD]="API Examples"
|
||||
titles[$INTERNALS_MD]="Internals"
|
||||
titles[$PORT_API_MD]="Port API"
|
||||
|
||||
for docfile in $docs_dir/*.md; do
|
||||
docfile_base=`basename $docfile`
|
||||
|
||||
permalink=`echo $docfile_base | cut -d'.' -f 2 | tr '[:upper:]' '[:lower:]'`
|
||||
missing_title=`echo $permalink | tr '-' ' '`
|
||||
|
||||
# generate appropriate header for each *.md
|
||||
echo "---" > $gh_pages_dir/$docfile_base
|
||||
echo "layout: page" >> $gh_pages_dir/$docfile_base
|
||||
echo "title: ${titles[$docfile_base]:-$missing_title}" >> $gh_pages_dir/$docfile_base
|
||||
echo "permalink: /$permalink/" >> $gh_pages_dir/$docfile_base
|
||||
echo "---" >> $gh_pages_dir/$docfile_base
|
||||
echo >> $gh_pages_dir/$docfile_base
|
||||
echo "* toc" >> $gh_pages_dir/$docfile_base
|
||||
echo "{:toc}" >> $gh_pages_dir/$docfile_base
|
||||
echo >> $gh_pages_dir/$docfile_base
|
||||
|
||||
# the file itself removing underscores inside links
|
||||
gawk \
|
||||
'
|
||||
!/\[.*\]\(#/ {
|
||||
print $0
|
||||
}
|
||||
|
||||
/\[.*\]\(#/ {
|
||||
link_start_pos = index($0, "](#");
|
||||
line_beg = substr($0, 1, link_start_pos+2);
|
||||
line_remain = substr($0, link_start_pos+3);
|
||||
link_end_pos = index(line_remain, ")")
|
||||
link = substr(line_remain, 1, link_end_pos-1);
|
||||
line_end = substr(line_remain, link_end_pos)
|
||||
|
||||
# delete underscores form the link
|
||||
gsub(/_/, "", link);
|
||||
|
||||
printf "%s%s%s\n", line_beg, link, line_end
|
||||
}
|
||||
' $docfile >> $gh_pages_dir/$docfile_base
|
||||
|
||||
# fix image links
|
||||
sed -i -r -e 's/^!\[.*\]\(/&{{ site.baseurl }}\//' $gh_pages_dir/$docfile_base
|
||||
sed -i -r -e 's/^!\[.*\]\(\{\{ site\.baseurl \}\}\/img.*$/&{: class="thumbnail center-block img-responsive" }/' $gh_pages_dir/$docfile_base
|
||||
|
||||
# replace span tags to div
|
||||
sed -i 's/<span class=/<div class=/g' $gh_pages_dir/$docfile_base
|
||||
sed -i 's/<\/span>/<\/div>/g' $gh_pages_dir/$docfile_base
|
||||
|
||||
# remove table header separators
|
||||
sed -i '/^| ---/d' $gh_pages_dir/$docfile_base
|
||||
|
||||
# update images
|
||||
cp -Ru $docs_dir/img $gh_pages_dir
|
||||
done
|
17
third_party/jerryscript/tools/vera++/profiles/jerry
vendored
Normal file
17
third_party/jerryscript/tools/vera++/profiles/jerry
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
set rules {
|
||||
jerry_always_curly
|
||||
jerry_braces_on_separate_line
|
||||
jerry_braces_same_line_or_column
|
||||
jerry_comment_function_end
|
||||
jerry_funcname_space_parentheses
|
||||
jerry_identifier_no_space_bracket
|
||||
jerry_indentation
|
||||
jerry_max_line_length
|
||||
jerry_no_space_after_opening_parentheses
|
||||
jerry_no_space_before_closing_parentheses
|
||||
jerry_no_tabs
|
||||
jerry_no_trailing_spaces
|
||||
jerry_pointer_declarator_space
|
||||
jerry_switch_case
|
||||
jerry_typecast_space_parentheses
|
||||
}
|
87
third_party/jerryscript/tools/vera++/scripts/rules/jerry_always_curly.tcl
vendored
Normal file
87
third_party/jerryscript/tools/vera++/scripts/rules/jerry_always_curly.tcl
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
|
||||
foreach file_name [getSourceFileNames] {
|
||||
set state "control"
|
||||
set do_marks {}
|
||||
set prev_tok_type ""
|
||||
set prev_ctrl ""
|
||||
set expect_while false
|
||||
set expect_open_brace false
|
||||
set paren_count 0
|
||||
|
||||
foreach token [getTokens $file_name 1 0 -1 -1 {if do while else for leftparen rightparen semicolon leftbrace rightbrace}] {
|
||||
set tok_val [lindex $token 0]
|
||||
set line_num [lindex $token 1]
|
||||
set col_num [lindex $token 2]
|
||||
set tok_type [lindex $token 3]
|
||||
|
||||
if {$state == "expression"} {
|
||||
# puts "expression $paren_count $tok_type ($line_num , $col_num)"
|
||||
if {$tok_type == "leftparen"} {
|
||||
incr paren_count
|
||||
} elseif {$tok_type == "rightparen"} {
|
||||
incr paren_count -1
|
||||
if {$paren_count == 0} {
|
||||
set state "control"
|
||||
set expect_open_brace true
|
||||
} elseif {$paren_count < 0 } {
|
||||
report $file_name $line_num "unexpected right parentheses"
|
||||
}
|
||||
} elseif {$tok_type != "semicolon"} {
|
||||
report $file_name $line_num "unexpected token: $tok_type"
|
||||
}
|
||||
} else {
|
||||
if {$expect_open_brace == true} {
|
||||
if {$tok_type == "if" && $prev_tok_type == "else"} {
|
||||
# empty
|
||||
} elseif {$tok_type != "leftbrace"} {
|
||||
report $file_name [lindex $prev_ctrl 1] "brace after \'[lindex $prev_ctrl 3]\' required"
|
||||
}
|
||||
set expect_open_brace false
|
||||
}
|
||||
|
||||
if {$tok_type == "while" && ($expect_while == true || [lindex $prev_ctrl 3] == "do")} {
|
||||
set expect_while false
|
||||
set prev_ctrl ""
|
||||
} elseif {$tok_type in {if for while}} {
|
||||
set state "expression"
|
||||
set prev_ctrl $token
|
||||
} elseif {$tok_type in {do else}} {
|
||||
set expect_open_brace true
|
||||
set prev_ctrl $token
|
||||
} elseif {$tok_type == "leftbrace"} {
|
||||
if {[lindex $prev_ctrl 3] == "do"} {
|
||||
lappend do_marks 1
|
||||
} else {
|
||||
lappend do_marks 0
|
||||
}
|
||||
set prev_ctrl ""
|
||||
} elseif {$tok_type == "rightbrace"} {
|
||||
if {[llength $do_marks] > 0} {
|
||||
if {[lindex $do_marks end] == 1} {
|
||||
set expect_while true
|
||||
}
|
||||
set do_marks [lreplace $do_marks end end]
|
||||
} else {
|
||||
report $file_name $line_num "unmatched brace"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set prev_tok_type $tok_type
|
||||
}
|
||||
}
|
115
third_party/jerryscript/tools/vera++/scripts/rules/jerry_braces_on_separate_line.tcl
vendored
Normal file
115
third_party/jerryscript/tools/vera++/scripts/rules/jerry_braces_on_separate_line.tcl
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
|
||||
foreach file_name [getSourceFileNames] {
|
||||
set state "normal"
|
||||
set lines {}
|
||||
set cols {}
|
||||
set struct_marks {}
|
||||
set expect_struct_name false
|
||||
set prev_tok ""
|
||||
set def_start false
|
||||
set expect_newline false
|
||||
set check_newline true
|
||||
|
||||
foreach token [getTokens $file_name 1 0 -1 -1 {}] {
|
||||
set tok_val [lindex $token 0]
|
||||
set line_num [lindex $token 1]
|
||||
set col_num [lindex $token 2]
|
||||
set tok_type [lindex $token 3]
|
||||
|
||||
if {$state == "macro"} {
|
||||
if {$col_num == 0} {
|
||||
set state "normal"
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if {$tok_type in {space ccomment cppcomment newline}} {
|
||||
continue
|
||||
}
|
||||
|
||||
if {$tok_type == "pp_define"} {
|
||||
set state "macro"
|
||||
set prev_tok ""
|
||||
set def_start false
|
||||
continue
|
||||
}
|
||||
|
||||
if {$expect_struct_name == true} {
|
||||
if {$tok_type == "identifier" && $line_num != [lindex $prev_tok 1]} {
|
||||
report $file_name $line_num "type name should be on the same line with the rightbrace"
|
||||
}
|
||||
set expect_struct_name false
|
||||
}
|
||||
|
||||
# check that rightbrace and typename (in struct, union and enum definitons) are on the same line
|
||||
if {$tok_type in {struct enum union}} {
|
||||
set def_start true
|
||||
} elseif {$tok_type == "semicolon"} {
|
||||
set def_start false
|
||||
} elseif {$tok_type == "leftbrace"} {
|
||||
lappend cols $col_num
|
||||
lappend lines $line_num
|
||||
if {$def_start == true} {
|
||||
lappend struct_marks 1
|
||||
set def_start false
|
||||
} elseif {[lindex $prev_tok 3] == "assign"} {
|
||||
lappend struct_marks 2
|
||||
set check_newline false
|
||||
} else {
|
||||
lappend struct_marks 0
|
||||
}
|
||||
} elseif {$tok_type == "rightbrace"} {
|
||||
if {[llength $lines] > 0} {
|
||||
if {[lindex $struct_marks end] == 1} {
|
||||
set expect_struct_name true
|
||||
set check_newline false
|
||||
} elseif {[lindex $struct_marks end] == 2} {
|
||||
set check_newline false
|
||||
}
|
||||
set lines [lreplace $lines end end]
|
||||
set cols [lreplace $cols end end]
|
||||
set struct_marks [lreplace $struct_marks end end]
|
||||
} else {
|
||||
report $file_name $line_num "unmatched brace"
|
||||
}
|
||||
}
|
||||
|
||||
# check that braces are on separate lines
|
||||
if {$check_newline == true} {
|
||||
if {$expect_newline == true} {
|
||||
if {$tok_type == "semicolon"} {
|
||||
# empty
|
||||
} elseif {[lindex $prev_tok 1] == $line_num} {
|
||||
report $file_name $line_num "brace should be placed on a separate line"
|
||||
} else {
|
||||
set expect_newline false
|
||||
}
|
||||
} elseif {$tok_type in {leftbrace rightbrace}} {
|
||||
if {[lindex $prev_tok 1] == $line_num} {
|
||||
report $file_name $line_num "brace should be placed on a separate line"
|
||||
}
|
||||
set expect_newline true
|
||||
}
|
||||
} else {
|
||||
set check_newline true
|
||||
}
|
||||
|
||||
set prev_tok $token
|
||||
}
|
||||
}
|
61
third_party/jerryscript/tools/vera++/scripts/rules/jerry_braces_same_line_or_column.tcl
vendored
Normal file
61
third_party/jerryscript/tools/vera++/scripts/rules/jerry_braces_same_line_or_column.tcl
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
|
||||
foreach file_name [getSourceFileNames] {
|
||||
set state "normal"
|
||||
set lines {}
|
||||
set cols {}
|
||||
|
||||
foreach token [getTokens $file_name 1 0 -1 -1 {}] {
|
||||
set tok_val [lindex $token 0]
|
||||
set line_num [lindex $token 1]
|
||||
set col_num [lindex $token 2]
|
||||
set tok_type [lindex $token 3]
|
||||
|
||||
if {$state == "macro"} {
|
||||
if {$col_num == 0} {
|
||||
set state "normal"
|
||||
} else {
|
||||
set prev_tok_line $line_num
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
if {$tok_type in {space ccomment cppcomment newline}} {
|
||||
continue
|
||||
}
|
||||
|
||||
if {$tok_type == "pp_define"} {
|
||||
set state "macro"
|
||||
continue
|
||||
}
|
||||
|
||||
if {$tok_type == "leftbrace"} {
|
||||
lappend cols $col_num
|
||||
lappend lines $line_num
|
||||
} elseif {$tok_type == "rightbrace"} {
|
||||
if {[llength $lines] > 0} {
|
||||
if {[lindex $lines end] != $line_num && [lindex $cols end] != $col_num} {
|
||||
report $file_name $line_num "matching braces should be on the same line or column"
|
||||
}
|
||||
set lines [lreplace $lines end end]
|
||||
set cols [lreplace $cols end end]
|
||||
} else {
|
||||
report $file_name $line_num "unmatched brace"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
53
third_party/jerryscript/tools/vera++/scripts/rules/jerry_comment_function_end.tcl
vendored
Normal file
53
third_party/jerryscript/tools/vera++/scripts/rules/jerry_comment_function_end.tcl
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
foreach fileName [getSourceFileNames] {
|
||||
set funcStart 0
|
||||
set funcName ""
|
||||
set lineNumber 1
|
||||
foreach line [getAllLines $fileName] {
|
||||
if {[regexp {^((static |const )*\w+ )*\w+ \(.*[,\)]} $line]} {
|
||||
set type {}
|
||||
set modifier {}
|
||||
if {$funcStart == 0} {
|
||||
regexp {^((static |const )*\w+ )*(\w+) \(} $line matched type modifier funcName
|
||||
}
|
||||
}
|
||||
|
||||
if {[regexp {^\{$} $line]} {
|
||||
set funcStart 1
|
||||
}
|
||||
|
||||
if {$funcStart == 1} {
|
||||
if {[regexp {^\}$} $line] && [string length $funcName] != 0} {
|
||||
report $fileName $lineNumber "missing comment at the end of function: /* $funcName */"
|
||||
set funcStart 0
|
||||
} elseif {[regexp {^\} /\*\s*\w+\s*\*/$} $line] && [string length $funcName] != 0} {
|
||||
set comment {}
|
||||
regexp {^\} /\*\s*(\w+)\s*\*/$} $line -> comment
|
||||
if {$comment != $funcName} {
|
||||
report $fileName $lineNumber "comment missmatch. (Current: $comment, Expected: $funcName) "
|
||||
}
|
||||
set funcStart 0
|
||||
} elseif {[regexp {^\}.*;?$} $line]} {
|
||||
set funcStart 0
|
||||
}
|
||||
}
|
||||
|
||||
incr lineNumber
|
||||
}
|
||||
}
|
60
third_party/jerryscript/tools/vera++/scripts/rules/jerry_funcname_space_parentheses.tcl
vendored
Normal file
60
third_party/jerryscript/tools/vera++/scripts/rules/jerry_funcname_space_parentheses.tcl
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
|
||||
proc check_part_of_the_file {file line_num col_start col_end} {
|
||||
if {$col_start == $col_end} {
|
||||
return
|
||||
}
|
||||
set line [getLine $file $line_num]
|
||||
|
||||
if {[regexp {^\s*#[ ]*define} $line]} {
|
||||
return
|
||||
}
|
||||
|
||||
set line [string range $line $col_start $col_end]
|
||||
|
||||
if {[regexp {([[:alnum:]][\s]{2,}\()|([[:alnum:]]\()} $line]} {
|
||||
report $file $line_num "there should be exactly one space before left parentheses"
|
||||
}
|
||||
}
|
||||
|
||||
foreach fileName [getSourceFileNames] {
|
||||
set checkLine 1
|
||||
set checkColStart 0
|
||||
set seenOmitToken false
|
||||
foreach token [getTokens $fileName 1 0 -1 -1 {}] {
|
||||
set lineNumber [lindex $token 1]
|
||||
set colNumber [lindex $token 2]
|
||||
set tokenType [lindex $token 3]
|
||||
|
||||
if {$checkLine != $lineNumber} {
|
||||
if {!$seenOmitToken} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart end
|
||||
}
|
||||
set checkColStart $colNumber
|
||||
set checkLine $lineNumber
|
||||
} elseif {$seenOmitToken} {
|
||||
set checkColStart $colNumber
|
||||
}
|
||||
|
||||
if {$tokenType in {ccomment cppcomment stringlit}} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
|
||||
set seenOmitToken true
|
||||
} else {
|
||||
set seenOmitToken false
|
||||
}
|
||||
}
|
||||
}
|
56
third_party/jerryscript/tools/vera++/scripts/rules/jerry_identifier_no_space_bracket.tcl
vendored
Normal file
56
third_party/jerryscript/tools/vera++/scripts/rules/jerry_identifier_no_space_bracket.tcl
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
|
||||
proc check_part_of_the_file {file line_num col_start col_end} {
|
||||
if {$col_start == $col_end} {
|
||||
return
|
||||
}
|
||||
|
||||
set line [getLine $file $line_num]
|
||||
set line [string range $line $col_start $col_end]
|
||||
|
||||
if {[regexp {[[:alnum:]_][\s]+\[} $line]} {
|
||||
report $file $line_num "there should be no spaces between identifier and left bracket"
|
||||
}
|
||||
}
|
||||
|
||||
foreach fileName [getSourceFileNames] {
|
||||
set checkLine 1
|
||||
set checkColStart 0
|
||||
set seenOmitToken false
|
||||
foreach token [getTokens $fileName 1 0 -1 -1 {}] {
|
||||
set lineNumber [lindex $token 1]
|
||||
set colNumber [lindex $token 2]
|
||||
set tokenType [lindex $token 3]
|
||||
|
||||
if {$checkLine != $lineNumber} {
|
||||
if {!$seenOmitToken} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart end
|
||||
}
|
||||
set checkColStart $colNumber
|
||||
set checkLine $lineNumber
|
||||
} elseif {$seenOmitToken} {
|
||||
set checkColStart $colNumber
|
||||
}
|
||||
|
||||
if {$tokenType in {ccomment cppcomment stringlit}} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
|
||||
set seenOmitToken true
|
||||
} else {
|
||||
set seenOmitToken false
|
||||
}
|
||||
}
|
||||
}
|
127
third_party/jerryscript/tools/vera++/scripts/rules/jerry_indentation.tcl
vendored
Normal file
127
third_party/jerryscript/tools/vera++/scripts/rules/jerry_indentation.tcl
vendored
Normal file
|
@ -0,0 +1,127 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
# 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.
|
||||
|
||||
# Indentation
|
||||
|
||||
foreach fileName [getSourceFileNames] {
|
||||
set indent 0
|
||||
set lastCheckedLineNumber -1
|
||||
set is_in_comment "no"
|
||||
set is_in_pp_define "no"
|
||||
set is_in_class "no"
|
||||
set is_in_template "no"
|
||||
set parentheses_level 0
|
||||
set template_brackets_level 0
|
||||
|
||||
foreach token [getTokens $fileName 1 0 -1 -1 {}] {
|
||||
set type [lindex $token 3]
|
||||
set lineNumber [lindex $token 1]
|
||||
|
||||
if {$is_in_comment == "yes"} {
|
||||
set is_in_comment "no"
|
||||
}
|
||||
|
||||
if {$type == "newline"} {
|
||||
set is_in_pp_define "no"
|
||||
} elseif {$type == "class"} {
|
||||
set is_in_class "yes"
|
||||
} elseif {$type == "template"} {
|
||||
set is_in_template "yes"
|
||||
} elseif {$is_in_class == "yes" && $type == "semicolon" && $indent == 0} {
|
||||
set is_in_class "no"
|
||||
} elseif {$type == "ccomment"} {
|
||||
set is_in_comment "yes"
|
||||
} elseif {[string first "pp_" $type] == 0} {
|
||||
if {$type == "pp_define"} {
|
||||
set is_in_pp_define "yes"
|
||||
}
|
||||
|
||||
set lastCheckedLineNumber $lineNumber
|
||||
} elseif {$type == "space"} {
|
||||
} elseif {$type != "eof"} {
|
||||
if {$type == "rightbrace" && $indent > 0} {
|
||||
incr indent -2
|
||||
}
|
||||
|
||||
if {$is_in_pp_define == "no" && $is_in_comment == "no" && $parentheses_level == 0 &&
|
||||
$is_in_template == "no"} {
|
||||
set line [getLine $fileName $lineNumber]
|
||||
|
||||
if {$lineNumber != $lastCheckedLineNumber} {
|
||||
if {[regexp {^[[:blank:]]*} $line match]} {
|
||||
set real_indent [string length $match]
|
||||
if {$indent != $real_indent} {
|
||||
if {[regexp {^[[:blank:]]*(private:|public:|protected:)} $line]} {
|
||||
if {$indent != $real_indent + 2} {
|
||||
set exp_indent [expr {$indent - 2}]
|
||||
report $fileName $lineNumber "Indentation: $real_indent -> $exp_indent. Line: '$line'"
|
||||
}
|
||||
} elseif {![regexp {^[[:alnum:]_]{1,}:$} $line] || $real_indent != 0} {
|
||||
report $fileName $lineNumber "Indentation: $real_indent -> $indent. Line: '$line'"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {$lineNumber == $lastCheckedLineNumber} {
|
||||
if {$type == "leftbrace"} {
|
||||
if {![regexp {^[[:blank:]]*\{[[:blank:]]*$} $line]
|
||||
&& ![regexp {[^\{=]=[^\{=]\{.*\},?} $line]} {
|
||||
report $fileName $lineNumber "Left brace is not the only non-space character in the line: '$line'"
|
||||
}
|
||||
}
|
||||
if {$type == "rightbrace"} {
|
||||
if {![regexp {^.* = .*\{.*\}[,;]?$} $line]
|
||||
&& ![regexp {[^\{=]=[^\{=]\{.*\}[,;]?} $line]} {
|
||||
report $fileName $lineNumber "Right brace is not first non-space character in the line: '$line'"
|
||||
}
|
||||
}
|
||||
}
|
||||
if {$type == "rightbrace"} {
|
||||
if {![regexp {^[[:blank:]]*\};?((( [a-z_\(][a-z0-9_\(\)]{0,}){1,})?;| /\*.*\*/| //.*)?$} $line]
|
||||
&& ![regexp {[^\{=]=[^\{=]\{.*\}[,;]?} $line]} {
|
||||
report $fileName $lineNumber "Right brace is not the only non-space character in the line and \
|
||||
is not single right brace followed by \[a-z0-9_() \] string and single semicolon character: '$line'"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if {$type == "leftbrace"} {
|
||||
if {![regexp {^extern "C"} [getLine $fileName [expr {$lineNumber - 1}]]]} {
|
||||
incr indent 2
|
||||
}
|
||||
} elseif {$type == "leftparen"} {
|
||||
incr parentheses_level 1
|
||||
} elseif {$type == "rightparen"} {
|
||||
incr parentheses_level -1
|
||||
}
|
||||
|
||||
if {$is_in_template == "yes"} {
|
||||
if {$type == "less"} {
|
||||
incr template_brackets_level
|
||||
} elseif {$type == "greater"} {
|
||||
incr template_brackets_level -1
|
||||
if {$template_brackets_level == 0} {
|
||||
set is_in_template "no"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set lastCheckedLineNumber $lineNumber
|
||||
}
|
||||
}
|
||||
}
|
27
third_party/jerryscript/tools/vera++/scripts/rules/jerry_max_line_length.tcl
vendored
Normal file
27
third_party/jerryscript/tools/vera++/scripts/rules/jerry_max_line_length.tcl
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
|
||||
set maxLen 120
|
||||
|
||||
foreach f [getSourceFileNames] {
|
||||
set lineNumber 1
|
||||
foreach line [getAllLines $f] {
|
||||
if {[string length $line] > $maxLen} {
|
||||
report $f $lineNumber "line is longer than ${maxLen} characters"
|
||||
}
|
||||
incr lineNumber
|
||||
}
|
||||
}
|
56
third_party/jerryscript/tools/vera++/scripts/rules/jerry_no_space_after_opening_parentheses.tcl
vendored
Normal file
56
third_party/jerryscript/tools/vera++/scripts/rules/jerry_no_space_after_opening_parentheses.tcl
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
|
||||
proc check_part_of_the_file {file line_num col_start col_end} {
|
||||
if {$col_start == $col_end} {
|
||||
return
|
||||
}
|
||||
|
||||
set line [getLine $file $line_num]
|
||||
set line [string range $line $col_start $col_end]
|
||||
|
||||
if {[regexp {\(+[[:blank:]]} $line]} {
|
||||
report $file $line_num "there should be no blank characters after opening parentheses"
|
||||
}
|
||||
}
|
||||
|
||||
foreach fileName [getSourceFileNames] {
|
||||
set checkLine 1
|
||||
set checkColStart 0
|
||||
set seenOmitToken false
|
||||
foreach token [getTokens $fileName 1 0 -1 -1 {}] {
|
||||
set lineNumber [lindex $token 1]
|
||||
set colNumber [lindex $token 2]
|
||||
set tokenType [lindex $token 3]
|
||||
|
||||
if {$checkLine != $lineNumber} {
|
||||
if {!$seenOmitToken} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart end
|
||||
}
|
||||
set checkColStart $colNumber
|
||||
set checkLine $lineNumber
|
||||
} elseif {$seenOmitToken} {
|
||||
set checkColStart $colNumber
|
||||
}
|
||||
|
||||
if {$tokenType in {ccomment cppcomment stringlit}} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
|
||||
set seenOmitToken true
|
||||
} else {
|
||||
set seenOmitToken false
|
||||
}
|
||||
}
|
||||
}
|
57
third_party/jerryscript/tools/vera++/scripts/rules/jerry_no_space_before_closing_parentheses.tcl
vendored
Normal file
57
third_party/jerryscript/tools/vera++/scripts/rules/jerry_no_space_before_closing_parentheses.tcl
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# Copyright 2015-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.
|
||||
# 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.
|
||||
|
||||
proc check_part_of_the_file {file line_num col_start col_end} {
|
||||
if {$col_start == $col_end} {
|
||||
return
|
||||
}
|
||||
|
||||
set line [getLine $file $line_num]
|
||||
set line [string range $line $col_start $col_end]
|
||||
|
||||
if {[regexp {[[:graph:]][[:blank:]]+\)} $line]} {
|
||||
report $file $line_num "there should be no blank characters before closing parentheses"
|
||||
}
|
||||
}
|
||||
|
||||
foreach fileName [getSourceFileNames] {
|
||||
set checkLine 1
|
||||
set checkColStart 0
|
||||
set seenOmitToken false
|
||||
foreach token [getTokens $fileName 1 0 -1 -1 {}] {
|
||||
set lineNumber [lindex $token 1]
|
||||
set colNumber [lindex $token 2]
|
||||
set tokenType [lindex $token 3]
|
||||
|
||||
if {$checkLine != $lineNumber} {
|
||||
if {!$seenOmitToken} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart end
|
||||
}
|
||||
set checkColStart $colNumber
|
||||
set checkLine $lineNumber
|
||||
} elseif {$seenOmitToken} {
|
||||
set checkColStart $colNumber
|
||||
}
|
||||
|
||||
if {$tokenType in {ccomment cppcomment stringlit}} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
|
||||
set seenOmitToken true
|
||||
} else {
|
||||
set seenOmitToken false
|
||||
}
|
||||
}
|
||||
}
|
25
third_party/jerryscript/tools/vera++/scripts/rules/jerry_no_tabs.tcl
vendored
Normal file
25
third_party/jerryscript/tools/vera++/scripts/rules/jerry_no_tabs.tcl
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
|
||||
foreach f [getSourceFileNames] {
|
||||
set lineNumber 1
|
||||
foreach line [getAllLines $f] {
|
||||
if {[regexp {\t} $line]} {
|
||||
report $f $lineNumber "tabs are not allowed"
|
||||
}
|
||||
incr lineNumber
|
||||
}
|
||||
}
|
25
third_party/jerryscript/tools/vera++/scripts/rules/jerry_no_trailing_spaces.tcl
vendored
Normal file
25
third_party/jerryscript/tools/vera++/scripts/rules/jerry_no_trailing_spaces.tcl
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
|
||||
foreach f [getSourceFileNames] {
|
||||
set lineNumber 1
|
||||
foreach line [getAllLines $f] {
|
||||
if {[regexp {[[:blank:]]$} $line]} {
|
||||
report $f $lineNumber "trailing space is not allowed"
|
||||
}
|
||||
incr lineNumber
|
||||
}
|
||||
}
|
59
third_party/jerryscript/tools/vera++/scripts/rules/jerry_pointer_declarator_space.tcl
vendored
Normal file
59
third_party/jerryscript/tools/vera++/scripts/rules/jerry_pointer_declarator_space.tcl
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
proc check_part_of_the_file {file line_num col_start col_end} {
|
||||
if {$col_start == $col_end} {
|
||||
return
|
||||
}
|
||||
|
||||
set line [getLine $file $line_num]
|
||||
set line [string range $line $col_start $col_end]
|
||||
|
||||
if {[regexp {\w\*\s\w+} $line]
|
||||
|| [regexp {\w\*\)} $line]
|
||||
|| [regexp {\w\*$} $line]} {
|
||||
report $file $line_num "there should be a space between the referenced type and the pointer declarator."
|
||||
}
|
||||
}
|
||||
|
||||
foreach fileName [getSourceFileNames] {
|
||||
set checkLine 1
|
||||
set checkColStart 0
|
||||
set seenOmitToken false
|
||||
foreach token [getTokens $fileName 1 0 -1 -1 {}] {
|
||||
set lineNumber [lindex $token 1]
|
||||
set colNumber [lindex $token 2]
|
||||
set tokenType [lindex $token 3]
|
||||
|
||||
if {$checkLine != $lineNumber} {
|
||||
if {!$seenOmitToken} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart end
|
||||
}
|
||||
set checkColStart $colNumber
|
||||
set checkLine $lineNumber
|
||||
} elseif {$seenOmitToken} {
|
||||
set checkColStart $colNumber
|
||||
}
|
||||
|
||||
if {$tokenType in {ccomment cppcomment stringlit}} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
|
||||
set seenOmitToken true
|
||||
} else {
|
||||
set seenOmitToken false
|
||||
}
|
||||
}
|
||||
}
|
282
third_party/jerryscript/tools/vera++/scripts/rules/jerry_switch_case.tcl
vendored
Normal file
282
third_party/jerryscript/tools/vera++/scripts/rules/jerry_switch_case.tcl
vendored
Normal file
|
@ -0,0 +1,282 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# 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.
|
||||
|
||||
# switch-case
|
||||
|
||||
foreach fileName [getSourceFileNames] {
|
||||
set is_in_comment "no"
|
||||
set is_in_pp_define "no"
|
||||
|
||||
foreach token [getTokens $fileName 1 0 -1 -1 {}] {
|
||||
set type [lindex $token 3]
|
||||
set lineNumber [lindex $token 1]
|
||||
|
||||
if {$is_in_comment == "yes"} {
|
||||
set is_in_comment "no"
|
||||
}
|
||||
|
||||
if {$type == "newline"} {
|
||||
set is_in_pp_define "no"
|
||||
} elseif {$type == "ccomment"} {
|
||||
set is_in_comment "yes"
|
||||
} elseif {[string first "pp_" $type] == 0} {
|
||||
if {$type == "pp_define"} {
|
||||
set is_in_pp_define "yes"
|
||||
}
|
||||
} elseif {$type == "space"} {
|
||||
} elseif {$type != "eof"} {
|
||||
if {$is_in_pp_define == "no" && $type == "switch"} {
|
||||
set next_token_start [lindex $token 2]
|
||||
incr next_token_start 1
|
||||
set line_num 0
|
||||
set state "switch"
|
||||
set case_block "no"
|
||||
set seen_braces 0
|
||||
foreach next_token [getTokens $fileName $lineNumber $next_token_start -1 -1 {}] {
|
||||
set next_token_type [lindex $next_token 3]
|
||||
set next_token_value [lindex $next_token 0]
|
||||
if {$state == "switch"} {
|
||||
if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
|
||||
continue
|
||||
} elseif {$next_token_type == "leftbrace"} {
|
||||
set state "first-case"
|
||||
continue
|
||||
} else {
|
||||
# TODO: check switch
|
||||
continue
|
||||
}
|
||||
} elseif {$state == "first-case"} {
|
||||
if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
|
||||
continue
|
||||
} elseif {$next_token_type == "case"} {
|
||||
set state "case"
|
||||
continue
|
||||
} elseif {$next_token_type == "default"} {
|
||||
set state "default"
|
||||
continue
|
||||
} else {
|
||||
# Macros magic: give up
|
||||
break
|
||||
}
|
||||
} elseif {$state == "case"} {
|
||||
if {$next_token_type == "space"} {
|
||||
set state "space-after-case"
|
||||
continue
|
||||
} else {
|
||||
report $fileName [lindex $next_token 1] "There should be single space character after 'case' keyword (state $state)"
|
||||
}
|
||||
} elseif {$state == "space-after-case"} {
|
||||
if {$next_token_type != "identifier" && $next_token_type != "intlit" && $next_token_type != "charlit" && $next_token_type != "sizeof"} {
|
||||
report $fileName [lindex $next_token 1] "There should be single space character after 'case' keyword (state $state, next_token_type $next_token_type)"
|
||||
} else {
|
||||
set state "case-label"
|
||||
continue
|
||||
}
|
||||
} elseif {$state == "case-label" || $state == "default"} {
|
||||
set case_block "no"
|
||||
if {$next_token_type != "colon"} {
|
||||
continue
|
||||
} else {
|
||||
set state "colon"
|
||||
continue
|
||||
}
|
||||
} elseif {$state == "after-colon-preprocessor"} {
|
||||
if {$next_token_type == "newline"} {
|
||||
set state "colon"
|
||||
}
|
||||
} elseif {$state == "colon"} {
|
||||
if {$next_token_type == "space" || $next_token_type == "newline"} {
|
||||
continue
|
||||
} elseif {$next_token_type == "ccomment"} {
|
||||
if {[string match "*FALL*" $next_token_value]} {
|
||||
set state "fallthru"
|
||||
set line_num [lindex $next_token 1]
|
||||
continue
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
} elseif {$next_token_type == "case"} {
|
||||
set state "case"
|
||||
continue
|
||||
} elseif {$next_token_type == "default"} {
|
||||
set state "default"
|
||||
continue
|
||||
} elseif {$next_token_type == "leftbrace"} {
|
||||
set case_block "yes"
|
||||
set state "wait-for-break"
|
||||
continue
|
||||
} elseif {$next_token_type == "identifier"} {
|
||||
if {[string compare "JERRY_UNREACHABLE" $next_token_value] == 0
|
||||
|| [string first "JERRY_UNIMPLEMENTED" $next_token_value] == 0} {
|
||||
set state "wait-for-semicolon"
|
||||
continue
|
||||
} else {
|
||||
set state "wait-for-break"
|
||||
continue
|
||||
}
|
||||
} elseif {$next_token_type == "break"
|
||||
|| $next_token_type == "continue"
|
||||
|| $next_token_type == "return"} {
|
||||
set state "wait-for-semicolon"
|
||||
continue
|
||||
} elseif {[string first "pp_" $next_token_type] == 0} {
|
||||
set state "after-colon-preprocessor"
|
||||
} else {
|
||||
set state "wait-for-break"
|
||||
continue
|
||||
}
|
||||
} elseif {$state == "wait-for-semicolon"} {
|
||||
if {$next_token_type == "semicolon"} {
|
||||
set state "break"
|
||||
}
|
||||
continue
|
||||
} elseif {$state == "wait-for-break"} {
|
||||
if {$next_token_type == "case" || $next_token_type == "default"} {
|
||||
report $fileName [lindex $next_token 1] "Missing break, continue or FALLTHRU comment before case (state $state)"
|
||||
} elseif {$next_token_type == "leftbrace"} {
|
||||
set state "inside-braces"
|
||||
incr seen_braces 1
|
||||
continue
|
||||
} elseif {$next_token_type == "rightbrace"} {
|
||||
if {$case_block == "yes"} {
|
||||
set state "case-blocks-end"
|
||||
continue
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} elseif {[string compare "JERRY_UNREACHABLE" $next_token_value] == 0
|
||||
|| [string first "JERRY_UNIMPLEMENTED" $next_token_value] == 0} {
|
||||
set state "wait-for-semicolon"
|
||||
continue
|
||||
} elseif {$next_token_type == "ccomment" && [string match "*FALL*" $next_token_value]} {
|
||||
set state "fallthru"
|
||||
set line_num [lindex $next_token 1]
|
||||
continue
|
||||
} elseif {$next_token_type == "break"
|
||||
|| $next_token_type == "continue"
|
||||
|| $next_token_type == "return"
|
||||
|| $next_token_type == "goto"} {
|
||||
set state "wait-for-semicolon"
|
||||
continue
|
||||
}
|
||||
continue
|
||||
} elseif {$state == "break" || $state == "fallthru"} {
|
||||
if {$case_block == "no"} {
|
||||
if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
|
||||
continue
|
||||
} elseif {$next_token_type == "case"} {
|
||||
set state "case"
|
||||
continue
|
||||
} elseif {$next_token_type == "default"} {
|
||||
set state "default"
|
||||
continue
|
||||
} elseif {$next_token_type == "leftbrace"} {
|
||||
set state "inside-braces"
|
||||
incr seen_braces 1
|
||||
continue
|
||||
} elseif {$next_token_type == "rightbrace"} {
|
||||
lappend switch_ends [lindex $next_token 1]
|
||||
break
|
||||
} elseif {$next_token_type == "break"
|
||||
|| $next_token_type == "continue"
|
||||
|| $next_token_type == "return"} {
|
||||
set state "wait-for-semicolon"
|
||||
continue
|
||||
} else {
|
||||
set state "wait-for-break"
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
|
||||
continue
|
||||
} elseif {$next_token_type == "case"} {
|
||||
set state "case"
|
||||
continue
|
||||
} elseif {$next_token_type == "default"} {
|
||||
set state "default"
|
||||
continue
|
||||
} elseif {$next_token_type == "leftbrace"} {
|
||||
set state "inside-braces"
|
||||
incr seen_braces 1
|
||||
continue
|
||||
} elseif {$next_token_type == "rightbrace"} {
|
||||
set state "after-rightbrace"
|
||||
continue
|
||||
} elseif {$next_token_type == "break"
|
||||
|| $next_token_type == "continue"
|
||||
|| $next_token_type == "return"} {
|
||||
set state "wait-for-semicolon"
|
||||
continue
|
||||
} else {
|
||||
set state "wait-for-break"
|
||||
continue
|
||||
}
|
||||
}
|
||||
} elseif {$state == "inside-braces"} {
|
||||
if {$next_token_type == "rightbrace"} {
|
||||
incr seen_braces -1
|
||||
if {$seen_braces == 0} {
|
||||
set state "wait-for-break"
|
||||
continue
|
||||
}
|
||||
} elseif {$next_token_type == "leftbrace"} {
|
||||
incr seen_braces 1
|
||||
}
|
||||
continue
|
||||
} elseif {$state == "after-rightbrace-preprocessor"} {
|
||||
if {$next_token_type == "newline"} {
|
||||
set state "after-rightbrace"
|
||||
}
|
||||
} elseif {$state == "after-rightbrace"} {
|
||||
if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
|
||||
continue
|
||||
} elseif {$next_token_type == "case"} {
|
||||
set state "case"
|
||||
continue
|
||||
} elseif {$next_token_type == "default"} {
|
||||
set state "default"
|
||||
continue
|
||||
} elseif {$next_token_type == "rightbrace"} {
|
||||
lappend switch_ends [lindex $next_token 1]
|
||||
break
|
||||
} elseif {[string first "pp_" $next_token_type] == 0} {
|
||||
set state "after-rightbrace-preprocessor"
|
||||
} else {
|
||||
report $fileName [lindex $next_token 1] "There should be 'case' or 'default' (state $state)"
|
||||
}
|
||||
} elseif {$state == "case-blocks-end-preprocessor"} {
|
||||
if {$next_token_type == "newline"} {
|
||||
set state "case-blocks-end"
|
||||
}
|
||||
} elseif {$state == "case-blocks-end"} {
|
||||
if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
|
||||
continue
|
||||
} elseif {$next_token_type == "rightbrace"} {
|
||||
lappend switch_ends [lindex $next_token 1]
|
||||
break
|
||||
} elseif {[string first "pp_" $next_token_type] == 0} {
|
||||
set state "case-blocks-end-preprocessor"
|
||||
} else {
|
||||
report $fileName [lindex $next_token 1] "Missing break, continue or FALLTHRU comment before rightbrace (state $state)"
|
||||
}
|
||||
} else {
|
||||
report $fileName [lindex $next_token 1] "Unknown state: $state"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
57
third_party/jerryscript/tools/vera++/scripts/rules/jerry_typecast_space_parentheses.tcl
vendored
Normal file
57
third_party/jerryscript/tools/vera++/scripts/rules/jerry_typecast_space_parentheses.tcl
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/tclsh
|
||||
|
||||
# Copyright 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.
|
||||
# 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.
|
||||
|
||||
proc check_part_of_the_file {file line_num col_start col_end} {
|
||||
if {$col_start == $col_end} {
|
||||
return
|
||||
}
|
||||
|
||||
set line [getLine $file $line_num]
|
||||
set line [string range $line $col_start $col_end]
|
||||
|
||||
if {[regexp {\)\w} $line]} {
|
||||
report $file $line_num "there should be exactly one space after right parentheses"
|
||||
}
|
||||
}
|
||||
|
||||
foreach fileName [getSourceFileNames] {
|
||||
set checkLine 1
|
||||
set checkColStart 0
|
||||
set seenOmitToken false
|
||||
foreach token [getTokens $fileName 1 0 -1 -1 {}] {
|
||||
set lineNumber [lindex $token 1]
|
||||
set colNumber [lindex $token 2]
|
||||
set tokenType [lindex $token 3]
|
||||
|
||||
if {$checkLine != $lineNumber} {
|
||||
if {!$seenOmitToken} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart end
|
||||
}
|
||||
set checkColStart $colNumber
|
||||
set checkLine $lineNumber
|
||||
} elseif {$seenOmitToken} {
|
||||
set checkColStart $colNumber
|
||||
}
|
||||
|
||||
if {$tokenType in {ccomment cppcomment stringlit}} {
|
||||
check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
|
||||
set seenOmitToken true
|
||||
} else {
|
||||
set seenOmitToken false
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue