From baeb83db8f6a85d2c10f280f87f340abe5723243 Mon Sep 17 00:00:00 2001 From: Akos Kiss Date: Mon, 12 Sep 2016 15:11:14 +0200 Subject: [PATCH] Move Travis CI detection logic from run-tests.py to check-signed-off.sh (#1341) JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu --- tools/check-signed-off.sh | 16 +++++++++++++++- tools/run-tests.py | 3 +-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/check-signed-off.sh b/tools/check-signed-off.sh index 21b2f1ca8..016a4970b 100755 --- a/tools/check-signed-off.sh +++ b/tools/check-signed-off.sh @@ -18,7 +18,7 @@ # Usage function print_usage { - echo "Usage: $0 [--help] [--tolerant]" + echo "Usage: $0 [--help] [--tolerant] [--travis]" } function print_help @@ -32,6 +32,8 @@ function print_help 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" @@ -51,6 +53,18 @@ do 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 diff --git a/tools/run-tests.py b/tools/run-tests.py index c9cdee875..41ba98119 100755 --- a/tools/run-tests.py +++ b/tools/run-tests.py @@ -187,8 +187,7 @@ def main(): ret = run_check([SIGNED_OFF_SCRIPT, '--tolerant']) if not ret and script_args.check_signed_off_travis: - runnable = SIGNED_OFF_SCRIPT if os.getenv('TRAVIS_PULL_REQUEST', '0') != 'false' else [SIGNED_OFF_SCRIPT, '--tolerant'] - ret = run_check(runnable) + 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)