Movatterモバイル変換


[0]ホーム

URL:


Google Git
Sign in
chromium /chromium /src /refs/heads/main /. /testing /xvfb_test_script.py
blob: 9237aa2a1bed4dbe854c0b34c43a59929045cf18 [file] [log] [blame]
Ilia Samsonova00835302019-04-19 17:37:59[diff] [blame]1#!/usr/bin/env python
Avi Drissmandfd880852022-09-15 20:11:09[diff] [blame]2# Copyright 2019 The Chromium Authors
Ilia Samsonova00835302019-04-19 17:37:59[diff] [blame]3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
Ilia Samsonova00835302019-04-19 17:37:59[diff] [blame]5"""Simple script for xvfb_unittest to launch.
6
7This script outputs formatted data to stdout for the xvfb unit tests
8to read and compare with expected output.
9"""
10
Wenbin Zhangc56b1252021-10-05 02:49:06[diff] [blame]11from __future__import print_function
12
Ilia Samsonova00835302019-04-19 17:37:59[diff] [blame]13import os
14import signal
15import sys
16import time
17
18
19def print_signal(sig,*_):
Matt Reichhoff36f6901c2021-11-09 18:40:15[diff] [blame]20# print_function does not guarantee its output won't be interleaved
21# with other logging elsewhere, but it does guarantee its output
22# will appear intact. Because the tests parse via starts_with, prefix
23# with a newline. These tests were previously flaky due to output like
24# > Signal: 1 <other messages>.
25print('\nSignal :{}'.format(sig))
Ilia Samsonova00835302019-04-19 17:37:59[diff] [blame]26
27
28if __name__=='__main__':
29 signal.signal(signal.SIGTERM, print_signal)
30 signal.signal(signal.SIGINT, print_signal)
31
Ilia Samsonova00835302019-04-19 17:37:59[diff] [blame]32# test the subprocess display number.
Matt Reichhoff36f6901c2021-11-09 18:40:15[diff] [blame]33print('\nDisplay :{}'.format(os.environ.get('DISPLAY','None')))
Ilia Samsonova00835302019-04-19 17:37:59[diff] [blame]34
35if len(sys.argv)>1and sys.argv[1]=='--sleep':
36 time.sleep(2)# gives process time to receive signal.

[8]ページ先頭

©2009-2025 Movatter.jp