]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - tools/testing/ktest/ktest.pl
ktest: Restore tty settings after closing console
[karo-tx-linux.git] / tools / testing / ktest / ktest.pl
index b9cd036f0442e8c0e9814119fd458ffef2c166ed..1dae000f79f87ef36ffd507b851ba4e2dc4df0af 100755 (executable)
@@ -178,6 +178,7 @@ my $checkout;
 my $localversion;
 my $iteration = 0;
 my $successes = 0;
+my $stty;
 
 my $bisect_good;
 my $bisect_bad;
@@ -1349,6 +1350,9 @@ sub open_console {
 
     my $flags;
 
+    # save terminal settings
+    $stty = `stty -g`;
+
     my $pid = open($fp, "$console|") or
        dodie "Can't open console $console";
 
@@ -1368,6 +1372,9 @@ sub close_console {
 
     print "closing!\n";
     close($fp);
+
+    # restore terminal settings
+    system("stty $stty");
 }
 
 sub start_monitor {
@@ -1534,10 +1541,14 @@ sub fail {
 
 sub run_command {
     my ($command, $redirect) = @_;
+    my $start_time;
+    my $end_time;
     my $dolog = 0;
     my $dord = 0;
     my $pid;
 
+    $start_time = time;
+
     $command =~ s/\$SSH_USER/$ssh_user/g;
     $command =~ s/\$MACHINE/$machine/g;
 
@@ -1570,6 +1581,15 @@ sub run_command {
     close(LOG) if ($dolog);
     close(RD)  if ($dord);
 
+    $end_time = time;
+    my $delta = $end_time - $start_time;
+
+    if ($delta == 1) {
+       doprint "[1 second] ";
+    } else {
+       doprint "[$delta seconds] ";
+    }
+
     if ($failed) {
        doprint "FAILED!\n";
     } else {