Skip to content

Commit b5b1959

Browse files
committedDec 3, 2016
ecryptfs test: use TTY output to stabilize test
(cherry picked from commit d5cb4d8)
1 parent 39c31ca commit b5b1959

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed
 

‎nixos/tests/ecryptfs.nix

+12-9
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import ./make-test.nix ({ pkgs, ... }:
2121
$machine->log("ecryptfs-migrate-home said: $out");
2222
2323
# Log alice in (ecryptfs passwhrase is wrapped during first login)
24-
$machine->sleep(2); # urgh: wait for username prompt
24+
$machine->waitUntilTTYMatches(1, "login: ");
2525
$machine->sendChars("alice\n");
26-
$machine->sleep(1);
26+
$machine->waitUntilTTYMatches(1, "Password: ");
2727
$machine->sendChars("foobar\n");
28-
$machine->sleep(2);
28+
$machine->waitUntilTTYMatches(1, "alice\@machine");
2929
$machine->sendChars("logout\n");
30-
$machine->sleep(2);
30+
$machine->waitUntilTTYMatches(1, "login: ");
3131
3232
# Why do I need to do this??
3333
$machine->succeed("su alice -c ecryptfs-umount-private || true");
@@ -39,18 +39,19 @@ import ./make-test.nix ({ pkgs, ... }:
3939
$machine->log("keyctl unlink said: " . $out);
4040
4141
# Log alice again
42+
$machine->waitUntilTTYMatches(1, "login: ");
4243
$machine->sendChars("alice\n");
43-
$machine->sleep(1);
44+
$machine->waitUntilTTYMatches(1, "Password: ");
4445
$machine->sendChars("foobar\n");
45-
$machine->sleep(2);
46+
$machine->waitUntilTTYMatches(1, "alice\@machine");
4647
4748
# Create some files in encrypted home
4849
$machine->succeed("su alice -c 'touch ~alice/a'");
4950
$machine->succeed("su alice -c 'echo c > ~alice/b'");
5051
5152
# Logout
5253
$machine->sendChars("logout\n");
53-
$machine->sleep(2);
54+
$machine->waitUntilTTYMatches(1, "login: ");
5455
5556
# Why do I need to do this??
5657
$machine->succeed("su alice -c ecryptfs-umount-private || true");
@@ -62,10 +63,11 @@ import ./make-test.nix ({ pkgs, ... }:
6263
$machine->succeed("su alice -c 'test \! -f ~alice/b'");
6364
6465
# Log alice once more
66+
$machine->waitUntilTTYMatches(1, "login: ");
6567
$machine->sendChars("alice\n");
66-
$machine->sleep(1);
68+
$machine->waitUntilTTYMatches(1, "Password: ");
6769
$machine->sendChars("foobar\n");
68-
$machine->sleep(2);
70+
$machine->waitUntilTTYMatches(1, "alice\@machine");
6971
7072
# Check that the files are there
7173
$machine->sleep(1);
@@ -77,5 +79,6 @@ import ./make-test.nix ({ pkgs, ... }:
7779
$machine->succeed("su alice -c 'ls -lh ~alice/'");
7880
7981
$machine->sendChars("logout\n");
82+
$machine->waitUntilTTYMatches(1, "login: ");
8083
'';
8184
})

0 commit comments

Comments
 (0)
Please sign in to comment.