Ensure that tests are always executed in a proper time zone (#2551)
The America/Los_Angeles time zone is already enforced for test262 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`. The date-related tests in the jerry test suite also rely on a time zone (UTC). Thus, `TZ` is forced for those tests, too. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
This commit is contained in:
@@ -72,7 +72,6 @@ matrix:
|
|||||||
- env:
|
- env:
|
||||||
- JOBNAME="Conformance Tests"
|
- JOBNAME="Conformance Tests"
|
||||||
- OPTS="--test262"
|
- OPTS="--test262"
|
||||||
- TZ=America/Los_Angeles
|
|
||||||
|
|
||||||
- env:
|
- env:
|
||||||
- JOBNAME="ASAN Tests"
|
- JOBNAME="ASAN Tests"
|
||||||
|
|||||||
+15
-10
@@ -199,8 +199,11 @@ BINARY_CACHE = {}
|
|||||||
TERM_NORMAL = '\033[0m'
|
TERM_NORMAL = '\033[0m'
|
||||||
TERM_BLUE = '\033[1;34m'
|
TERM_BLUE = '\033[1;34m'
|
||||||
|
|
||||||
def report_command(cmd_type, cmd):
|
def report_command(cmd_type, cmd, env=None):
|
||||||
sys.stderr.write('%s%s%s\n' % (TERM_BLUE, cmd_type, TERM_NORMAL))
|
sys.stderr.write('%s%s%s\n' % (TERM_BLUE, cmd_type, TERM_NORMAL))
|
||||||
|
if env is not None:
|
||||||
|
sys.stderr.write(''.join('%s%s=%r \\%s\n' % (TERM_BLUE, var, val, TERM_NORMAL)
|
||||||
|
for var, val in sorted(env.items())))
|
||||||
sys.stderr.write('%s%s%s\n' % (TERM_BLUE, (' \\%s\n\t%s' % (TERM_NORMAL, TERM_BLUE)).join(cmd), TERM_NORMAL))
|
sys.stderr.write('%s%s%s\n' % (TERM_BLUE, (' \\%s\n\t%s' % (TERM_NORMAL, TERM_BLUE)).join(cmd), TERM_NORMAL))
|
||||||
|
|
||||||
def create_binary(job, options):
|
def create_binary(job, options):
|
||||||
@@ -279,15 +282,17 @@ def iterate_test_runner_jobs(jobs, options):
|
|||||||
|
|
||||||
yield job, ret_build, test_cmd
|
yield job, ret_build, test_cmd
|
||||||
|
|
||||||
def run_check(runnable):
|
def run_check(runnable, env=None):
|
||||||
report_command('Test command:', runnable)
|
report_command('Test command:', runnable, env=env)
|
||||||
|
|
||||||
try:
|
if env is not None:
|
||||||
ret = subprocess.check_call(runnable)
|
full_env = dict(os.environ)
|
||||||
except subprocess.CalledProcessError as err:
|
full_env.update(env)
|
||||||
return err.returncode
|
env = full_env
|
||||||
|
|
||||||
return ret
|
proc = subprocess.Popen(runnable, env=env)
|
||||||
|
proc.wait()
|
||||||
|
return proc.returncode
|
||||||
|
|
||||||
def run_jerry_debugger_tests(options):
|
def run_jerry_debugger_tests(options):
|
||||||
ret_build = ret_test = 0
|
ret_build = ret_test = 0
|
||||||
@@ -341,7 +346,7 @@ def run_jerry_tests(options):
|
|||||||
if job.test_args:
|
if job.test_args:
|
||||||
test_cmd.extend(job.test_args)
|
test_cmd.extend(job.test_args)
|
||||||
|
|
||||||
ret_test |= run_check(test_cmd)
|
ret_test |= run_check(test_cmd, env=dict(TZ='UTC'))
|
||||||
|
|
||||||
return ret_build | ret_test
|
return ret_build | ret_test
|
||||||
|
|
||||||
@@ -387,7 +392,7 @@ def run_test262_test_suite(options):
|
|||||||
if job.test_args:
|
if job.test_args:
|
||||||
test_cmd.extend(job.test_args)
|
test_cmd.extend(job.test_args)
|
||||||
|
|
||||||
ret_test |= run_check(test_cmd)
|
ret_test |= run_check(test_cmd, env=dict(TZ='America/Los_Angeles'))
|
||||||
|
|
||||||
return ret_build | ret_test
|
return ret_build | ret_test
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user