Bug 1385311 - Make sure AddressSanitizer errors turn the task orange, r?jmaher draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 28 Jul 2017 09:35:17 -0400
changeset 620428 2f544908c8f16ad1ae562841712c30c844f53884
parent 619581 52285ea5e54c73d3ed824544cef2ee3f195f05e6
child 640689 ecf7b255af5210f472b6b0f3a5ac9e0c704779d2
push id72029
push userahalberstadt@mozilla.com
push dateThu, 03 Aug 2017 12:22:26 +0000
reviewersjmaher
bugs1385311
milestone57.0a1
Bug 1385311 - Make sure AddressSanitizer errors turn the task orange, r?jmaher MozReview-Commit-ID: EvLGeaLVotV
taskcluster/ci/source-test/kind.yml
taskcluster/ci/source-test/python-tests.yml
testing/mochitest/tests/python/test_basic_mochitest_plain.py
testing/mozharness/mozharness/mozilla/testing/errors.py
--- a/taskcluster/ci/source-test/kind.yml
+++ b/taskcluster/ci/source-test/kind.yml
@@ -14,14 +14,17 @@ jobs-from:
     - mocha.yml
     - mozlint.yml
     - doc.yml
     - webidl.yml
 
 # This is used by run-task based tasks to lookup which build task it
 # should depend on based on its own platform.
 dependent-build-platforms:
+    linux64-asan/opt:
+        label: build-linux64-asan/opt
+        target-name: target.tar.bz2
     linux64/debug:
         label: build-linux64/debug
         target-name: target.tar.bz2
     linux64.*:
         label: build-linux64/opt
         target-name: target.tar.bz2
--- a/taskcluster/ci/source-test/python-tests.yml
+++ b/taskcluster/ci/source-test/python-tests.yml
@@ -44,16 +44,17 @@ marionette-harness:
           - 'testing/mozbase/packages.txt'
           - 'python/mach_commands.py'
 
 mochitest-harness:
     description: testing/mochitest unittests
     platform:
         - linux64/opt
         - linux64/debug
+        - linux64-asan/opt
     require-build: true
     treeherder:
         symbol: py(mch)
         kind: test
         tier: 2
     worker-type:
         by-platform:
             linux64.*: aws-provisioner-v1/gecko-t-linux-xlarge
--- a/testing/mochitest/tests/python/test_basic_mochitest_plain.py
+++ b/testing/mochitest/tests/python/test_basic_mochitest_plain.py
@@ -73,16 +73,17 @@ def test_output_fail(runtests):
         assert len(lines) == 1
     assert lines[0]['status'] == 'FAIL'
 
     if build_obj:
         assert set(lines[0].keys()) == set(lines[1].keys())
         assert set(lines[0].values()) == set(lines[1].values())
 
 
+@pytest.mark.skip_mozinfo("!crashreporter")
 def test_output_crash(runtests):
     status, lines = runtests('test_crash.html', environment=["MOZ_CRASHREPORTER_SHUTDOWN=1"])
     assert status == 1
 
     tbpl_status, log_level = get_mozharness_status(lines, status)
     assert tbpl_status == TBPL_FAILURE
     assert log_level == ERROR
 
@@ -91,16 +92,33 @@ def test_output_crash(runtests):
     assert crash[0]['action'] == 'crash'
     assert crash[0]['signature']
     assert crash[0]['minidump_path']
 
     lines = filter_action('test_end', lines)
     assert len(lines) == 0
 
 
+@pytest.mark.skip_mozinfo("!asan")
+def test_output_asan(runtests):
+    status, lines = runtests('test_crash.html', environment=["MOZ_CRASHREPORTER_SHUTDOWN=1"])
+    # TODO: mochitest should return non-zero here
+    assert status == 0
+
+    tbpl_status, log_level = get_mozharness_status(lines, status)
+    assert tbpl_status == TBPL_FAILURE
+    assert log_level == ERROR
+
+    crash = filter_action('crash', lines)
+    assert len(crash) == 0
+
+    process_output = filter_action('process_output', lines)
+    assert any('ERROR: AddressSanitizer' in l['data'] for l in process_output)
+
+
 @pytest.mark.skip_mozinfo("!debug")
 def test_output_assertion(runtests):
     status, lines = runtests('test_assertion.html')
     # TODO: mochitest should return non-zero here
     assert status == 0
 
     tbpl_status, log_level = get_mozharness_status(lines, status)
     assert tbpl_status == TBPL_WARNING
--- a/testing/mozharness/mozharness/mozilla/testing/errors.py
+++ b/testing/mozharness/mozharness/mozilla/testing/errors.py
@@ -110,16 +110,17 @@ TinderBoxPrintRe = {
 
 TestPassed = [
     {'regex': re.compile('''(TEST-INFO|TEST-KNOWN-FAIL|TEST-PASS|INFO \| )'''), 'level': INFO},
 ]
 
 HarnessErrorList = [
     {'substr': 'TEST-UNEXPECTED', 'level': ERROR, },
     {'substr': 'PROCESS-CRASH', 'level': ERROR, },
+    {'regex': re.compile('''ERROR: (Address|Leak)Sanitizer'''), 'level': ERROR, },
     {'regex': re.compile('''thread '([^']+)' panicked'''), 'level': ERROR, },
 ]
 
 LogcatErrorList = [
     {'substr': 'Fatal signal 11 (SIGSEGV)', 'level': ERROR, 'explanation': 'This usually indicates the B2G process has crashed'},
     {'substr': 'Fatal signal 7 (SIGBUS)', 'level': ERROR, 'explanation': 'This usually indicates the B2G process has crashed'},
     {'substr': '[JavaScript Error:', 'level': WARNING},
     {'substr': 'seccomp sandbox violation', 'level': ERROR, 'explanation': 'A content process has violated the system call sandbox (bug 790923)'},