Skip to content

Commit 3f80a17

Browse files
committed
Ensure that test262 tests are always executed in the proper time zone
The America/Los_Angeles time zone is already enforced for Travis CI jobs but that doesn't guarantee the correctness of locally executed tests. So, this patch moves the setting of the `TZ` environment variable from `.travis.yml` to `run-tests.py`. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
1 parent 48810a9 commit 3f80a17

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ matrix:
7272
- env:
7373
- JOBNAME="Conformance Tests"
7474
- OPTS="--test262"
75-
- TZ=America/Los_Angeles
7675

7776
- env:
7877
- JOBNAME="ASAN Tests"

tools/run-tests.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,11 @@ def get_arguments():
199199
TERM_NORMAL = '\033[0m'
200200
TERM_BLUE = '\033[1;34m'
201201

202-
def report_command(cmd_type, cmd):
202+
def report_command(cmd_type, cmd, env=None):
203203
sys.stderr.write('%s%s%s\n' % (TERM_BLUE, cmd_type, TERM_NORMAL))
204+
if env is not None:
205+
sys.stderr.write(''.join('%s%s=%r \\%s\n' % (TERM_BLUE, var, val, TERM_NORMAL)
206+
for var, val in sorted(env.items())))
204207
sys.stderr.write('%s%s%s\n' % (TERM_BLUE, (' \\%s\n\t%s' % (TERM_NORMAL, TERM_BLUE)).join(cmd), TERM_NORMAL))
205208

206209
def create_binary(job, options):
@@ -279,15 +282,17 @@ def iterate_test_runner_jobs(jobs, options):
279282

280283
yield job, ret_build, test_cmd
281284

282-
def run_check(runnable):
283-
report_command('Test command:', runnable)
285+
def run_check(runnable, env=None):
286+
report_command('Test command:', runnable, env=env)
284287

285-
try:
286-
ret = subprocess.check_call(runnable)
287-
except subprocess.CalledProcessError as err:
288-
return err.returncode
288+
if env is not None:
289+
full_env = dict(os.environ)
290+
full_env.update(env)
291+
env = full_env
289292

290-
return ret
293+
proc = subprocess.Popen(runnable, env=env)
294+
proc.wait()
295+
return proc.returncode
291296

292297
def run_jerry_debugger_tests(options):
293298
ret_build = ret_test = 0
@@ -387,7 +392,7 @@ def run_test262_test_suite(options):
387392
if job.test_args:
388393
test_cmd.extend(job.test_args)
389394

390-
ret_test |= run_check(test_cmd)
395+
ret_test |= run_check(test_cmd, env=dict(TZ='America/Los_Angeles'))
391396

392397
return ret_build | ret_test
393398

0 commit comments

Comments
 (0)