Merge pull request #39473 from xeji/update-keymap-test

nixos/tests/keymap: wait for xdotool to succeed

authored by

Sarah Brofeldt and committed by
GitHub
25abc29f ab5e6073

+7 -5
+7 -5
nixos/tests/keymap.nix
··· 8 9 testReader = pkgs.writeScript "test-input-reader" '' 10 #!${pkgs.stdenv.shell} 11 - rm -f ${resultFile} 12 logger "testReader: START: Waiting for $1 characters, expecting '$2'." 13 touch ${readyFile} 14 read -r -N $1 chars 15 rm -f ${readyFile} 16 17 if [ "$chars" == "$2" ]; then 18 - logger -s "testReader: PASS: Got '$2' as expected." 2>${resultFile} 19 else 20 - logger -s "testReader: FAIL: Expected '$2' but got '$chars'." 2>${resultFile} 21 fi 22 ''; 23 24 ··· 52 if ($desc eq "Xorg keymap") { 53 # make sure the xterm window is open and has focus 54 $machine->waitForWindow(qr/testterm/); 55 - $machine->succeed("${pkgs.xdotool}/bin/xdotool search --name testterm windowactivate --sync"); 56 } 57 58 # wait for reader to be ready ··· 71 $machine->waitForX; 72 73 mkTest "VT keymap", "openvt -sw --"; 74 - mkTest "Xorg keymap", "DISPLAY=:0 xterm -title testterm -fullscreen -e"; 75 ''; 76 }; 77
··· 8 9 testReader = pkgs.writeScript "test-input-reader" '' 10 #!${pkgs.stdenv.shell} 11 + rm -f ${resultFile} ${resultFile}.tmp 12 logger "testReader: START: Waiting for $1 characters, expecting '$2'." 13 touch ${readyFile} 14 read -r -N $1 chars 15 rm -f ${readyFile} 16 17 if [ "$chars" == "$2" ]; then 18 + logger -s "testReader: PASS: Got '$2' as expected." 2>${resultFile}.tmp 19 else 20 + logger -s "testReader: FAIL: Expected '$2' but got '$chars'." 2>${resultFile}.tmp 21 fi 22 + # rename after the file is written to prevent a race condition 23 + mv ${resultFile}.tmp ${resultFile} 24 ''; 25 26 ··· 54 if ($desc eq "Xorg keymap") { 55 # make sure the xterm window is open and has focus 56 $machine->waitForWindow(qr/testterm/); 57 + $machine->waitUntilSucceeds("${pkgs.xdotool}/bin/xdotool search --sync --onlyvisible --class testterm windowfocus --sync"); 58 } 59 60 # wait for reader to be ready ··· 73 $machine->waitForX; 74 75 mkTest "VT keymap", "openvt -sw --"; 76 + mkTest "Xorg keymap", "DISPLAY=:0 xterm -title testterm -class testterm -fullscreen -e"; 77 ''; 78 }; 79