Backout 5e9104665b88 (Bug 1206987) for jsapi-tests build failures on a CLOSED TREE.

This commit is contained in:
Terrence Cole 2015-09-22 16:26:10 -07:00
parent f25a5541e1
commit 5e42bddcea
5 changed files with 26 additions and 39 deletions

View File

@ -95,20 +95,8 @@ JSObject * JSAPITest::createGlobal(JSPrincipals* principals)
return newGlobal;
}
static void PreInit()
{
#ifdef XP_WIN
// Disable the segfault dialog to avoid hanging when run in automation.
UINT prevMode = SetErrorMode(0);
UINT newMode = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
SetErrorMode(prevMode | newMode);
#endif
}
int main(int argc, char* argv[])
{
PreInit();
int total = 0;
int failures = 0;
const char* filter = (argc == 2) ? argv[1] : nullptr;

View File

@ -184,7 +184,7 @@ static FILE* gOutFile = nullptr;
static bool reportWarnings = true;
static bool compileOnly = false;
static bool gFuzzingSafe = false;
static bool fuzzingSafe = false;
#ifdef DEBUG
static bool dumpEntrainedVariables = false;
@ -5691,17 +5691,17 @@ NewGlobalObject(JSContext* cx, JS::CompartmentOptions& options,
{
return nullptr;
}
if (!js::DefineTestingFunctions(cx, glob, gFuzzingSafe))
if (!js::DefineTestingFunctions(cx, glob, fuzzingSafe))
return nullptr;
if (!gFuzzingSafe) {
if (!fuzzingSafe) {
if (!JS_DefineFunctionsWithHelp(cx, glob, fuzzing_unsafe_functions))
return nullptr;
if (!DefineConsole(cx, glob))
return nullptr;
}
if (!DefineOS(cx, glob, gFuzzingSafe))
if (!DefineOS(cx, glob, fuzzingSafe))
return nullptr;
RootedObject performanceObj(cx, JS_NewObject(cx, nullptr));
@ -6115,8 +6115,10 @@ Shell(JSContext* cx, OptionParser* op, char** envp)
JSAutoRequest ar(cx);
gFuzzingSafe = op->getBoolOption("fuzzing-safe") ||
(getenv("MOZ_FUZZING_SAFE") && getenv("MOZ_FUZZING_SAFE")[0] != '0');
if (op->getBoolOption("fuzzing-safe"))
fuzzingSafe = true;
else
fuzzingSafe = (getenv("MOZ_FUZZING_SAFE") && getenv("MOZ_FUZZING_SAFE")[0] != '0');
RootedObject glob(cx);
JS::CompartmentOptions options;
@ -6168,14 +6170,11 @@ static void
PreInit()
{
#ifdef XP_WIN
// Disable the segfault dialog. This is used by test harnesses to fail the
// tests immediately instead of hanging automation.
const char* crash_option = getenv("XRE_NO_WINDOWS_CRASH_DIALOG");
if (crash_option && strncmp(crash_option, "1", 1)) {
UINT prevMode = SetErrorMode(0);
UINT newMode = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
SetErrorMode(prevMode | newMode);
}
// Disable the segfault dialog. We want to fail the tests immediately
// instead of hanging automation.
UINT prevMode = SetErrorMode(0);
UINT newMode = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX;
SetErrorMode(prevMode | newMode);
#endif
}
@ -6190,6 +6189,15 @@ main(int argc, char** argv, char** envp)
JSRuntime* rt;
JSContext* cx;
int result;
#ifdef XP_WIN
{
const char* crash_option = getenv("XRE_NO_WINDOWS_CRASH_DIALOG");
if (crash_option && strncmp(crash_option, "1", 1)) {
DWORD oldmode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
SetErrorMode(oldmode | SEM_NOGPFAULTERRORBOX);
}
}
#endif
#ifdef HAVE_SETLOCALE
setlocale(LC_ALL, "");

View File

@ -377,7 +377,6 @@ def run_test(test, prefix, options):
run = run_cmd
env = os.environ.copy()
env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1'
if test.tz_pacific:
env['TZ'] = 'PST8PDT'

View File

@ -18,7 +18,7 @@ class Task(object):
self.out = []
self.err = []
def spawn_test(test, prefix, env, passthrough=False):
def spawn_test(test, prefix, passthrough=False):
"""Spawn one child, return a task struct."""
if not passthrough:
(rout, wout) = os.pipe()
@ -40,7 +40,7 @@ def spawn_test(test, prefix, env, passthrough=False):
os.dup2(werr, 2)
cmd = test.get_command(prefix)
os.execvpe(cmd[0], cmd, env)
os.execvp(cmd[0], cmd)
def total_seconds(td):
"""
@ -191,17 +191,13 @@ def run_all_tests(tests, prefix, results, options):
# The set of currently running tests.
tasks = []
# Add any needed environment variables.
env = os.environ.copy()
env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1'
while len(tests) or len(tasks):
while len(tests) and len(tasks) < options.worker_count:
test = tests.pop()
if not test.enable and not options.run_skipped:
yield NullTestOutput(test)
else:
tasks.append(spawn_test(test, prefix, env, options.passthrough))
tasks.append(spawn_test(test, prefix, options.passthrough))
timeout = get_max_wait(tasks, options.timeout)
read_input(tasks, timeout)

View File

@ -21,9 +21,6 @@ class TaskFinishedMarker:
def _do_work(qTasks, qResults, qWatch, prefix, run_skipped, timeout):
env = os.environ.copy()
env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1'
while True:
test = qTasks.get(block=True, timeout=sys.maxint)
if test is EndMarker:
@ -40,8 +37,7 @@ def _do_work(qTasks, qResults, qWatch, prefix, run_skipped, timeout):
tStart = datetime.now()
proc = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env=env)
stderr=subprocess.PIPE)
# Push the task to the watchdog -- it will kill the task
# if it goes over the timeout while we keep its stdout