[BACK]Return to regress.pl CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc / regress

Diff for /mandoc/regress/regress.pl between version 1.1 and 1.6

version 1.1, 2017/02/08 03:02:13 version 1.6, 2017/05/30 19:30:40
Line 24  use strict;
Line 24  use strict;
 # nor for piping it into the Perl program.  # nor for piping it into the Perl program.
 use IPC::Open3 qw(open3);  use IPC::Open3 qw(open3);
   
   # Define this at one place such that it can easily be changed
   # if diff(1) does not support the -a option.
   my @diff = qw(diff -au);
   
 # --- utility functions ------------------------------------------------  # --- utility functions ------------------------------------------------
   
 sub usage ($) {  sub usage ($) {
Line 109  for (@ARGV) {
Line 113  for (@ARGV) {
                 $displaylevel = int;                  $displaylevel = int;
                 next;                  next;
         }          }
         /^(all|ascii|utf8|man|html|lint|clean|verbose)$/          /^(all|ascii|utf8|man|html|markdown|lint|clean|verbose)$/
             or usage "$_: invalid modifier";              or usage "$_: invalid modifier";
         $targets{$_} = 1;          $targets{$_} = 1;
 }  }
 $targets{all} = 1  $targets{all} = 1
     unless $targets{ascii} || $targets{utf8} || $targets{man} ||      unless $targets{ascii} || $targets{utf8} || $targets{man} ||
       $targets{html} || $targets{lint} || $targets{clean};        $targets{html} || $targets{markdown} ||
         $targets{lint} || $targets{clean};
 $targets{ascii} = $targets{utf8} = $targets{man} = $targets{html} =  $targets{ascii} = $targets{utf8} = $targets{man} = $targets{html} =
     $targets{lint} = 1 if $targets{all};      $targets{markdown} = $targets{lint} = 1 if $targets{all};
 $displaylevel = 3 if $targets{verbose};  $displaylevel = 3 if $targets{verbose};
   
   
