Bug 1539449 - [marionette] Suppress Gecko output in test_crash.py to prevent mozharness failure, r=whimboo

Differential Revision: https://phabricator.services.mozilla.com/D32169

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Halberstadt 2019-05-24 22:17:24 +00:00
Родитель ae73c8c967
Коммит d94fe176c9
1 изменённых файлов: 22 добавлений и 1 удалений

Просмотреть файл

@ -2,13 +2,15 @@
# 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/.
from __future__ import absolute_import
from __future__ import absolute_import, print_function
import glob
import os
import platform
import shutil
import sys
import unittest
from io import StringIO
from marionette_driver import Wait
from marionette_driver.errors import (
@ -99,6 +101,25 @@ class BaseCrashTestCase(MarionetteTestCase):
class TestCrash(BaseCrashTestCase):
def setUp(self):
if os.environ.get('MOZ_AUTOMATION'):
# Capture stdout, otherwise the Gecko output causes mozharness to fail
# the task due to "A content process has crashed" appearing in the log.
# To view stdout for debugging, use `print(self.new_out.getvalue())`
print("Suppressing GECKO output. To view, add `print(self.new_out.getvalue())` "
"to the end of this test.")
self.new_out, self.new_err = StringIO(), StringIO()
self.old_out, self.old_err = sys.stdout, sys.stderr
sys.stdout, sys.stderr = self.new_out, self.new_err
super(TestCrash, self).setUp()
def tearDown(self):
super(TestCrash, self).tearDown()
if os.environ.get('MOZ_AUTOMATION'):
sys.stdout, sys.stderr = self.old_out, self.old_err
@unittest.skipIf(platform.machine() == "ARM64" and platform.system() == "Windows",
"Bug 1540784 - crashreporter related issues on Windows 10 aarch64. ")
def test_crash_chrome_process(self):