Skip to content

Commit

Permalink
Test universal newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
akosthekiss committed Jun 9, 2018
1 parent 4dad260 commit 180980e
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 167 deletions.
307 changes: 154 additions & 153 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,164 +18,165 @@ matrix:
include:
- env:
- JOBNAME="Checks"
- OPTS="--check-signed-off=travis --check-cppcheck --check-doxygen --check-vera --check-license --check-magic-strings --check-pylint"
# - OPTS="--check-signed-off=travis --check-cppcheck --check-doxygen --check-vera --check-license --check-magic-strings --check-pylint"
- OPTS="--check-license"
install: pip install --user pylint==1.6.5
addons:
apt:
packages: [doxygen, cppcheck, vera++]

- env:
- JOBNAME="Linux/x86-64 Build & Correctness Tests"
- OPTS="--quiet --jerry-tests --jerry-test-suite"

- env:
- JOBNAME="Linux/x86 (cpointer-32bit) Build & Correctness Tests"
- OPTS="--quiet --jerry-tests --jerry-test-suite --buildoptions=--jerry-libc=off,--compile-flag=-m32,--cpointer-32bit=on"
addons:
apt:
packages: [gcc-multilib]

- env:
- JOBNAME="Linux/ARM Build & Correctness Tests"
- OPTS="--quiet --jerry-tests --jerry-test-suite --toolchain=cmake/toolchain_linux_armv7l.cmake --buildoptions=--linker-flag=-static"
- RUNTIME=qemu-arm-static
- TIMEOUT=300
addons:
apt:
packages: [gcc-arm-linux-gnueabihf, libc6-dev-armhf-cross, qemu-user-static]

- env:
- JOBNAME="OSX/x86-64 Build, Correctness & Unit Tests"
- OPTS="--quiet --jerry-tests --jerry-test-suite --unittests"
os: osx
install: tools/brew-install-deps.sh

- env:
- JOBNAME="Build Tests"
- OPTS="--buildoption-test"
addons:
apt:
packages: [gcc-multilib]

- env:
- JOBNAME="Unit Tests"
- OPTS="--unittests"

- env:
- JOBNAME="Unit Tests (INIT_FINI)"
- OPTS="--unittests --buildoptions=--cmake-param=-DFEATURE_INIT_FINI=ON"

- env:
- JOBNAME="Debugger Tests"
- OPTS="--jerry-debugger"

- env:
- JOBNAME="Conformance Tests"
- OPTS="--test262"
- TZ=America/Los_Angeles

- env:
- JOBNAME="ASAN Tests"
- OPTS="--quiet --jerry-tests --jerry-test-suite --skip-list=parser-oom.js --buildoptions=--compile-flag=-fsanitize=address,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--compile-flag=-O2,--debug,--jerry-libc=off,--system-allocator=on,--linker-flag=-fuse-ld=gold"
- ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=true:strict_init_order=true
- TIMEOUT=600
compiler: gcc-5
addons:
apt:
sources: ubuntu-toolchain-r-test
packages: [gcc-5, gcc-5-multilib]

- env:
- JOBNAME="UBSAN Tests"
- OPTS="--quiet --jerry-tests --jerry-test-suite --skip-list=parser-oom.js --buildoptions=--compile-flag=-fsanitize=undefined,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--debug,--jerry-libc=off,--system-allocator=on,--linker-flag=-fuse-ld=gold"
- UBSAN_OPTIONS=print_stacktrace=1
- TIMEOUT=600
compiler: gcc-5
addons:
apt:
sources: ubuntu-toolchain-r-test
packages: [gcc-5, gcc-5-multilib]

