quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [patch 4/8] test/run: Massive reindentation


From: Jean Delvare
Subject: [Quilt-dev] [patch 4/8] test/run: Massive reindentation
Date: Sun, 02 Feb 2014 15:20:02 +0100
User-agent: quilt/0.61-1

Code indentation in this file is inconsistent, this makes editing it
difficult. Use tabulations everywhere.
---
 test/run |  303 +++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 150 insertions(+), 153 deletions(-)

--- a/test/run
+++ b/test/run
@@ -150,180 +150,177 @@ print_footer "$status\n";
 flush_output $failed;
 exit $failed ? 1 : 0;
 
-
 sub process_test($$$$) {
-  my ($prog, $prog_line, $in, $out) = @_;
+       my ($prog, $prog_line, $in, $out) = @_;
 
-       print_body "[$prog_line] \$ $prog -- ";
-       my ($exec_status, $result) = exec_test($prog, $in);
-       my @good = ();
-       my $nmax = (@$out > @$result) ? @$out : @$result;
-       for (my $n=0; $n < $nmax; $n++) {
-          my $use_re;
-          if (defined $out->[$n] && $out->[$n] =~ /^~ /) {
-               $use_re = 1;
-               $out->[$n] =~ s/^~ //g;
-          }
-
-           if (!defined($out->[$n]) || !defined($result->[$n]) ||
-               (!$use_re && $result->[$n] ne $out->[$n]) ||
-               ( $use_re && $result->[$n] !~ /^$out->[$n]/)) {
-               push @good, ($use_re ? '!~' : '!=');
-          }
-          else {
-               push @good, ($use_re ? '=~' : '==');
-           }
-       }
-       my $good = !grep(/!/, @good);
-       $tests++;
-       $failed++ unless $good;
-       print_body(($good ? $OK : $FAILED)."\n");
-       if (!$good || $opt_v) {
-         for (my $n=0; $n < $nmax; $n++) {
-          my $l = defined($out->[$n]) ? $out->[$n] : "~";
-          chomp $l;
-          my $r = defined($result->[$n]) ? $result->[$n] : "~";
-          chomp $r;
-          print_body sprintf("%-" . ($width-3) . "s %s %s\n",
-                             $r, $good[$n], $l);
-         }
-       }
+       print_body "[$prog_line] \$ $prog -- ";
+       my ($exec_status, $result) = exec_test($prog, $in);
+       my @good = ();
+       my $nmax = (@$out > @$result) ? @$out : @$result;
+       for (my $n = 0; $n < $nmax; $n++) {
+               my $use_re;
+               if (defined $out->[$n] && $out->[$n] =~ /^~ /) {
+                       $use_re = 1;
+                       $out->[$n] =~ s/^~ //g;
+               }
+
+               if (!defined($out->[$n]) || !defined($result->[$n]) ||
+                   (!$use_re && $result->[$n] ne $out->[$n]) ||
+                   ( $use_re && $result->[$n] !~ /^$out->[$n]/)) {
+                       push @good, ($use_re ? '!~' : '!=');
+               } else {
+                       push @good, ($use_re ? '=~' : '==');
+               }
+       }
+       my $good = !grep(/!/, @good);
+       $tests++;
+       $failed++ unless $good;
+       print_body(($good ? $OK : $FAILED)."\n");
+       if (!$good || $opt_v) {
+               for (my $n = 0; $n < $nmax; $n++) {
+                       my $l = defined($out->[$n]) ? $out->[$n] : "~";
+                       chomp $l;
+                       my $r = defined($result->[$n]) ? $result->[$n] : "~";
+                       chomp $r;
+                       print_body sprintf("%-" . ($width - 3) . "s %s %s\n",
+                                          $r, $good[$n], $l);
+               }
+       }
 
-       return $exec_status;
+       return $exec_status;
 }
 
