[Fuego] [PATCH 16/30] run-test: use an extra variable to indicate the caller
Daniel Sangorrin
daniel.sangorrin at toshiba.co.jp
Mon Jun 4 07:17:50 UTC 2018
This way we can also handle nested calls
Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
engine/scripts/ftc | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/engine/scripts/ftc b/engine/scripts/ftc
index ac9a28b..6a8fbdb 100755
--- a/engine/scripts/ftc
+++ b/engine/scripts/ftc
@@ -3255,15 +3255,6 @@ def do_run_test(conf, options):
else:
postcleanup = 'true'
- # detect whether this is a Jenkins job or not:
- try:
- jenkins_url = os.environ("JENKINS_URL")
- fuego_caller = "jenkins"
- except:
- jenkins_url = None
- fuego_caller = "ftc"
- print "Notice: non-Jenkins test request detected"
-
print "Running test '%s' on board '%s' using spec '%s'" % (test_name, board_name, spec_name)
# check if there's a Jenkins job that matches this request
@@ -3306,6 +3297,27 @@ def do_run_test(conf, options):
# set job description in run json file
build_data.description = "Test %s run by ftc" % build_data.test_name
+ # run_test can be used in different situations
+ # - called from jenkins
+ # - FUEGO_CALLER="jenkins"
+ # - called from the command line (ftc)
+ # - FUEGO_CALLER not set
+ # - called from fuego_test.sh (nested)
+ # - FUEGO_CALLER="ftc"
+
+ try:
+ fuego_caller = os.environ["FUEGO_CALLER"]
+ if fuego_caller == "jenkins":
+ print("ftc was called from Jenkins")
+ elif fuego_caller == "ftc":
+ print("ftc was called from fuego_test (nested)")
+ else:
+ error_out("fuego_caller has an unexpected value: " + fuego_caller)
+ except:
+ print("ftc was called from the command line")
+ fuego_caller = "ftc"
+ os.environ["FUEGO_CALLER"] = "ftc"
+
# export other vars (that Jenkins would export)
# FIXTHIS: do_run_test: variables have changed (e.g. TESTSPEC, ..)
os.environ["TESTPLAN"] = build_data.testplan_name
--
2.7.4
More information about the Fuego
mailing list