Bug 1229348 - Add a "valgrind-plain" suite to all_mochitest_suites. r=cmanchester.
authorJulian Seward <jseward@acm.org>
Wed, 03 Feb 2016 18:43:05 +0100
changeset 305895 1df6bf08633c74a5542bde9c07d20786130fc91b
parent 305894 64b4a54825f01c67efb2f7ddd03ae13ad548c772
child 305896 ac6d88dd1af163b07479c29b11c658c4d7cbcfff
push id9214
push userraliiev@mozilla.com
push dateMon, 07 Mar 2016 14:25:21 +0000
treeherdermozilla-aurora@8849dd1a4a79 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscmanchester
bugs1229348
milestone47.0a1
Bug 1229348 - Add a "valgrind-plain" suite to all_mochitest_suites. r=cmanchester.
testing/mochitest/mochitest_options.py
testing/mochitest/moz.build
testing/mozharness/configs/unittests/linux_unittest.py
testing/mozharness/mach_commands.py
testing/mozharness/mozharness/mozilla/testing/errors.py
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -28,16 +28,29 @@ try:
 except ImportError:
     build_obj = None
     conditions = None
 
 
 def get_default_valgrind_suppression_files():
     # We are trying to locate files in the source tree.  So if we
     # don't know where the source tree is, we must give up.
+    #
+    # When this is being run by |mach mochitest --valgrind ...|, it is
+    # expected that |build_obj| is not None, and so the logic below will
+    # select the correct suppression files.
+    #
+    # When this is run from mozharness, |build_obj| is None, and we expect
+    # that testing/mozharness/configs/unittests/linux_unittests.py will
+    # select the correct suppression files (and paths to them) and
+    # will specify them using the --valgrind-supp-files= flag.  Hence this
+    # function will not get called when running from mozharness.
+    #
+    # Note: keep these Valgrind .sup file names consistent with those
+    # in testing/mozharness/configs/unittests/linux_unittest.py.
     if build_obj is None or build_obj.topsrcdir is None:
         return []
 
     supps_path = os.path.join(build_obj.topsrcdir, "build", "valgrind")
 
     rv = []
     if mozinfo.os == "linux":
         if mozinfo.processor == "x86_64":
