From bd2c4298769e9fd5ebb35bcfa88150aee30528c3 Mon Sep 17 00:00:00 2001 From: Tino Vazquez Date: Thu, 24 Jan 2019 19:24:51 +0100 Subject: [PATCH] F #2816: Set rubocop linting in smoke tests Add README.md for travis --- .travis.yml | 1 - .travis/README.md | 10 ++++++++++ .travis/smoke_tests.sh | 1 + .travis/tests/01-rubocop.sh | 19 +++++++++++++++++++ .travis/tests/{01-scons.sh => 02-scons.sh} | 2 ++ share/linters/.rubocop.yml | 17 +++++++++++++++++ 6 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .travis/README.md create mode 100755 .travis/tests/01-rubocop.sh rename .travis/tests/{01-scons.sh => 02-scons.sh} (97%) diff --git a/.travis.yml b/.travis.yml index a8b5e8f439..055b34334d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,5 +8,4 @@ before_install: - sudo npm install -g grunt-cli - (cd src/sunstone/public && npm install && bower install) script: - - rubocop -c share/linters/.rubocop.yml src/cli - set -o errexit; source .travis/smoke_tests.sh diff --git a/.travis/README.md b/.travis/README.md new file mode 100644 index 0000000000..2c7562b5a2 --- /dev/null +++ b/.travis/README.md @@ -0,0 +1,10 @@ +## Travis smoke tests + +The `.travis/tests` directory contains scripts for each smoke test. + +The smoke_test.sh script is called which iterates on each script, and it exits and logs on any failure. To add more tests, simply create a new file on `.travis/tests`. + +Each test should: + + - have a number as prefix to define the order. Renaming is allowed, the rule is to execute the less costly tests (in time) first + - return 0 on success, other number on error diff --git a/.travis/smoke_tests.sh b/.travis/smoke_tests.sh index 000508d9d4..b7638830b0 100755 --- a/.travis/smoke_tests.sh +++ b/.travis/smoke_tests.sh @@ -31,6 +31,7 @@ check_test() { echo "Executing test $TEST" >> ${LOG_FILE} eval $TEST >> ${LOG_FILE} 2>&1 RC=$? + echo "RC for $TEST is $RC" return $RC } diff --git a/.travis/tests/01-rubocop.sh b/.travis/tests/01-rubocop.sh new file mode 100755 index 0000000000..8a85967068 --- /dev/null +++ b/.travis/tests/01-rubocop.sh @@ -0,0 +1,19 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems # +# # +# 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. # +#--------------------------------------------------------------------------- # + +# lint ruby code + +ln -s share/linters/.rubocop.yml . && rubocop diff --git a/.travis/tests/01-scons.sh b/.travis/tests/02-scons.sh similarity index 97% rename from .travis/tests/01-scons.sh rename to .travis/tests/02-scons.sh index 01ef8733b1..b148eb2372 100755 --- a/.travis/tests/01-scons.sh +++ b/.travis/tests/02-scons.sh @@ -14,4 +14,6 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +# check that OpenNebula compiles + scons sunstone=yes mysql=yes systemd=yes new_xmlrpc=yes diff --git a/share/linters/.rubocop.yml b/share/linters/.rubocop.yml index ae52f05b1f..8ff8145384 100644 --- a/share/linters/.rubocop.yml +++ b/share/linters/.rubocop.yml @@ -1,3 +1,19 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2019, OpenNebula Project, OpenNebula Systems # +# # +# 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. # +#--------------------------------------------------------------------------- # + # # Configuration file for rubocop linter # Applies to every ruby file on the OpenNebula repository @@ -5,6 +21,7 @@ AllCops: Exclude: + - src/sunstone/public/node_modules/**/* - src/tm_mad - share/onegate/onegate - share/scons/get_xmlrpc_config