- env:
- JOBNAME="Coverity Scan"
# Declaration of the encrypted COVERITY_SCAN_TOKEN, created via the
# "travis encrypt" command using the project repo's public key.
- secure: "V7BdXv3FCVkFGEfKfWto6I+Sytou1zTCGyn49xurkBfKNsG/3vbkXfsbK1m6lCZxmY7W/1odpfjixpAPZgy2L4FgPZK6/UyVvC8pIFjDOubcEniN48haleSvm/ZFPLDifxDL2+VVFtK1oRYPtDBzzSoUCcfwovgk+Wy+tSBnhnyRLqO/WaI6PqFof7ECYMTRlJVjioZARVP4YmkBruIPmGDdR/3EvwowlxfuiFoPheix61ug4x3tpTBW2qWgvFjDyCZXFz4pJrBQPTAIbyKMxHcBykJjl9eR+dWAOsvE1Uw48tFOJxjKDfUttVQUPsyKFllmcCVS0fDYB5pzZOmRUPxJmox1jt8J1FY85Ri1PGY0THBPM2H7to4Yf2418Y3539epbN8p+79dwaM7e2OiJ2owukbWI7PoNqIz5DV5zxpIKsOQfeWuNLJOgsBePEIU7lz133Si/2d5W/7If46B1d+hZRBJfSYksgDqDU6G/voZkPf0K5bKe2O2BxiIW1DYk4yQ1ecZAkqGjZ8jG3zYGMG3mSF4VyuU4UGFG1Pg8fw7Ap5zuHxSVY1H9dtu4T6JQG3aj/x1omlzfw48DjgkwxVhf7Xvl3yfR7pzydYheLX3MZYtcVo7rWnglZFZoUjWDK1StbmzsvPftvwWtoDTWlzo4xeSXhahSJvJyc4U8Wc="
addons:
coverity_scan:
project:
name: "jerryscript-project/jerryscript"
description: "Ultra-lightweight JavaScript engine for the Internet of Things."
notification_email: [email protected]
build_command: "tools/build.py --clean"
branch_pattern: master
script: true # Changed to nop, Coverity Scan has already built the project by the time 'script' stage is reached.

- env: JOBNAME="SonarQube"
addons:
sonarcloud:
organization: "jerryscript-project"
token:
secure: "C1QD99nllAQndSDj4uIQPWCK0jBYrC5P0IrpdhfG7li7uvdzphUM++z3zkhYeeTJR3flw/cr8d9saYlbMjGw2eZ7AdJPFy4FJ1doBXD2amIuepaG1e829SLnJner9VA+d/8j28m7lZNtvZF5efbrS4KOicijNixmJy2PKG0K2035fs6MHLdywF8cJhyMaoRiMvYahIZEjXMvPBSgG1m4+A3PpzyN8XijwOT47cVtCLav4L21Mc7LcHsrc3LeyhtEJ+cs7Lx9WDQDwXX9iCRTA5ByqrXsS4rBV/N3lJI5M9p68Yj94Qy2OvVeCmUZ4ezwuuwkX00vBUk2f4eZx3oFAp973ekA8EGm/5qEvHVcbjHoHLbfUxsAKQHVoExXGdM5r1KeVgxLDT2FSQnBZLoxIrtGOUqFEOL4WX5YaQNoUKvYFO+CNvsMQkNg65QzLinRfqcH20KjzAsVeFwVI/j87J2VjooM8910savpw53iVBNPqmO/lG3kzFL7L2p1FeOuyEg9ANAbMhAXt3SL2srT0xni+ysg4Iwq+IkU+hkQWsvM8Voz+QJmiotFsi1Pzakcu3IOlT8lVVyn5q0z59YVDht/6if7acqkZ3X5vldeNIZYkImmYhMebScxVhzAa8AS6/81A+zJ8lW1+RWJQtP3uPM1+Dq18iFkPrCEMZwtoXI="
script:
if [[ "${TRAVIS_REPO_SLUG}" == "jerryscript-project/jerryscript"
&& ${TRAVIS_BRANCH} == "master"
&& ${TRAVIS_EVENT_TYPE} == "push" ]];
then
git fetch --unshallow;
build-wrapper-linux-x86-64 --out-dir bw-output ./tools/build.py;
sonar-scanner -Dsonar.projectVersion="${TRAVIS_COMMIT}";
fi
cache:
directories:
- '${HOME}/.sonar/cache'

- env: JOBNAME="ESP8266 Build Test"
cache: ccache
install: make -f ./targets/esp8266/Makefile.travis install-noapt
script: make -f ./targets/esp8266/Makefile.travis script
addons:
apt:
packages: [gperf, texinfo, wget]

- env: JOBNAME="Mbed OS 5/K64F Build Test"
addons:
apt:
sources:
- sourceline: ppa:team-gcc-arm-embedded/ppa
packages: [gcc-arm-embedded]
install: make -f ./targets/mbedos5/Makefile.travis install
script: make -f ./targets/mbedos5/Makefile.travis script

- env: JOBNAME="NuttX/STM32F4 Build Test"
install: make -f targets/nuttx-stm32f4/Makefile.travis install-noapt
script: make -f targets/nuttx-stm32f4/Makefile.travis script
addons:
apt:
packages: [gcc-arm-none-eabi, libnewlib-arm-none-eabi, gperf]

