Bug 1518170 - Always upload profile run output; r=firefox-build-system-reviewers,chmanchester#firefox-build-system-reviewers
authorMike Shal <mshal@mozilla.com>
Tue, 08 Jan 2019 17:28:36 +0000
changeset 510035 8d44d6ba5863f5b12d053196e20532a78796f8e3
parent 510034 d935455eb6414ff8132d2abf47b74aed1d27df35
child 510036 01d64b7442cd23657d1135c9da9b254ba5317116
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfirefox-build-system-reviewers, chmanchester
bugs1518170, 1514288, 1517939
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1518170 - Always upload profile run output; r=firefox-build-system-reviewers,chmanchester#firefox-build-system-reviewers In bug 1514288 we started to save the output from running Firefox during PGO builds into log files, but they aren't correctly uploaded if the run fails. This presents a problem for categorizing failed PGO builds if the profileserver returns an error code (eg: bug 1517939), since the error messages could be hidden away in log files that aren't uploaded. Instead, we can generate them directly into the artifacts directory so that they are always uploaded. Additionally, the log files are displayed if the run fails so that the error messages are displayed in the log for easier bug categorization. Differential Revision: https://phabricator.services.mozilla.com/D15881
build/pgo/profileserver.py
toolkit/mozapps/installer/upload-files.mk
--- a/build/pgo/profileserver.py
+++ b/build/pgo/profileserver.py
@@ -89,39 +89,56 @@ if __name__ == '__main__':
                 vcdir = os.path.abspath(os.path.join(env[e], '../../VC/bin'))
                 if os.path.exists(vcdir):
                     env['PATH'] = '%s;%s' % (vcdir, env['PATH'])
                     break
 
         # Add MOZ_OBJDIR to the env so that cygprofile.cpp can use it.
         env["MOZ_OBJDIR"] = build.topobjdir
 
+        # Write to an output file if we're running in automation
+        process_args = {}
+        if 'UPLOAD_PATH' in env:
+            process_args['logfile'] = os.path.join(env['UPLOAD_PATH'], 'profile-run-1.log')
+
         # Run Firefox a first time to initialize its profile
         runner = FirefoxRunner(profile=profile,
                                binary=binary,
                                cmdargs=['data:text/html,<script>Quitter.quit()</script>'],
                                env=env,
-                               process_args={'logfile': 'profile-run-1.log'})
+                               process_args=process_args)
         runner.start()
         ret = runner.wait()
         if ret:
             print("Firefox exited with code %d during profile initialization"
                   % ret)
+            logfile = process_args.get('logfile')
+            if logfile:
+                print("Firefox output (%s):" % logfile)
+                with open(logfile) as f:
+                    print(f.read())
             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"])
 
+        if 'UPLOAD_PATH' in env:
+            process_args['logfile'] = os.path.join(env['UPLOAD_PATH'], 'profile-run-2.log')
         cmdargs = ["http://localhost:%d/index.html" % PORT]
         runner = FirefoxRunner(profile=profile,
                                binary=binary,
                                cmdargs=cmdargs,
                                env=env,
-                               process_args={'logfile': 'profile-run-2.log'})
+                               process_args=process_args)
         runner.start(debug_args=debug_args, interactive=interactive)
         ret = runner.wait()
         httpd.stop()
         if ret:
             print("Firefox exited with code %d during profiling" % ret)
+            logfile = process_args.get('logfile')
+            if logfile:
+                print("Firefox output (%s):" % logfile)
+                with open(logfile) as f:
+                    print(f.read())
             sys.exit(ret)
--- a/toolkit/mozapps/installer/upload-files.mk
+++ b/toolkit/mozapps/installer/upload-files.mk
@@ -403,18 +403,16 @@ UPLOAD_FILES= \
   $(call QUOTED_WILDCARD,$(MOZ_BUILDID_INFO_TXT_FILE)) \
   $(call QUOTED_WILDCARD,$(MOZ_MOZINFO_FILE)) \
   $(call QUOTED_WILDCARD,$(MOZ_TEST_PACKAGES_FILE)) \
   $(call QUOTED_WILDCARD,$(PKG_JSSHELL)) \
   $(call QUOTED_WILDCARD,$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip) \
   $(call QUOTED_WILDCARD,$(topobjdir)/$(MOZ_BUILD_APP)/installer/windows/instgen/setup.exe) \
   $(call QUOTED_WILDCARD,$(topobjdir)/$(MOZ_BUILD_APP)/installer/windows/instgen/setup-stub.exe) \
   $(call QUOTED_WILDCARD,$(topsrcdir)/toolchains.json) \
-  $(call QUOTED_WILDCARD,$(topobjdir)/profile-run-1.log) \
-  $(call QUOTED_WILDCARD,$(topobjdir)/profile-run-2.log) \
   $(if $(UPLOAD_EXTRA_FILES), $(foreach f, $(UPLOAD_EXTRA_FILES), $(wildcard $(DIST)/$(f))))
 
 ifneq ($(filter-out en-US x-test,$(AB_CD)),)
   UPLOAD_FILES += \
     $(call QUOTED_WILDCARD,$(topobjdir)/$(MOZ_BUILD_APP)/installer/windows/l10ngen/setup.exe) \
     $(call QUOTED_WILDCARD,$(topobjdir)/$(MOZ_BUILD_APP)/installer/windows/l10ngen/setup-stub.exe)
 endif