[Fuego] [PATCH 20/30] run-test: reorder os environment settings
Daniel Sangorrin
daniel.sangorrin at toshiba.co.jp
Mon Jun 4 07:17:54 UTC 2018
Be clear about which variables emulate jenkins variables
and which are pure fuego variables
Signed-off-by: Daniel Sangorrin <daniel.sangorrin at toshiba.co.jp>
---
engine/scripts/ftc | 94 +++++++++++++++++++++---------------------------------
1 file changed, 37 insertions(+), 57 deletions(-)
diff --git a/engine/scripts/ftc b/engine/scripts/ftc
index d6d5ede..57976d8 100755
--- a/engine/scripts/ftc
+++ b/engine/scripts/ftc
@@ -3257,15 +3257,6 @@ def do_run_test(conf, options):
print "Running test '%s' on board '%s' using spec '%s'" % (test_name, board_name, spec_name)
- # make sure environment variables are set:
-
- # export stuff from configuration into environment
- export_list = ["FUEGO_CORE", "FUEGO_RO", "FUEGO_RW"]
- for var in export_list:
- os.environ[var] = conf.__dict__[var]
-
- os.environ["FUEGO_HOST"] = conf.host
-
# construct the build_data map to hold information about this build
build_data = data_class()
build_data.board_name = board_name
@@ -3316,28 +3307,6 @@ def do_run_test(conf, options):
os.mkdir(job_dir)
os.mkdir(job_dir + "/builds/")
- # export other vars (that Jenkins would export)
- # FIXTHIS: do_run_test: variables have changed (e.g. TESTSPEC, ..)
- os.environ["TESTPLAN"] = build_data.testplan_name
- os.environ["JOB_NAME"] = build_data.job_name
- os.environ["NODE_NAME"] = build_data.board_name
- os.environ["NODE_LABELS"] = build_data.board_name
- os.environ["Device"] = build_data.board_name
- os.environ["TESTDIR"] = build_data.testdir
- os.environ["WORKSPACE"] = build_data.workspace
- os.environ["TESTSPEC"] = build_data.spec_name
- # FIXTHIS - set this if user specifies --debug in options
- os.environ["FUEGO_DEBUG"] = "1"
-
- for var_name in board.env_vars.keys():
- os.environ[var_name] = board.env_vars[var_name]
-
- # and do synchronization with jenkins job at end, if possible
-
- # set BUILD_NUMBER, BUILD_ID, BUILD_TAG and EXECUTOR_NUMBER
- timestamp = time.strftime("%FT%T%z")
- build_data.timestamp = timestamp
-
# set build_data.build_number depending on the situation
if fuego_caller == "jenkins":
build_data.build_number = os.environ["BUILD_NUMBER"]
@@ -3358,36 +3327,47 @@ def do_run_test(conf, options):
error_out("Problem writing to nextBuildNumber: %s" % filename)
dprint("build number: " + build_data.build_number)
- os.environ["EXECUTOR_NUMBER"] = "0"
- os.environ["BUILD_ID"] = build_data.build_number
- os.environ["BUILD_NUMBER"] = build_data.build_number
- os.environ["BUILD_TIMESTAMP"] = build_data.timestamp
-
- # logdir path is ${NODE_NAME}.${TESTSPEC}.${BUILD_NUMBER}.${BUILD_ID}
- # FIXTHIS - do_run_test: logdir path should have timestamp in it
- log_dir = conf.FUEGO_RW + "/logs/%(test_name)s/%(board_name)s.%(spec_name)s.%(build_number)s.%(build_number)s" % build_data
-
- if not os.path.isdir(log_dir):
- os.mkdir(log_dir)
-
- # create build_number directory
- if job_dir:
- run_dir = job_dir + "/builds/" + build_number
- os.mkdir(run_dir)
- console_log_filename = "log"
- else:
- run_dir = log_dir
- console_log_filename = "consolelog.txt"
-
- os.environ["BUILD_TAG"] = "ftc-%s-%s" % (test_name, build_number)
-
- os.environ["JENKINS_HOME"] = conf.JENKINS_HOME
- os.environ["JENKINS_URL"] = conf.JENKINS_URL
-
+ build_data.test_logdir = conf.FUEGO_RW + '/logs/' + \
+ build_data.test_name + '/' + \
+ build_data.board_name + '.' + \
+ build_data.spec_name + '.' + \
+ build_data.build_number + '.' + \
+ build_data.build_number
+
+ # set environment variables
+ ## set environment variables that Jenkins would export
+ if fuego_caller != "jenkins":
+ os.environ["BUILD_NUMBER"] = build_data.build_number
+ os.environ["BUILD_ID"] = build_data.build_number
+ os.environ["EXECUTOR_NUMBER"] = "0"
+ os.environ["BUILD_TAG"] = "ftc-%s-%s" % (test_name, build_data.build_number)
+ os.environ["JENKINS_HOME"] = conf.JENKINS_HOME
+ os.environ["JENKINS_URL"] = conf.JENKINS_URL
+ os.environ["JOB_NAME"] = build_data.job_name
+ os.environ["NODE_NAME"] = build_data.board_name
+ os.environ["NODE_LABELS"] = build_data.board_name
+ os.environ["WORKSPACE"] = build_data.workspace
+
+ ## set Fuego-only environment variables
os.environ["Reboot"] = build_data.reboot_flag
os.environ["Rebuild"] = build_data.rebuild_flag
os.environ["Target_PreCleanup"] = build_data.precleanup_flag
os.environ["Target_PostCleanup"] = build_data.postcleanup_flag
+ os.environ["TESTSPEC"] = build_data.spec_name
+ os.environ["TESTDIR"] = build_data.testdir
+ os.environ["TESTPLAN"] = build_data.testplan_name
+ os.environ["Device"] = build_data.board_name
+ os.environ["FUEGO_HOST"] = conf.host
+ os.environ["LOGDIR"] = build_data.test_logdir
+ if debug is 1:
+ os.environ["FUEGO_DEBUG"] = "1"
+ for var_name in board.env_vars.keys():
+ os.environ[var_name] = board.env_vars[var_name]
+ for var in ["FUEGO_CORE", "FUEGO_RO", "FUEGO_RW"]:
+ os.environ[var] = conf.__dict__[var]
+ timestamp = time.strftime("%FT%T%z")
+ build_data.timestamp = timestamp
+ os.environ["BUILD_TIMESTAMP"] = build_data.timestamp
# cd to buildzone directory
saved_cur_dir = os.getcwd()
--
2.7.4
More information about the Fuego
mailing list