- env: JOBNAME="RIOT/STM32F4 Build Test"
install: make -f ./targets/riot-stm32f4/Makefile.travis install-noapt
script: make -f ./targets/riot-stm32f4/Makefile.travis script
addons:
apt:
packages: [gcc-arm-none-eabi, libnewlib-arm-none-eabi]

- env: JOBNAME="Tizen RT/Artik053 Build Test"
addons:
apt:
sources:
- sourceline: ppa:team-gcc-arm-embedded/ppa
packages: [gcc-arm-embedded]
install: make -f ./targets/tizenrt-artik053/Makefile.travis install
script: make -f ./targets/tizenrt-artik053/Makefile.travis script

- env: JOBNAME="Zephyr/Arduino 101 Build Test"
install: make -f ./targets/zephyr/Makefile.travis install-noapt
script: make -f ./targets/zephyr/Makefile.travis script
addons:
apt:
packages: [gperf, dfu-util, device-tree-compiler, python3-ply, python3-pip]
# - env:
# - JOBNAME="Linux/x86-64 Build & Correctness Tests"
# - OPTS="--quiet --jerry-tests --jerry-test-suite"
#
# - env:
# - JOBNAME="Linux/x86 (cpointer-32bit) Build & Correctness Tests"
# - OPTS="--quiet --jerry-tests --jerry-test-suite --buildoptions=--jerry-libc=off,--compile-flag=-m32,--cpointer-32bit=on"
# addons:
# apt:
# packages: [gcc-multilib]
#
# - env:
# - JOBNAME="Linux/ARM Build & Correctness Tests"
# - OPTS="--quiet --jerry-tests --jerry-test-suite --toolchain=cmake/toolchain_linux_armv7l.cmake --buildoptions=--linker-flag=-static"
# - RUNTIME=qemu-arm-static
# - TIMEOUT=300
# addons:
# apt:
# packages: [gcc-arm-linux-gnueabihf, libc6-dev-armhf-cross, qemu-user-static]
#
# - env:
# - JOBNAME="OSX/x86-64 Build, Correctness & Unit Tests"
# - OPTS="--quiet --jerry-tests --jerry-test-suite --unittests"
# os: osx
# install: tools/brew-install-deps.sh
#
# - env:
# - JOBNAME="Build Tests"
# - OPTS="--buildoption-test"
# addons:
# apt:
# packages: [gcc-multilib]
#
# - env:
# - JOBNAME="Unit Tests"
# - OPTS="--unittests"
#
# - env:
# - JOBNAME="Unit Tests (INIT_FINI)"
# - OPTS="--unittests --buildoptions=--cmake-param=-DFEATURE_INIT_FINI=ON"
#
# - env:
# - JOBNAME="Debugger Tests"
# - OPTS="--jerry-debugger"
#
# - env:
# - JOBNAME="Conformance Tests"
# - OPTS="--test262"
# - TZ=America/Los_Angeles
#
# - env:
# - JOBNAME="ASAN Tests"
# - OPTS="--quiet --jerry-tests --jerry-test-suite --skip-list=parser-oom.js --buildoptions=--compile-flag=-fsanitize=address,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--compile-flag=-O2,--debug,--jerry-libc=off,--system-allocator=on,--linker-flag=-fuse-ld=gold"
# - ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=true:strict_init_order=true
# - TIMEOUT=600
# compiler: gcc-5
# addons:
# apt:
# sources: ubuntu-toolchain-r-test
# packages: [gcc-5, gcc-5-multilib]
#
# - env:
# - JOBNAME="UBSAN Tests"
# - OPTS="--quiet --jerry-tests --jerry-test-suite --skip-list=parser-oom.js --buildoptions=--compile-flag=-fsanitize=undefined,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--debug,--jerry-libc=off,--system-allocator=on,--linker-flag=-fuse-ld=gold"
# - UBSAN_OPTIONS=print_stacktrace=1
# - TIMEOUT=600
# compiler: gcc-5
# addons:
# apt:
# sources: ubuntu-toolchain-r-test
# packages: [gcc-5, gcc-5-multilib]
#
# - env:
# - JOBNAME="Coverity Scan"
# # Declaration of the encrypted COVERITY_SCAN_TOKEN, created via the
# # "travis encrypt" command using the project repo's public key.
# - secure: "V7BdXv3FCVkFGEfKfWto6I+Sytou1zTCGyn49xurkBfKNsG/3vbkXfsbK1m6lCZxmY7W/1odpfjixpAPZgy2L4FgPZK6/UyVvC8pIFjDOubcEniN48haleSvm/ZFPLDifxDL2+VVFtK1oRYPtDBzzSoUCcfwovgk+Wy+tSBnhnyRLqO/WaI6PqFof7ECYMTRlJVjioZARVP4YmkBruIPmGDdR/3EvwowlxfuiFoPheix61ug4x3tpTBW2qWgvFjDyCZXFz4pJrBQPTAIbyKMxHcBykJjl9eR+dWAOsvE1Uw48tFOJxjKDfUttVQUPsyKFllmcCVS0fDYB5pzZOmRUPxJmox1jt8J1FY85Ri1PGY0THBPM2H7to4Yf2418Y3539epbN8p+79dwaM7e2OiJ2owukbWI7PoNqIz5DV5zxpIKsOQfeWuNLJOgsBePEIU7lz133Si/2d5W/7If46B1d+hZRBJfSYksgDqDU6G/voZkPf0K5bKe2O2BxiIW1DYk4yQ1ecZAkqGjZ8jG3zYGMG3mSF4VyuU4UGFG1Pg8fw7Ap5zuHxSVY1H9dtu4T6JQG3aj/x1omlzfw48DjgkwxVhf7Xvl3yfR7pzydYheLX3MZYtcVo7rWnglZFZoUjWDK1StbmzsvPftvwWtoDTWlzo4xeSXhahSJvJyc4U8Wc="
# addons:
# coverity_scan:
# project:
# name: "jerryscript-project/jerryscript"
# description: "Ultra-lightweight JavaScript engine for the Internet of Things."
# notification_email: [email protected]
# build_command: "tools/build.py --clean"
# branch_pattern: master
# script: true # Changed to nop, Coverity Scan has already built the project by the time 'script' stage is reached.
#
# - env: JOBNAME="SonarQube"
# addons:
# sonarcloud:
# organization: "jerryscript-project"
# token:
# secure: "C1QD99nllAQndSDj4uIQPWCK0jBYrC5P0IrpdhfG7li7uvdzphUM++z3zkhYeeTJR3flw/cr8d9saYlbMjGw2eZ7AdJPFy4FJ1doBXD2amIuepaG1e829SLnJner9VA+d/8j28m7lZNtvZF5efbrS4KOicijNixmJy2PKG0K2035fs6MHLdywF8cJhyMaoRiMvYahIZEjXMvPBSgG1m4+A3PpzyN8XijwOT47cVtCLav4L21Mc7LcHsrc3LeyhtEJ+cs7Lx9WDQDwXX9iCRTA5ByqrXsS4rBV/N3lJI5M9p68Yj94Qy2OvVeCmUZ4ezwuuwkX00vBUk2f4eZx3oFAp973ekA8EGm/5qEvHVcbjHoHLbfUxsAKQHVoExXGdM5r1KeVgxLDT2FSQnBZLoxIrtGOUqFEOL4WX5YaQNoUKvYFO+CNvsMQkNg65QzLinRfqcH20KjzAsVeFwVI/j87J2VjooM8910savpw53iVBNPqmO/lG3kzFL7L2p1FeOuyEg9ANAbMhAXt3SL2srT0xni+ysg4Iwq+IkU+hkQWsvM8Voz+QJmiotFsi1Pzakcu3IOlT8lVVyn5q0z59YVDht/6if7acqkZ3X5vldeNIZYkImmYhMebScxVhzAa8AS6/81A+zJ8lW1+RWJQtP3uPM1+Dq18iFkPrCEMZwtoXI="
# script:
# if [[ "${TRAVIS_REPO_SLUG}" == "jerryscript-project/jerryscript"
# && ${TRAVIS_BRANCH} == "master"
# && ${TRAVIS_EVENT_TYPE} == "push" ]];
# then
# git fetch --unshallow;
# build-wrapper-linux-x86-64 --out-dir bw-output ./tools/build.py;
# sonar-scanner -Dsonar.projectVersion="${TRAVIS_COMMIT}";
# fi
# cache:
# directories:
# - '${HOME}/.sonar/cache'
#
# - env: JOBNAME="ESP8266 Build Test"
# cache: ccache
# install: make -f ./targets/esp8266/Makefile.travis install-noapt
# script: make -f ./targets/esp8266/Makefile.travis script
# addons:
# apt:
# packages: [gperf, texinfo, wget]
#
# - env: JOBNAME="Mbed OS 5/K64F Build Test"
# addons:
# apt:
# sources:
# - sourceline: ppa:team-gcc-arm-embedded/ppa
# packages: [gcc-arm-embedded]
# install: make -f ./targets/mbedos5/Makefile.travis install
# script: make -f ./targets/mbedos5/Makefile.travis script
#
# - env: JOBNAME="NuttX/STM32F4 Build Test"
# install: make -f targets/nuttx-stm32f4/Makefile.travis install-noapt
# script: make -f targets/nuttx-stm32f4/Makefile.travis script
# addons:
# apt:
# packages: [gcc-arm-none-eabi, libnewlib-arm-none-eabi, gperf]
#
# - env: JOBNAME="RIOT/STM32F4 Build Test"
# install: make -f ./targets/riot-stm32f4/Makefile.travis install-noapt
# script: make -f ./targets/riot-stm32f4/Makefile.travis script
# addons:
# apt:
# packages: [gcc-arm-none-eabi, libnewlib-arm-none-eabi]
#
# - env: JOBNAME="Tizen RT/Artik053 Build Test"
# addons:
# apt:
# sources:
# - sourceline: ppa:team-gcc-arm-embedded/ppa
# packages: [gcc-arm-embedded]
# install: make -f ./targets/tizenrt-artik053/Makefile.travis install
# script: make -f ./targets/tizenrt-artik053/Makefile.travis script
#
# - env: JOBNAME="Zephyr/Arduino 101 Build Test"
# install: make -f ./targets/zephyr/Makefile.travis install-noapt
# script: make -f ./targets/zephyr/Makefile.travis script
# addons:
# apt:
# packages: [gperf, dfu-util, device-tree-compiler, python3-ply, python3-pip]