-
 sub exec_test($$) {
-  my ($raw_prog, $in) = @_;
-  local (*IN, *IN_DUP, *IN2, *OUT_DUP, *OUT, *OUT2);
-  my $prog = [ shellwords($raw_prog) ];
-  my $needs_shell = ($raw_prog =~ /[][|<>;`\$\*\?]/);
-
-  if ($prog->[0] eq "umask") {
-    umask oct $prog->[1];
-    return 0, [];
-  } elsif ($prog->[0] eq "cd") {
-    if (!chdir $prog->[1]) {
-      return 1, [ "chdir: $prog->[1]: $!\n" ];
-    }
-    $ENV{PWD} = getcwd;
-    return 0, [];
-  } elsif ($prog->[0] eq "export") {
-    my ($name, $value) = split /=/, $prog->[1];
-    $ENV{$name} = $value;
-    return 0, [];
-  } elsif ($prog->[0] eq "unset") {
-    delete $ENV{$prog->[1]};
-    return 0, [];
-  }
-
-  pipe *IN2, *OUT
-    or die "Can't create pipe for reading: $!";
-  open *IN_DUP, "<&STDIN"
-    or *IN_DUP = undef;
-  open *STDIN, "<&IN2"
-    or die "Can't duplicate pipe for reading: $!";
-  close *IN2;
-
-  open *OUT_DUP, ">&STDOUT"
-    or die "Can't duplicate STDOUT: $!";
-  pipe *IN, *OUT2
-    or die "Can't create pipe for writing: $!";
-  open *STDOUT, ">&OUT2"
-    or die "Can't duplicate pipe for writing: $!";
-  close *OUT2;
-
-  *STDOUT->autoflush();
-  *OUT->autoflush();
-
-  if (fork()) {
-    # Server
-    if (*IN_DUP) {
-      open *STDIN, "<&IN_DUP"
-        or die "Can't duplicate STDIN: $!";
-      close *IN_DUP
-        or die "Can't close STDIN duplicate: $!";
-    }
-    open *STDOUT, ">&OUT_DUP"
-      or die "Can't duplicate STDOUT: $!";
-    close *OUT_DUP
-      or die "Can't close STDOUT duplicate: $!";
-
-    foreach my $line (@$in) {
-      #print "> $line";
-      print OUT $line;
-    }
-    close *OUT
-      or die "Can't close pipe for writing: $!";
-
-    my $result = [];
-    while (<IN>) {
-      #print "< $_";
-      if ($needs_shell) {
-       s#^/bin/sh: line \d+: ##;
-      }
-      push @$result, $_;
-    }
-    wait();
-    return $? >> 8, $result;
-  } else {
-    # Client
-    $< = $>;
-    close IN
-      or die "Can't close read end for input pipe: $!";
-    close OUT
-      or die "Can't close write end for output pipe: $!";
-    close OUT_DUP
-      or die "Can't close STDOUT duplicate: $!";
-    local *ERR_DUP;
-    open ERR_DUP, ">&STDERR"
-      or die "Can't duplicate STDERR: $!";
-    open STDERR, ">&STDOUT"
-      or die "Can't join STDOUT and STDERR: $!";
-
-    if ($needs_shell) {
-      exec ('/bin/sh', '-c', $raw_prog);
-    } else {
-      exec @$prog;
-    }
-    print STDERR $prog->[0], ": $!\n";
-    exit;
-  }
+       my ($raw_prog, $in) = @_;
+       local (*IN, *IN_DUP, *IN2, *OUT_DUP, *OUT, *OUT2);
+       my $prog = [ shellwords($raw_prog) ];
+       my $needs_shell = ($raw_prog =~ /[][|<>;`\$\*\?]/);
+
+       if ($prog->[0] eq "umask") {
+               umask oct $prog->[1];
+               return 0, [];
+       } elsif ($prog->[0] eq "cd") {
+               if (!chdir $prog->[1]) {
+                       return 1, [ "chdir: $prog->[1]: $!\n" ];
+               }
+               $ENV{PWD} = getcwd;
+               return 0, [];
+       } elsif ($prog->[0] eq "export") {
+               my ($name, $value) = split /=/, $prog->[1];
+               $ENV{$name} = $value;
+               return 0, [];
+       } elsif ($prog->[0] eq "unset") {
+               delete $ENV{$prog->[1]};
+               return 0, [];
+       }
+
+       pipe *IN2, *OUT
+               or die "Can't create pipe for reading: $!";
+       open *IN_DUP, "<&STDIN"
+               or *IN_DUP = undef;
+       open *STDIN, "<&IN2"
+               or die "Can't duplicate pipe for reading: $!";
+       close *IN2;
+
+       open *OUT_DUP, ">&STDOUT"
+               or die "Can't duplicate STDOUT: $!";
+       pipe *IN, *OUT2
+               or die "Can't create pipe for writing: $!";
+       open *STDOUT, ">&OUT2"
+               or die "Can't duplicate pipe for writing: $!";
+       close *OUT2;
+
+       *STDOUT->autoflush();
+       *OUT->autoflush();
+
+       if (fork()) {
+               # Server
+               if (*IN_DUP) {
+                       open *STDIN, "<&IN_DUP"
+                               or die "Can't duplicate STDIN: $!";
+                       close *IN_DUP
+                               or die "Can't close STDIN duplicate: $!";
+               }
+               open *STDOUT, ">&OUT_DUP"
+                       or die "Can't duplicate STDOUT: $!";
+               close *OUT_DUP
+                       or die "Can't close STDOUT duplicate: $!";
+
+               foreach my $line (@$in) {
+                       #print "> $line";
+                       print OUT $line;
+               }
+               close *OUT
+                       or die "Can't close pipe for writing: $!";
+
+               my $result = [];
+               while (<IN>) {
+                       #print "< $_";
+                       if ($needs_shell) {
+                               s#^/bin/sh: line \d+: ##;
+                       }
+                       push @$result, $_;
+               }
+               wait();
+               return $? >> 8, $result;
+       } else {
+               # Client
+               $< = $>;
+               close IN
+                       or die "Can't close read end for input pipe: $!";
+               close OUT
+                       or die "Can't close write end for output pipe: $!";
+               close OUT_DUP
+                       or die "Can't close STDOUT duplicate: $!";
+               local *ERR_DUP;
+               open ERR_DUP, ">&STDERR"
+                       or die "Can't duplicate STDERR: $!";
+               open STDERR, ">&STDOUT"
+                       or die "Can't join STDOUT and STDERR: $!";
+
+               if ($needs_shell) {
+                       exec ('/bin/sh', '-c', $raw_prog);
+               } else {
+                       exec @$prog;
+               }
+               print STDERR $prog->[0], ": $!\n";
+               exit;
+       }
 }
 
 sub print_header($)
 {
-  if ($opt_q) {
-    $output{header} = $_[0];
-  } else {
-    print $_[0];
-  }
+       if ($opt_q) {
+               $output{header} = $_[0];
+       } else {
+               print $_[0];
+       }
 }
 
 sub print_body($)
 {
-  if ($opt_q) {
-    $output{body} .= $_[0];
-  } else {
-    print $_[0];
-  }
+       if ($opt_q) {
+               $output{body} .= $_[0];
+       } else {
+               print $_[0];
+       }
 }
 
 sub print_footer($)
 {
-  if ($opt_q) {
-    $output{footer} .= $_[0];
-  } else {
-    print $_[0];
-  }
+       if ($opt_q) {
+               $output{footer} .= $_[0];
+       } else {
+               print $_[0];
+       }
 }
 
 sub flush_output($)
 {
-  my $failed = shift;
-  return unless $opt_q;
+       my $failed = shift;
+       return unless $opt_q;
 
-  print $output{header} || "",
-        $failed ? $output{body} : "",
-        $output{footer} || "";
+       print $output{header} || "",
+             $failed ? $output{body} : "",
+             $output{footer} || "";
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]