@@ -504,6 +504,31 @@ sub screenshot {
504504 }, { image => $name } );
505505}
506506
507+# Get the text of TTY<n>
508+sub getTTYText {
509+ my ($self, $tty) = @_;
510+
511+ my ($status, $out) = $self->execute("fold -w 80 /dev/vcs${tty}");
512+ return $out;
513+}
514+
515+# Wait until TTY<n>'s text matches a particular regular expression
516+sub waitUntilTTYMatches {
517+ my ($self, $tty, $regexp) = @_;
518+
519+ $self->nest("waiting for $regexp to appear on tty $tty", sub {
520+ retry sub {
521+ return 1 if $self->getTTYText($tty) =~ /$regexp/;
522+ }
523+ });
524+}
525+
526+# Debugging: Dump the contents of the TTY<n>
527+sub dumpTTYContents {
528+ my ($self, $tty) = @_;
529+
530+ $self->execute("fold -w 80 /dev/vcs${tty} | systemd-cat");
531+}
507532
508533# Take a screenshot and return the result as text using optical character
509534# recognition.