fast_finish: true

Expand Down
22 changes: 22 additions & 0 deletions tests/jerry/windows-line-ending.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright JS Foundation and other contributors, http://js.foundation
//
// 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.

// This test file should use CR-LF styled line endings to test if everything is
// parsed correctly


var value =
5;

assert (value === 5);
28 changes: 14 additions & 14 deletions tools/check-license.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
import settings

LICENSE = re.compile(
r'((#|//|\*) Copyright .*(\r\n|\n|\r)'
r')+\s?\2\3'
r'\s?\2 Licensed under the Apache License, Version 2.0 \(the "License"\);\3'
r'\s?\2 you may not use this file except in compliance with the License.\3'
r'\s?\2 You may obtain a copy of the License at\3'
r'\s?\2\3'
r'\s?\2 http://www.apache.org/licenses/LICENSE-2.0\3'
r'\s?\2\3'
r'\s?\2 Unless required by applicable law or agreed to in writing, software\3'
r'\s?\2 distributed under the License is distributed on an "AS IS" BASIS\3'
r'\s?\2 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\3'
r'\s?\2 See the License for the specific language governing permissions and\3'
r'\s?\2 limitations under the License.\3'
r'((#|//|\*) Copyright .*\n'
r')+\s?\2\n'
r'\s?\2 Licensed under the Apache License, Version 2.0 \(the "License"\);\n'
r'\s?\2 you may not use this file except in compliance with the License.\n'
r'\s?\2 You may obtain a copy of the License at\n'
r'\s?\2\n'
r'\s?\2 http://www.apache.org/licenses/LICENSE-2.0\n'
r'\s?\2\n'
r'\s?\2 Unless required by applicable law or agreed to in writing, software\n'
r'\s?\2 distributed under the License is distributed on an "AS IS" BASIS\n'
r'\s?\2 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n'
r'\s?\2 See the License for the specific language governing permissions and\n'
r'\s?\2 limitations under the License.\n'
)

INCLUDE_DIRS = [
Expand Down Expand Up @@ -79,7 +79,7 @@ def main():
for fname in files:
if any(fname.endswith(ext) for ext in EXTENSIONS):
fpath = os.path.join(root, fname)
with io.open(fpath, 'r', errors='ignore', newline='') as curr_file:
with io.open(fpath, 'r', errors='ignore') as curr_file:
if not LICENSE.search(curr_file.read()):
print('%s: incorrect license' % fpath)
is_ok = False
Expand Down

0 comments on commit 180980e

Please sign in to comment.