@@ -21,13 +21,13 @@ import ./make-test.nix ({ pkgs, ... }:
21
21
$machine->log("ecryptfs-migrate-home said: $out");
22
22
23
23
# Log alice in (ecryptfs passwhrase is wrapped during first login)
24
- $machine->sleep(2); # urgh: wait for username prompt
24
+ $machine->waitUntilTTYMatches(1, "login: ");
25
25
$machine->sendChars("alice\n");
26
- $machine->sleep(1 );
26
+ $machine->waitUntilTTYMatches(1, "Password: " );
27
27
$machine->sendChars("foobar\n");
28
- $machine->sleep(2 );
28
+ $machine->waitUntilTTYMatches(1, "alice\@machine" );
29
29
$machine->sendChars("logout\n");
30
- $machine->sleep(2 );
30
+ $machine->waitUntilTTYMatches(1, "login: " );
31
31
32
32
# Why do I need to do this??
33
33
$machine->succeed("su alice -c ecryptfs-umount-private || true");
@@ -39,18 +39,19 @@ import ./make-test.nix ({ pkgs, ... }:
39
39
$machine->log("keyctl unlink said: " . $out);
40
40
41
41
# Log alice again
42
+ $machine->waitUntilTTYMatches(1, "login: ");
42
43
$machine->sendChars("alice\n");
43
- $machine->sleep(1 );
44
+ $machine->waitUntilTTYMatches(1, "Password: " );
44
45
$machine->sendChars("foobar\n");
45
- $machine->sleep(2 );
46
+ $machine->waitUntilTTYMatches(1, "alice\@machine" );
46
47
47
48
# Create some files in encrypted home
48
49
$machine->succeed("su alice -c 'touch ~alice/a'");
49
50
$machine->succeed("su alice -c 'echo c > ~alice/b'");
50
51
51
52
# Logout
52
53
$machine->sendChars("logout\n");
53
- $machine->sleep(2 );
54
+ $machine->waitUntilTTYMatches(1, "login: " );
54
55
55
56
# Why do I need to do this??
56
57
$machine->succeed("su alice -c ecryptfs-umount-private || true");
@@ -62,10 +63,11 @@ import ./make-test.nix ({ pkgs, ... }:
62
63
$machine->succeed("su alice -c 'test \! -f ~alice/b'");
63
64
64
65
# Log alice once more
66
+ $machine->waitUntilTTYMatches(1, "login: ");
65
67
$machine->sendChars("alice\n");
66
- $machine->sleep(1 );
68
+ $machine->waitUntilTTYMatches(1, "Password: " );
67
69
$machine->sendChars("foobar\n");
68
- $machine->sleep(2 );
70
+ $machine->waitUntilTTYMatches(1, "alice\@machine" );
69
71
70
72
# Check that the files are there
71
73
$machine->sleep(1);
@@ -77,5 +79,6 @@ import ./make-test.nix ({ pkgs, ... }:
77
79
$machine->succeed("su alice -c 'ls -lh ~alice/'");
78
80
79
81
$machine->sendChars("logout\n");
82
+ $machine->waitUntilTTYMatches(1, "login: ");
80
83
'' ;
81
84
} )
0 commit comments