Bug 1252556 - Make profileserver.py fail when running Firefox fails. r?build
Currently, when Firefox crashes when running the PGO profile, the error
is ignored, and the result is a build that is not optimized as expected.
So instead of such things going unnoticed, we make profileserver.py
return an error code, further failing the build.
Unfortunately, this does not make the output useful to know what went
wrong exactly, but the most important thing is that the build fails
instead of going through and leading to bad results.
--- a/build/pgo/profileserver.py
+++ b/build/pgo/profileserver.py
@@ -1,16 +1,17 @@
#!/usr/bin/python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import json
import os
+import sys
from buildconfig import substs
from mozbuild.base import MozbuildObject
from mozfile import TemporaryDirectory
from mozhttpd import MozHttpd
from mozprofile import FirefoxProfile, Profile, Preferences
from mozprofile.permissions import ServerLocations
from mozrunner import FirefoxRunner, CLI
@@ -81,24 +82,32 @@ if __name__ == '__main__':
# Run Firefox a first time to initialize its profile
runner = FirefoxRunner(profile=profile,
binary=build.get_binary_path(
where="staged-package"),
cmdargs=['javascript:Quitter.quit()'],
env=env)
runner.start()
- runner.wait()
+ ret = runner.wait()
+ if ret:
+ print("Firefox exited with code %d during profile initialization"
+ % ret)
+ httpd.stop()
+ sys.exit(ret)
jarlog = os.getenv("JARLOG_FILE")
if jarlog:
env["MOZ_JAR_LOG_FILE"] = os.path.abspath(jarlog)
print "jarlog: %s" % env["MOZ_JAR_LOG_FILE"]
cmdargs = ["http://localhost:%d/index.html" % PORT]
runner = FirefoxRunner(profile=profile,
binary=build.get_binary_path(
where="staged-package"),
cmdargs=cmdargs,
env=env)
runner.start(debug_args=debug_args, interactive=interactive)
- runner.wait()
+ ret = runner.wait()
httpd.stop()
+ if ret:
+ print("Firefox exited with code %d during profiling" % ret)
+ sys.exit(ret)