Skip to content

Commit

Permalink
Update to python3 in testing/trigger_scripts/PRESUBMIT.py
Browse files Browse the repository at this point in the history
This change also includes a fix for a race condition in the xvfb
unit test file, which this change seemed to interact with.

Bug: 1262366
Change-Id: Ic190279c6efa36906123cfa79116b3ac7a072d93
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3270365
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Matt Reichhoff <mreichhoff@chromium.org>
Cr-Commit-Position: refs/heads/main@{#939920}
  • Loading branch information
mreichhoff authored and Chromium LUCI CQ committed Nov 9, 2021
1 parent 7b7901a commit 36f6901
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 5 additions & 1 deletion testing/trigger_scripts/PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

def CommonChecks(input_api, output_api):
return input_api.canned_checks.RunUnitTestsInDirectory(
input_api, output_api, '.', files_to_check=['.*test.py'])
input_api,
output_api,
'.',
files_to_check=['.*test.py'],
skip_shebang_check=True)


def CheckChangeOnUpload(input_api, output_api):
Expand Down
2 changes: 1 addition & 1 deletion testing/trigger_scripts/perf_device_trigger_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def test_no_bot_returned(self):
alive_bots=[],
dead_bots=[])
err_msg = 'Not enough available machines exist in swarming pool'
self.assertTrue(err_msg in context.exception.message)
self.assertTrue(err_msg in str(context.exception))

def test_previously_healthy_now_dead(self):
# Test that it swaps out build1 and build2 that are dead
Expand Down
9 changes: 7 additions & 2 deletions testing/xvfb_test_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,20 @@


def print_signal(sig, *_):
print('Signal :{}'.format(sig))
# print_function does not guarantee its output won't be interleaved
# with other logging elsewhere, but it does guarantee its output
# will appear intact. Because the tests parse via starts_with, prefix
# with a newline. These tests were previously flaky due to output like
# > Signal: 1 <other messages>.
print('\nSignal :{}'.format(sig))


if __name__ == '__main__':
signal.signal(signal.SIGTERM, print_signal)
signal.signal(signal.SIGINT, print_signal)

# test the subprocess display number.
print('Display :{}'.format(os.environ.get('DISPLAY', 'None')))
print('\nDisplay :{}'.format(os.environ.get('DISPLAY', 'None')))

if len(sys.argv) > 1 and sys.argv[1] == '--sleep':
time.sleep(2) # gives process time to receive signal.

0 comments on commit 36f6901

Please sign in to comment.