Line 138  sub parse_makefile ($) {
Line 143  sub parse_makefile ($) {
                 my $var = $1;                  my $var = $1;
                 my $opt = $2;                  my $opt = $2;
                 my $val = $3;                  my $val = $3;
                 $val =~ s/\${(\w+)}/$vars{$1}/;                  $val =~ s/\$\{(\w+)\}/$vars{$1}/;
                 $val = "$vars{$var} $val" if $opt eq '+';                  $val = "$vars{$var} $val" if $opt eq '+';
                 $vars{$var} = $val                  $vars{$var} = $val
                     unless $opt eq '?' && defined $vars{$var};                      unless $opt eq '?' && defined $vars{$var};
Line 156  if ($subdir eq '.') {
Line 161  if ($subdir eq '.') {
   
 my @mandoc = '../mandoc';  my @mandoc = '../mandoc';
 my @subdir_names;  my @subdir_names;
 my (@regress_testnames, @utf8_testnames, @html_testnames, @lint_testnames);  my (@regress_testnames, @utf8_testnames, @lint_testnames);
 my (%skip_ascii, %skip_man);  my (@html_testnames, @markdown_testnames);
   my (%skip_ascii, %skip_man, %skip_markdown);
   
 push @mandoc, split ' ', $vars{MOPTS} if $vars{MOPTS};  push @mandoc, split ' ', $vars{MOPTS} if $vars{MOPTS};
 delete $vars{MOPTS};  delete $vars{MOPTS};
Line 181  if (defined $vars{HTML_TARGETS}) {
Line 187  if (defined $vars{HTML_TARGETS}) {
         @html_testnames = split ' ', $vars{HTML_TARGETS};          @html_testnames = split ' ', $vars{HTML_TARGETS};
         delete $vars{HTML_TARGETS};          delete $vars{HTML_TARGETS};
 }  }
   if (defined $vars{MARKDOWN_TARGETS}) {
           @markdown_testnames = split ' ', $vars{MARKDOWN_TARGETS};
           delete $vars{MARKDOWN_TARGETS};
   }
 if (defined $vars{LINT_TARGETS}) {  if (defined $vars{LINT_TARGETS}) {
         @lint_testnames = split ' ', $vars{LINT_TARGETS};          @lint_testnames = split ' ', $vars{LINT_TARGETS};
         delete $vars{LINT_TARGETS};          delete $vars{LINT_TARGETS};
Line 196  if (defined $vars{SKIP_TMAN}) {
Line 206  if (defined $vars{SKIP_TMAN}) {
         $skip_man{$_} = 1 for split ' ', $vars{SKIP_TMAN};          $skip_man{$_} = 1 for split ' ', $vars{SKIP_TMAN};
         delete $vars{SKIP_TMAN};          delete $vars{SKIP_TMAN};
 }  }
   if (defined $vars{SKIP_MARKDOWN}) {
           $skip_markdown{$_} = 1 for split ' ', $vars{SKIP_MARKDOWN};
           delete $vars{SKIP_MARKDOWN};
   }
 if (keys %vars) {  if (keys %vars) {
         my @vars = keys %vars;          my @vars = keys %vars;
         die "unknown var(s) @vars";          die "unknown var(s) @vars";
 }  }
 map { $skip_ascii{$_} = 1; } @regress_testnames if $skip_ascii{ALL};  map { $skip_ascii{$_} = 1; } @regress_testnames if $skip_ascii{ALL};
 map { $skip_man{$_} = 1; } @regress_testnames if $skip_man{ALL};  map { $skip_man{$_} = 1; } @regress_testnames if $skip_man{ALL};
   map { $skip_markdown{$_} = 1; } @regress_testnames if $skip_markdown{ALL};
   
 # --- run targets ------------------------------------------------------  # --- run targets ------------------------------------------------------
   
Line 227  for my $testname (@regress_testnames) {
Line 242  for my $testname (@regress_testnames) {
                 print "@mandoc -T ascii $i\n" if $targets{verbose};                  print "@mandoc -T ascii $i\n" if $targets{verbose};
                 sysout $o, @mandoc, qw(-T ascii), $i                  sysout $o, @mandoc, qw(-T ascii), $i
                     and fail $subdir, $testname, 'ascii:mandoc';                      and fail $subdir, $testname, 'ascii:mandoc';
                 system qw(diff -au), $w, $o                  system @diff, $w, $o
                     and fail $subdir, $testname, 'ascii:diff';                      and fail $subdir, $testname, 'ascii:diff';
         }          }
         my $m = "$subdir/$testname.in_man";          my $m = "$subdir/$testname.in_man";
Line 241  for my $testname (@regress_testnames) {
Line 256  for my $testname (@regress_testnames) {
                 print "@mandoc -man -T ascii $m\n" if $targets{verbose};                  print "@mandoc -man -T ascii $m\n" if $targets{verbose};
                 sysout $mo, @mandoc, qw(-man -T ascii -O mdoc), $m                  sysout $mo, @mandoc, qw(-man -T ascii -O mdoc), $m
                     and fail $subdir, $testname, 'man:mandoc';                      and fail $subdir, $testname, 'man:mandoc';
                 system qw(diff -au), $w, $mo                  system @diff, $w, $mo
                     and fail $subdir, $testname, 'man:diff';                      and fail $subdir, $testname, 'man:diff';
         }          }
         if ($targets{clean}) {          if ($targets{clean}) {
Line 266  for my $testname (@utf8_testnames) {
Line 281  for my $testname (@utf8_testnames) {
                 print "@mandoc -T utf8 $i\n" if $targets{verbose};                  print "@mandoc -T utf8 $i\n" if $targets{verbose};
                 sysout $o, @mandoc, qw(-T utf8), $i                  sysout $o, @mandoc, qw(-T utf8), $i
                     and fail $subdir, $testname, 'utf8:mandoc';                      and fail $subdir, $testname, 'utf8:mandoc';
                 system qw(diff -au), $w, $o                  system @diff, $w, $o
                     and fail $subdir, $testname, 'utf8:diff';                      and fail $subdir, $testname, 'utf8:diff';
         }          }
         if ($targets{clean}) {          if ($targets{clean}) {
Line 287  for my $testname (@html_testnames) {
Line 302  for my $testname (@html_testnames) {
                 print "@mandoc -T html $i\n" if $targets{verbose};                  print "@mandoc -T html $i\n" if $targets{verbose};
                 syshtml $o, @mandoc, qw(-T html), $i                  syshtml $o, @mandoc, qw(-T html), $i
                     and fail $subdir, $testname, 'html:mandoc';                      and fail $subdir, $testname, 'html:mandoc';
                 system qw(diff -au), $w, $o                  system @diff, $w, $o
                     and fail $subdir, $testname, 'html:diff';                      and fail $subdir, $testname, 'html:diff';
         }          }
         if ($targets{clean}) {          if ($targets{clean}) {
Line 296  for my $testname (@html_testnames) {
Line 311  for my $testname (@html_testnames) {
         }          }
 }  }
   
   my $count_markdown = 0;
   for my $testname (@regress_testnames) {
           next if $onlytest && $testname ne $onlytest;
           my $i = "$subdir/$testname.in";
           my $o = "$subdir/$testname.mandoc_markdown";
           my $w = "$subdir/$testname.out_markdown";
           if ($targets{markdown} && !$skip_markdown{$testname}) {
                   $count_markdown++;
                   $count_total++;
                   print "@mandoc -T markdown $i\n" if $targets{verbose};
                   sysout $o, @mandoc, qw(-T markdown), $i
                       and fail $subdir, $testname, 'markdown:mandoc';
                   system @diff, $w, $o
                       and fail $subdir, $testname, 'markdown:diff';
           }
           if ($targets{clean}) {
                   print "rm $o\n" if $targets{verbose};
                   unlink $o;
           }
   }
   
 my $count_lint = 0;  my $count_lint = 0;
 for my $testname (@lint_testnames) {  for my $testname (@lint_testnames) {
         next if $onlytest && $testname ne $onlytest;          next if $onlytest && $testname ne $onlytest;
Line 305  for my $testname (@lint_testnames) {
Line 341  for my $testname (@lint_testnames) {
         if ($targets{lint}) {          if ($targets{lint}) {
                 $count_lint++;                  $count_lint++;
                 $count_total++;                  $count_total++;
                 print "@mandoc -T lint $i\n" if $targets{verbose};                  print "@mandoc -T lint -W all $i\n" if $targets{verbose};
                 syslint $o, @mandoc, qw(-T lint), $i                  syslint $o, @mandoc, qw(-T lint -W all), $i
                     and fail $subdir, $testname, 'lint:mandoc';                      and fail $subdir, $testname, 'lint:mandoc';
                 system qw(diff -au), $w, $o                  system @diff, $w, $o
                     and fail $subdir, $testname, 'lint:diff';                      and fail $subdir, $testname, 'lint:diff';
         }          }
         if ($targets{clean}) {          if ($targets{clean}) {
Line 330  print " $count_ascii ascii" if $count_ascii;
Line 366  print " $count_ascii ascii" if $count_ascii;
 print " $count_man man" if $count_man;  print " $count_man man" if $count_man;
 print " $count_utf8 utf8" if $count_utf8;  print " $count_utf8 utf8" if $count_utf8;
 print " $count_html html" if $count_html;  print " $count_html html" if $count_html;
   print " $count_markdown markdown" if $count_markdown;
 print " $count_lint lint" if $count_lint;  print " $count_lint lint" if $count_lint;
   
 if (@failures) {  if (@failures) {

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.6

CVSweb