summaryrefslogtreecommitdiffstats
path: root/nixos/tests
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2016-12-01 09:04:35 -0500
committerGraham Christensen <graham@grahamc.com>2016-12-02 19:36:27 -0500
commitd5cb4d8734abad70d31e4ccc839d20db7bb362a5 (patch)
tree9fd271d96fe9bfb2afd8648a4f4b96526b34176a /nixos/tests
parent4f8b74b4015db7ec788807eec1c5e260379d429b (diff)
ecryptfs test: use TTY output to stabilize test
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/ecryptfs.nix21
1 files changed, 12 insertions, 9 deletions
diff --git a/nixos/tests/ecryptfs.nix b/nixos/tests/ecryptfs.nix
index db800c7bb2c2..041be0f5a624 100644
--- a/nixos/tests/ecryptfs.nix
+++ b/nixos/tests/ecryptfs.nix
@@ -21,13 +21,13 @@ import ./make-test.nix ({ pkgs, ... }:
$machine->log("ecryptfs-migrate-home said: $out");
# Log alice in (ecryptfs passwhrase is wrapped during first login)
- $machine->sleep(2); # urgh: wait for username prompt
+ $machine->waitUntilTTYMatches(1, "login: ");
$machine->sendChars("alice\n");
- $machine->sleep(1);
+ $machine->waitUntilTTYMatches(1, "Password: ");
$machine->sendChars("foobar\n");
- $machine->sleep(2);
+ $machine->waitUntilTTYMatches(1, "alice\@machine");
$machine->sendChars("logout\n");
- $machine->sleep(2);
+ $machine->waitUntilTTYMatches(1, "login: ");
# Why do I need to do this??
$machine->succeed("su alice -c ecryptfs-umount-private || true");
@@ -39,10 +39,11 @@ import ./make-test.nix ({ pkgs, ... }:
$machine->log("keyctl unlink said: " . $out);
# Log alice again
+ $machine->waitUntilTTYMatches(1, "login: ");
$machine->sendChars("alice\n");
- $machine->sleep(1);
+ $machine->waitUntilTTYMatches(1, "Password: ");
$machine->sendChars("foobar\n");
- $machine->sleep(2);
+ $machine->waitUntilTTYMatches(1, "alice\@machine");
# Create some files in encrypted home
$machine->succeed("su alice -c 'touch ~alice/a'");
@@ -50,7 +51,7 @@ import ./make-test.nix ({ pkgs, ... }:
# Logout
$machine->sendChars("logout\n");
- $machine->sleep(2);
+ $machine->waitUntilTTYMatches(1, "login: ");
# Why do I need to do this??
$machine->succeed("su alice -c ecryptfs-umount-private || true");
@@ -62,10 +63,11 @@ import ./make-test.nix ({ pkgs, ... }:
$machine->succeed("su alice -c 'test \! -f ~alice/b'");
# Log alice once more
+ $machine->waitUntilTTYMatches(1, "login: ");
$machine->sendChars("alice\n");
- $machine->sleep(1);
+ $machine->waitUntilTTYMatches(1, "Password: ");
$machine->sendChars("foobar\n");
- $machine->sleep(2);
+ $machine->waitUntilTTYMatches(1, "alice\@machine");
# Check that the files are there
$machine->sleep(1);
@@ -77,5 +79,6 @@ import ./make-test.nix ({ pkgs, ... }:
$machine->succeed("su alice -c 'ls -lh ~alice/'");
$machine->sendChars("logout\n");
+ $machine->waitUntilTTYMatches(1, "login: ");
'';
})