Bug 600522 - Sunspider trace-test 'check-date-format-tofte.js' fails on computers not set to Pacific time. r=dmandelin

This commit is contained in:
Siddharth Agarwal 2012-07-06 10:38:16 +05:30
Родитель 54441d5f05
Коммит 7ad6524e65
3 изменённых файлов: 16 добавлений и 2 удалений

Просмотреть файл

@ -52,7 +52,9 @@ The general format in EBNF is:
cookie ::= "|jit-test|"
item ::= flag | attribute
flag ::= "slow" | "allow-oom" | "valgrind" | "mjitalways" | "debug"
flag ::= "slow" | "allow-oom" | "valgrind" | "tz-pacific" |
"mjitalways" | "debug" |
attribute ::= name ":" value
name ::= "error" | "exitstatus"
@ -66,6 +68,7 @@ The meaning of the items:
slow Test runs slowly. Do not run if the --no-slow option is given.
allow-oom If the test runs out of memory, it counts as passing.
valgrind Run test under valgrind.
tz-pacific Always run test with the Pacific time zone (TZ=PST8PDT).
mjitalways Run js with -a, whether --jitflags says to or not
debug Run js with -d, whether --jitflags says to or not

Просмотреть файл

@ -54,6 +54,7 @@ class Test:
self.slow = False # True means the test is slow-running
self.allow_oom = False # True means that OOM is not considered a failure
self.valgrind = False # True means run under valgrind
self.tz_pacific = False # True means force Pacific time for the test
self.expect_error = '' # Errors to expect and consider passing
self.expect_status = 0 # Exit status to expect from shell
@ -63,6 +64,7 @@ class Test:
t.slow = self.slow
t.allow_oom = self.allow_oom
t.valgrind = self.valgrind
t.tz_pacific = self.tz_pacific
t.expect_error = self.expect_error
t.expect_status = self.expect_status
return t
@ -101,6 +103,8 @@ class Test:
test.allow_oom = True
elif name == 'valgrind':
test.valgrind = options.valgrind
elif name == 'tz-pacific':
test.tz_pacific = True
elif name == 'mjitalways':
test.jitflags.append('-a')
elif name == 'debug':
@ -222,7 +226,12 @@ def run_test(test, lib_dir, shell_args):
run = run_cmd_avoid_stdio
else:
run = run_cmd
out, err, code, timed_out = run(cmd, os.environ, OPTIONS.timeout)
env = os.environ.copy()
if test.tz_pacific:
env['TZ'] = 'PST8PDT'
out, err, code, timed_out = run(cmd, env, OPTIONS.timeout)
if OPTIONS.show_output:
sys.stdout.write(out)

Просмотреть файл

@ -1,3 +1,5 @@
// |jit-test| tz-pacific
function arrayExists(array, x) {
for (var i = 0; i < array.length; i++) {
if (array[i] == x) return true;