--- a/testing/mochitest/moz.build
+++ b/testing/mochitest/moz.build
@@ -24,16 +24,19 @@ MOCHITEST_MANIFESTS += [
 ]
 MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini']
 
 TEST_HARNESS_FILES.testing.mochitest += [
     '!automation.py',
     '/build/mobile/remoteautomation.py',
     '/build/pgo/server-locations.txt',
     '/build/sanitizers/lsan_suppressions.txt',
+    '/build/valgrind/cross-architecture.sup',
+    '/build/valgrind/i386-redhat-linux-gnu.sup',
+    '/build/valgrind/x86_64-redhat-linux-gnu.sup',
     '/netwerk/test/httpserver/httpd.js',
     '/testing/mozbase/mozdevice/mozdevice/devicemanager.py',
     '/testing/mozbase/mozdevice/mozdevice/devicemanagerADB.py',
     '/testing/mozbase/mozdevice/mozdevice/devicemanagerSUT.py',
     '/testing/mozbase/mozdevice/mozdevice/droid.py',
     '/testing/mozbase/mozdevice/mozdevice/version_codes.py',
     '/testing/mozbase/mozdevice/mozdevice/Zeroconf.py',
     '/testing/mozbase/moznetwork/moznetwork/moznetwork.py',
--- a/testing/mozharness/configs/unittests/linux_unittest.py
+++ b/testing/mozharness/configs/unittests/linux_unittest.py
@@ -4,22 +4,34 @@ import platform
 # OS Specifics
 ABS_WORK_DIR = os.path.join(os.getcwd(), "build")
 BINARY_PATH = os.path.join(ABS_WORK_DIR, "firefox", "firefox-bin")
 INSTALLER_PATH = os.path.join(ABS_WORK_DIR, "installer.tar.bz2")
 XPCSHELL_NAME = "xpcshell"
 EXE_SUFFIX = ""
 DISABLE_SCREEN_SAVER = True
 ADJUST_MOUSE_AND_SCREEN = False
+
+# Note: keep these Valgrind .sup file names consistent with those
+# in testing/mochitest/mochitest_options.py.
+VALGRIND_SUPP_DIR = os.path.join(os.getcwd(), "build/tests/mochitest")
+VALGRIND_SUPP_CROSS_ARCH = os.path.join(VALGRIND_SUPP_DIR,
+                                        "cross-architecture.sup")
+VALGRIND_SUPP_ARCH = None
+
 if platform.architecture()[0] == "64bit":
     TOOLTOOL_MANIFEST_PATH = "config/tooltool-manifests/linux64/releng.manifest"
     MINIDUMP_STACKWALK_PATH = "linux64-minidump_stackwalk"
+    VALGRIND_SUPP_ARCH = os.path.join(VALGRIND_SUPP_DIR,
+                                      "x86_64-redhat-linux-gnu.sup")
 else:
     TOOLTOOL_MANIFEST_PATH = "config/tooltool-manifests/linux32/releng.manifest"
     MINIDUMP_STACKWALK_PATH = "linux32-minidump_stackwalk"
+    VALGRIND_SUPP_ARCH = os.path.join(VALGRIND_SUPP_DIR,
+                                      "i386-redhat-linux-gnu.sup")
 
 #####
 config = {
     "buildbot_json_path": "buildprops.json",
     "exes": {
         "python": "/tools/buildbot/bin/python",
         "virtualenv": ["/tools/buildbot/bin/python", "/tools/misc-python/virtualenv.py"],
         "tooltool.py": "/tools/tooltool.py",
@@ -183,16 +195,19 @@ config = {
                 "--utility-path=tests/bin",
                 "%(binary_path)s",
             ],
             "run_filename": "rungtests.py",
         },
     },
     # local mochi suites
     "all_mochitest_suites": {
+        "valgrind-plain": ["--valgrind=/usr/bin/valgrind",
+                           "--valgrind-supp-files=" + VALGRIND_SUPP_ARCH +
+                               "," + VALGRIND_SUPP_CROSS_ARCH],
         "plain": [],
         "plain-chunked": ["--chunk-by-dir=4"],
         "mochitest-push": ["--subsuite=push"],
         "chrome": ["--chrome"],
         "chrome-chunked": ["--chrome", "--chunk-by-dir=4"],
         "browser-chrome": ["--browser-chrome"],
         "browser-chrome-chunked": ["--browser-chrome", "--chunk-by-runtime"],
         "browser-chrome-addons": ["--browser-chrome", "--chunk-by-runtime", "--tag=addons"],
--- a/testing/mozharness/mach_commands.py
+++ b/testing/mozharness/mach_commands.py
@@ -48,16 +48,21 @@ class MozharnessRunner(MozbuildObject):
         self.config = {
             "__defaults__": {
                 "config": ["--no-read-buildbot-config",
                            "--download-symbols", "ondemand",
                            "--installer-url", self.installer_url,
                            "--test-packages-url", self.test_packages_url]
             },
 
+            "mochitest-valgrind": {
+                "script": "desktop_unittest.py",
+                "config": desktop_unittest_config + [
+                    "--mochitest-suite", "valgrind-plain"]
+            },
             "mochitest": {
                 "script": "desktop_unittest.py",
                 "config": desktop_unittest_config + [
                     "--mochitest-suite", "plain"]
             },
             "mochitest-chrome": {
                 "script": "desktop_unittest.py",
                 "config": desktop_unittest_config + [
--- a/testing/mozharness/mozharness/mozilla/testing/errors.py
+++ b/testing/mozharness/mozharness/mozilla/testing/errors.py
@@ -83,24 +83,19 @@ TinderBoxPrintRe = {
         'pass_group': "Passed",
         'fail_group': "Failed",
         'known_fail_group': "Skipped",
     },
     "webapprt_summary": _mochitest_summary,
 
     "harness_error": {
         'full_regex': re.compile(r"(?:TEST-UNEXPECTED-FAIL|PROCESS-CRASH) \| .* \| (application crashed|missing output line for total leaks!|negative leaks caught!|\d+ bytes leaked)"),
-        'minimum_regex': re.compile(r'''(TEST-UNEXPECTED|PROCESS-CRASH)'''),
+        'minimum_regex': re.compile(r'''(TEST-UNEXPECTED|PROCESS-CRASH|TEST-VALGRIND-ERROR)'''),
         'retry_regex': re.compile(r'''FAIL-SHOULD-RETRY''')
     },
-    "valgrind_error": {
-        'substr': 'TEST-VALGRIND-ERROR',
-        'level': ERROR,
-        'explanation': 'Valgrind detected memory errors during the run'
-    },
 }
 
 TestPassed = [
     {'regex': re.compile('''(TEST-INFO|TEST-KNOWN-FAIL|TEST-PASS|INFO \| )'''), 'level': INFO},
 ]
 
 LogcatErrorList = [
     {'substr': 'Fatal signal 11 (SIGSEGV)', 'level': ERROR, 'explanation': 'This usually indicates the B2G process has crashed'},