[gnome-settings-daemon/benzea/tests-output-checker-testing] write to fd 1 directly
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/benzea/tests-output-checker-testing] write to fd 1 directly
- Date: Mon, 15 Feb 2021 13:46:24 +0000 (UTC)
commit ce4cd0f690380b41d795ecb594acba32cb21e49d
Author: Benjamin Berg <bberg redhat com>
Date: Mon Feb 15 14:46:10 2021 +0100
write to fd 1 directly
plugins/power/test.py | 72 +++++++++++++++++++++++++--------------------------
1 file changed, 36 insertions(+), 36 deletions(-)
---
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 8fc8b387..e8bdde0e 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -44,30 +44,30 @@ class PowerPluginBase(gsdtestcase.GSDTestCase):
COMMON_SUSPEND_METHODS=['Suspend', 'Hibernate', 'SuspendThenHibernate']
def setUp(self):
- sys.stdout.write("setup 0")
+ os.write(1, b"setup 0\n")
self.mock_external_monitor_file = os.path.join(self.workdir, 'GSD_MOCK_EXTERNAL_MONITOR')
os.environ['GSD_MOCK_EXTERNAL_MONITOR_FILE'] = self.mock_external_monitor_file
- sys.stdout.write("setup 0.1")
+ os.write(1, b"setup 0.1\n")
self.check_logind_gnome_session()
- sys.stdout.write("setup 0.2")
+ os.write(1, b"setup 0.2\n")
self.start_logind()
- sys.stdout.write("setup 0.3")
+ os.write(1, b"setup 0.3\n")
self.daemon_death_expected = False
- sys.stdout.write("setup 1")
+ os.write(1, b"setup 1\n")
# Setup umockdev testbed
self.testbed = UMockdev.Testbed.new()
os.environ['UMOCKDEV_DIR'] = self.testbed.get_root_dir()
- sys.stdout.write("setup 2")
+ os.write(1, b"setup 2\n")
# Create a mock backlight device
# Note that this function creates a different or even no backlight
# device based on the name of the test.
self.add_backlight()
- sys.stdout.write("setup 3")
+ os.write(1, b"setup 3\n")
if 'HAVE_SYSFS_BACKLIGHT' in os.environ and os.environ['HAVE_SYSFS_BACKLIGHT'] == '1':
self.skip_sysfs_backlight = False
@@ -79,14 +79,14 @@ class PowerPluginBase(gsdtestcase.GSDTestCase):
'upower', {'DaemonVersion': '0.99', 'OnBattery': True, 'LidIsClosed': False},
stdout=subprocess.PIPE)
gsdtestcase.set_nonblock(self.upowerd.stdout)
- sys.stdout.write("setup 4")
+ os.write(1, b"setup 4\n")
# start mock gnome-shell screensaver
(self.screensaver, self.obj_screensaver) = self.spawn_server_template(
'gnome_screensaver', stdout=subprocess.PIPE)
gsdtestcase.set_nonblock(self.screensaver.stdout)
- sys.stdout.write("setup 5")
+ os.write(1, b"setup 5\n")
self.session_log = OutputChecker()
self.session = subprocess.Popen(['gnome-session', '-f',
@@ -96,7 +96,7 @@ class PowerPluginBase(gsdtestcase.GSDTestCase):
stderr=subprocess.STDOUT)
self.session_log.writer_attached()
- sys.stdout.write("setup 6")
+ os.write(1, b"setup 6\n")
# wait until the daemon is on the bus
self.wait_for_bus_object('org.gnome.SessionManager',
@@ -107,28 +107,28 @@ class PowerPluginBase(gsdtestcase.GSDTestCase):
self.start_mutter()
- sys.stdout.write("setup 7")
+ os.write(1, b"setup 7\n")
# Set up the gnome-session presence
obj_session_presence = self.session_bus_con.get_object(
'org.gnome.SessionManager', '/org/gnome/SessionManager/Presence')
self.obj_session_presence_props = dbus.Interface(obj_session_presence, dbus.PROPERTIES_IFACE)
- sys.stdout.write("setup 8")
+ os.write(1, b"setup 8\n")
# ensure that our tests don't lock the screen when the screensaver
# gets active
self.settings_screensaver = Gio.Settings(schema_id='org.gnome.desktop.screensaver')
self.settings_screensaver['lock-enabled'] = False
- sys.stdout.write("setup 9")
+ os.write(1, b"setup 9\n")
# Ensure we set up the external monitor state
self.set_has_external_monitor(False)
self.settings_gsd_power = Gio.Settings(schema_id='org.gnome.settings-daemon.plugins.power')
- sys.stdout.write("setup 10")
+ os.write(1, b"setup 10\n")
Gio.Settings.sync()
# avoid painfully long delays of actions for tests
@@ -144,7 +144,7 @@ class PowerPluginBase(gsdtestcase.GSDTestCase):
else:
env['LD_PRELOAD'] = env['POWER_LD_PRELOAD']
- sys.stdout.write("setup 11")
+ os.write(1, b"setup 11\n")
# We need to redirect stdout to grab the debug messages.
# stderr is not needed by the testing infrastructure but is useful to
@@ -157,46 +157,46 @@ class PowerPluginBase(gsdtestcase.GSDTestCase):
env=env)
self.plugin_log.writer_attached()
- sys.stdout.write("setup 12")
+ os.write(1, b"setup 12\n")
# Store the early-init messages, some tests need them.
self.plugin_startup_msgs = self.plugin_log.check_line(b'System inhibitor fd is', timeout=10)
- sys.stdout.write("setup 13")
+ os.write(1, b"setup 13\n")
# always start with zero idle time
self.reset_idle_timer()
- sys.stdout.write("setup 14")
+ os.write(1, b"setup 14\n")
# flush notification log
self.p_notify.stdout.read()
- sys.stdout.write("setup 15 and done!")
+ os.write(1, b"setup 15 and done!\n")
def tearDown(self):
- sys.stdout.write("tear down")
+ os.write(1, b"tear down\n")
daemon_running = self.daemon.poll() == None
if daemon_running:
- sys.stdout.write("terminating daemon")
+ os.write(1, b"terminating daemon\n")
self.daemon.terminate()
- sys.stdout.write("waiting daemon")
+ os.write(1, b"waiting daemon\n")
self.daemon.wait()
- sys.stdout.write("daemon done")
- sys.stdout.write("checking log is closed")
+ os.write(1, b"daemon done\n")
+ os.write(1, b"checking log is closed\n")
self.plugin_log.assert_closed()
- sys.stdout.write("log closed")
+ os.write(1, b"log closed\n")
- sys.stdout.write("terminating upowerd")
+ os.write(1, b"terminating upowerd\n")
self.upowerd.terminate()
- sys.stdout.write("terminating upowerd done")
+ os.write(1, b"terminating upowerd done\n")
self.upowerd.wait()
- sys.stdout.write("waiting upowerd done")
+ os.write(1, b"waiting upowerd done\n")
self.screensaver.terminate()
- sys.stdout.write("terminating screensaver done")
+ os.write(1, b"terminating screensaver done\n")
self.screensaver.wait()
- sys.stdout.write("waiting screensaver done")
+ os.write(1, b"waiting screensaver done\n")
self.stop_session()
self.stop_mutter()
self.stop_logind()
@@ -220,15 +220,15 @@ class PowerPluginBase(gsdtestcase.GSDTestCase):
def stop_session(self):
'''Stop GNOME session'''
- sys.stdout.write("stop GNOME session")
+ os.write(1, b"stop GNOME session\n")
assert self.session
- sys.stdout.write("terminating session")
+ os.write(1, b"terminating session\n")
self.session.terminate()
- sys.stdout.write("waiting for process to finish")
+ os.write(1, b"waiting for process to finish\n")
self.session.wait()
- sys.stdout.write("force closing log next")
+ os.write(1, b"force closing log next\n")
# dummyapp.desktop survives the session. This keeps the FD open in the
# CI environment when gnome-session fails to redirect the child output
# to journald.
@@ -578,7 +578,7 @@ class PowerPluginTest2(PowerPluginBase):
def test_idle_time_reset_on_resume(self):
'''Check that the IDLETIME is reset when resuming'''
- sys.stdout.write("test_idle_time_reset_on_resume")
+ os.write(1, b"test_idle_time_reset_on_resume\n")
self.settings_screensaver['lock-enabled'] = False
@@ -1096,7 +1096,7 @@ class PowerPluginTest7(PowerPluginBase):
kbd_brightness = obj_gsd_power_kbd_props.Get('org.gnome.SettingsDaemon.Power.Keyboard',
'Brightness')
# We should not have arrived here, if we did then the test failed, let's print this to help
debugging
- sys.stdout.write('Got keyboard brightness: {}'.format(kbd_brightness))
+ os.write(1, 'Got keyboard brightness: {}'.format(kbd_brightness))
self.assertEqual(exc.exception.get_dbus_message(), 'Failed to get property Brightness on interface
org.gnome.SettingsDaemon.Power.Keyboard')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]