Tests never change the real screen's brightness
Tests that open the Face unlock window or the face auth view turned the fill light on: they read the real /sys/class/backlight, set 90 % and restored it on close, and since the sysfs file is root-owned the write went to logind's SetBrightness over the real system bus. With tests in parallel the screen flickered between levels, and an aborted test left it at 90 %. - The backlight root comes from CHANDRA_BACKLIGHT_ROOT when set (default_backlight_root); test-native.py gives every test its own fake intel_backlight (25 of 100). - Under CHANDRA_TEST_CONFIG=1 the logind SetBrightness fallback is never spawned. - test-native.py drops XDG_SESSION_ID and points DBUS_SYSTEM_BUS_ADDRESS nowhere; tests that want a system bus give their own. - Tests that set a fake root put the default back, not the real /sys/class/backlight. Checked: the face, auth and backlight tests leave /sys/class/backlight/intel_backlight/brightness untouched (value and mtime) while they run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cb81a973f8
commit
e2dc2bb930
4 files changed
+27
-4
No files matched your search
@@ -18,6 +18,10 @@ BEGIN, END = "----- BEGIN MOON TEST RESULT -----", "----- END MOON TEST RESULT -
|
||||
|
||||
def environment():
|
||||
env = dict(os.environ, CHANDRA_TEST_CONFIG="1")
|
||||
# Nothing reaches the real session through logind (screen brightness, ...). Tests that want a
|
||||
# system bus give their own address.
|
||||
env.pop("XDG_SESSION_ID", None)
|
||||
env["DBUS_SYSTEM_BUS_ADDRESS"] = "unix:path=/nonexistent"
|
||||
env["PATH"] = f"{ROOT}/.tools/bin:{os.path.expanduser('~')}/.moon/bin:" + env["PATH"]
|
||||
wasmer = ROOT + "/.tools/wasmer"
|
||||
if os.path.isdir(wasmer + "/lib"):
|
||||
@@ -42,6 +46,12 @@ def run(test, env, timeout):
|
||||
with open(f"{tmp}/d/applications/test-{n.lower()}.desktop", "w") as f:
|
||||
f.write(f"[Desktop Entry]\nType=Application\nName=Test {n}\nExec=true\nCategories=Utility;\n")
|
||||
os.mkdir(tmp + "/r", 0o700)
|
||||
# A fake backlight (25 of 100), so a test that changes the brightness can't touch the real screen.
|
||||
os.makedirs(tmp + "/bl/intel_backlight")
|
||||
for n, v in (("max_brightness", "100"), ("brightness", "25")):
|
||||
with open(f"{tmp}/bl/intel_backlight/{n}", "w") as f:
|
||||
f.write(v + "\n")
|
||||
e["CHANDRA_BACKLIGHT_ROOT"] = tmp + "/bl"
|
||||
t = time.monotonic()
|
||||
# Output goes to a file: a pipe would stay open as long as anything the test left running.
|
||||
with open(tmp + "/out", "w+b") as out:
|
||||
|
||||
Reference in new issue
Block a user