about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSarah Brofeldt <sbrofeldt@gmail.com>2018-04-25 11:17:53 +0200
committerGitHub <noreply@github.com>2018-04-25 11:17:53 +0200
commit25abc29f4748128f8a05fd73eb14a44608712908 (patch)
treea0e66938190b116b5c29c37ed85bcf48fe7cffa7
parentab5e6073d9378e10b693790f25b078fc9df4163f (diff)
parent6891bda37071bbecdb343ff941ba893511f5fd70 (diff)
downloadnixlib-25abc29f4748128f8a05fd73eb14a44608712908.tar
nixlib-25abc29f4748128f8a05fd73eb14a44608712908.tar.gz
nixlib-25abc29f4748128f8a05fd73eb14a44608712908.tar.bz2
nixlib-25abc29f4748128f8a05fd73eb14a44608712908.tar.lz
nixlib-25abc29f4748128f8a05fd73eb14a44608712908.tar.xz
nixlib-25abc29f4748128f8a05fd73eb14a44608712908.tar.zst
nixlib-25abc29f4748128f8a05fd73eb14a44608712908.zip
Merge pull request #39473 from xeji/update-keymap-test
nixos/tests/keymap: wait for xdotool to succeed
-rw-r--r--nixos/tests/keymap.nix12
1 files changed, 7 insertions, 5 deletions
diff --git a/nixos/tests/keymap.nix b/nixos/tests/keymap.nix
index abff90d5047d..be880388314c 100644
--- a/nixos/tests/keymap.nix
+++ b/nixos/tests/keymap.nix
@@ -8,17 +8,19 @@ let
 
   testReader = pkgs.writeScript "test-input-reader" ''
     #!${pkgs.stdenv.shell}
-    rm -f ${resultFile}
+    rm -f ${resultFile} ${resultFile}.tmp
     logger "testReader: START: Waiting for $1 characters, expecting '$2'."
     touch ${readyFile}
     read -r -N $1 chars
     rm -f ${readyFile}
 
     if [ "$chars" == "$2" ]; then
-      logger -s "testReader: PASS: Got '$2' as expected." 2>${resultFile}
+      logger -s "testReader: PASS: Got '$2' as expected." 2>${resultFile}.tmp
     else
-      logger -s "testReader: FAIL: Expected '$2' but got '$chars'." 2>${resultFile}
+      logger -s "testReader: FAIL: Expected '$2' but got '$chars'." 2>${resultFile}.tmp
     fi
+    # rename after the file is written to prevent a race condition
+    mv  ${resultFile}.tmp ${resultFile}
   '';
 
 
@@ -52,7 +54,7 @@ let
           if ($desc eq "Xorg keymap") {
             # make sure the xterm window is open and has focus
             $machine->waitForWindow(qr/testterm/);
-            $machine->succeed("${pkgs.xdotool}/bin/xdotool search --name testterm windowactivate --sync");
+            $machine->waitUntilSucceeds("${pkgs.xdotool}/bin/xdotool search --sync --onlyvisible --class testterm windowfocus --sync");
           }
 
           # wait for reader to be ready
@@ -71,7 +73,7 @@ let
       $machine->waitForX;
 
       mkTest "VT keymap", "openvt -sw --";
-      mkTest "Xorg keymap", "DISPLAY=:0 xterm -title testterm -fullscreen -e";
+      mkTest "Xorg keymap", "DISPLAY=:0 xterm -title testterm -class testterm -fullscreen -e";
     '';
   };