blob: e1dcdae4a3a82ffe7f0f0f39f2a5b23e1ce56f82 [file] [log] [blame]
Ilia Samsonova00835302019-04-19 17:37:591#!/usr/bin/env python
2# Copyright (c) 2019 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6"""Simple script for xvfb_unittest to launch.
7
8This script outputs formatted data to stdout for the xvfb unit tests
9to read and compare with expected output.
10"""
11
12import os
13import signal
14import sys
15import time
16
17
18def print_signal(sig, *_):
19 print 'Signal :{}'.format(sig)
20
21
22if __name__ == '__main__':
23 signal.signal(signal.SIGTERM, print_signal)
24 signal.signal(signal.SIGINT, print_signal)
25
26 # test if inside xvfb flag is set.
27 print 'Inside_xvfb :{}'.format(
28 os.environ.get('_CHROMIUM_INSIDE_XVFB', 'None'))
29 # test the subprocess display number.
30 print 'Display :{}'.format(os.environ.get('DISPLAY', 'None'))
31
32 if len(sys.argv) > 1 and sys.argv[1] == '--sleep':
33 time.sleep(2) # gives process time to receive signal.