From f55435fc4bbce9ad6001b05da4bbed3008b8ac0a Mon Sep 17 00:00:00 2001 From: Luflosi Date: Fri, 27 Mar 2026 14:18:09 +0100 Subject: [PATCH] nixos/tests/phosh: fix This fixes multiple problems that caused the test to fail: - Setting the time to the year 2022 with `timedatectl set-time` would fail with "Failed to set time: Requested to set the clock to time before build time, refusing.". To fix this, use `date -s` instead, since this command does no such validation. - Sometimes it would happen that the system time was set to 2022 but then the RTC would be read and it would override the time. To work around this, wait for the RTC device to exist and then to be extra safe, also write the desired date (and time) to the RTC. - We're using a different on-screen keyboard for phosh now which no longer shows up automatically. Therefore the text "123" would never appear on the screen. To fix this, simply remove the whole subtest. --- nixos/tests/phosh.nix | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/nixos/tests/phosh.nix b/nixos/tests/phosh.nix index a276e1f57653..4365a2c1c672 100644 --- a/nixos/tests/phosh.nix +++ b/nixos/tests/phosh.nix @@ -54,11 +54,16 @@ in import time start_all() + + # Prevent the RTC from setting the time to an undesired value after we already set it to a different value + phone.wait_for_file("/dev/rtc0") + phone.succeed("hwclock --set --date '2022-01-01 07:00'") + phone.wait_for_unit("phosh.service") with subtest("Check that we can see the lock screen info page"): # Saturday, January 1 - phone.succeed("timedatectl set-time '2022-01-01 07:00'") + phone.succeed("date -s '2022-01-01 07:00'") phone.wait_for_text("Saturday") phone.screenshot("01lockinfo") @@ -73,14 +78,10 @@ in phone.wait_for_text("All Apps") phone.screenshot("03launcher") - with subtest("Check the on-screen keyboard shows"): - phone.send_chars("mobile setting", delay=0.2) - phone.wait_for_text("123") # A button on the OSK - phone.screenshot("04osk") - with subtest("Check mobile-phosh-settings starts"): + phone.send_chars("mobile setting", delay=0.2) phone.send_chars("\n") phone.wait_for_text("Tweak advanced mobile settings"); - phone.screenshot("05settings") + phone.screenshot("04settings") ''; }