test suite now requires gawk

Previously I assumed that some 'awk' existed, but machines with just mawk were
producing test error complaining about strftime()
This commit is contained in:
Dima Kogan 2014-01-25 20:49:13 -08:00
parent 9387a85fe6
commit a9af1925e2

View File

@ -17,14 +17,20 @@ BEGIN {
exit(0); exit(0);
} }
open(my $pipe, 'gnuplot --version |'); my $gawkversion = `gawk -V`;
if( !$pipe ) if( !$gawkversion || $@ )
{
print("1..0 # Skip: gawk is required for strftime() in the test suite. Skipping tests.\n");
exit(0);
}
my $gnuplotVersion = `gnuplot --version`;
if( !$gnuplotVersion || $@)
{ {
print("1..0 # Skip: gnuplot not installed. Tests require ver. 4.6.4; feedgnuplot works with any.\n"); print("1..0 # Skip: gnuplot not installed. Tests require ver. 4.6.4; feedgnuplot works with any.\n");
exit(0); exit(0);
} }
my $gnuplotVersion = <$pipe>;
chomp $gnuplotVersion; chomp $gnuplotVersion;
if ($gnuplotVersion ne "gnuplot 4.6 patchlevel 4") if ($gnuplotVersion ne "gnuplot 4.6 patchlevel 4")
{ {
@ -320,7 +326,7 @@ tryplot( testname => 'basic line plot with bounds, square aspect ratio',
EOF EOF
tryplot( testname => 'lines on both axes with labels, legends, titles', tryplot( testname => 'lines on both axes with labels, legends, titles',
cmd => q{seq 5 | awk '{print 2*$1, $1*$1}'}, cmd => q{seq 5 | gawk '{print 2*$1, $1*$1}'},
options => [qw(--lines --points), options => [qw(--lines --points),
'--legend', '0', 'data 0', '--legend', '0', 'data 0',
'--title', "Test plot", '--title', "Test plot",
@ -369,7 +375,7 @@ tryplot( testname => 'lines on both axes with labels, legends, titles',
EOF EOF
tryplot( testname => 'lines on both axes with labels, legends, titles; different styles', tryplot( testname => 'lines on both axes with labels, legends, titles; different styles',
cmd => q{seq 5 | awk '{print 2*$1, $1*$1}'}, cmd => q{seq 5 | gawk '{print 2*$1, $1*$1}'},
options => ['--legend', '0', 'data 0', options => ['--legend', '0', 'data 0',
'--title', "Test plot", '--title', "Test plot",
qw(--y2 1 --y2label y2 --xlabel x --ylabel y --y2max 30), qw(--y2 1 --y2label y2 --xlabel x --ylabel y --y2max 30),
@ -419,7 +425,7 @@ tryplot( testname => 'lines on both axes with labels, legends, titles; different
EOF EOF
tryplot( testname => 'domain plot', tryplot( testname => 'domain plot',
cmd => q{seq 5 | awk '{print 2*$1, $1*$1}'}, cmd => q{seq 5 | gawk '{print 2*$1, $1*$1}'},
options => [qw(--lines --points), '--domain'], options => [qw(--lines --points), '--domain'],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -465,7 +471,7 @@ tryplot( testname => 'domain plot',
EOF EOF
tryplot( testname => 'dataid plot', tryplot( testname => 'dataid plot',
cmd => q{seq 5 | awk '{print 2*$1, $1*$1}'}, cmd => q{seq 5 | gawk '{print 2*$1, $1*$1}'},
options => [qw(--lines --points), options => [qw(--lines --points),
qw(--dataid --autolegend)], qw(--dataid --autolegend)],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -512,7 +518,7 @@ tryplot( testname => 'dataid plot',
EOF EOF
tryplot( testname => '3d spiral with bounds, labels', tryplot( testname => '3d spiral with bounds, labels',
cmd => q{seq 50 | awk '{print 2*cos($1/5), sin($1/5), $1}'}, cmd => q{seq 50 | gawk '{print 2*cos($1/5), sin($1/5), $1}'},
options => [qw(--lines --points), options => [qw(--lines --points),
qw(--3d --domain --zmin -5 --zmax 45 --zlabel z), qw(--3d --domain --zmin -5 --zmax 45 --zlabel z),
'--extracmds', 'set view 60,30'], '--extracmds', 'set view 60,30'],
@ -560,7 +566,7 @@ tryplot( testname => '3d spiral with bounds, labels',
EOF EOF
tryplot( testname => '3d spiral with bounds, labels, square xy aspect ratio', tryplot( testname => '3d spiral with bounds, labels, square xy aspect ratio',
cmd => q{seq 50 | awk '{print 2*cos($1/5), sin($1/5), $1}'}, cmd => q{seq 50 | gawk '{print 2*cos($1/5), sin($1/5), $1}'},
options => [qw(--lines --points), options => [qw(--lines --points),
qw(--3d --domain --zmin -5 --zmax 45 --zlabel z), qw(--3d --domain --zmin -5 --zmax 45 --zlabel z),
'--extracmds', 'set view 60,30', '--square_xy'], '--extracmds', 'set view 60,30', '--square_xy'],
@ -608,7 +614,7 @@ tryplot( testname => '3d spiral with bounds, labels, square xy aspect ratio',
EOF EOF
tryplot( testname => 'Monotonicity check', tryplot( testname => 'Monotonicity check',
cmd => q{seq 10 | awk '{print (NR-1)%5,NR}'}, cmd => q{seq 10 | gawk '{print (NR-1)%5,NR}'},
options => [qw(--lines --points --domain --monotonic)], options => [qw(--lines --points --domain --monotonic)],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -655,7 +661,7 @@ EOF
tryplot( testname => 'basic --timefmt plot', tryplot( testname => 'basic --timefmt plot',
cmd => q{seq 5 | awk '{print strftime("%d %b %Y %T",1382249107+$1,1),$1}'}, cmd => q{seq 5 | gawk '{print strftime("%d %b %Y %T",1382249107+$1,1),$1}'},
options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S'], options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S'],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -701,7 +707,7 @@ tryplot( testname => 'basic --timefmt plot',
EOF EOF
tryplot( testname => '--timefmt plot with bounds', tryplot( testname => '--timefmt plot with bounds',
cmd => q{seq 5 | awk '{print strftime("%d %b %Y %T",1382249107+$1,1),$1}'}, cmd => q{seq 5 | gawk '{print strftime("%d %b %Y %T",1382249107+$1,1),$1}'},
options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S', options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S',
'--xmin', '20 Oct 2013 06:05:00', '--xmin', '20 Oct 2013 06:05:00',
'--xmax', '20 Oct 2013 06:05:20'], '--xmax', '20 Oct 2013 06:05:20'],
@ -749,7 +755,7 @@ tryplot( testname => '--timefmt plot with bounds',
EOF EOF
tryplot( testname => '--timefmt plot with --monotonic', tryplot( testname => '--timefmt plot with --monotonic',
cmd => q{seq 10 | awk '{x=(NR-1)%5; print strftime("%d %b %Y %T",1382249107+x,1),$1}'}, cmd => q{seq 10 | gawk '{x=(NR-1)%5; print strftime("%d %b %Y %T",1382249107+x,1),$1}'},
options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S', options => ['--domain', '--timefmt', '%d %b %Y %H:%M:%S',
'--monotonic'], '--monotonic'],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -796,7 +802,7 @@ tryplot( testname => '--timefmt plot with --monotonic',
EOF EOF
tryplot( testname => 'Error bars (using extraValuesPerPoint)', tryplot( testname => 'Error bars (using extraValuesPerPoint)',
cmd => q{seq 5 | awk '{print $1,$1,$1/10}'}, cmd => q{seq 5 | gawk '{print $1,$1,$1/10}'},
options => [qw(--domain), options => [qw(--domain),
qw(--extraValuesPerPoint 1 --curvestyle 0), 'with errorbars'], qw(--extraValuesPerPoint 1 --curvestyle 0), 'with errorbars'],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -860,7 +866,7 @@ skip "Skipping unreliable tests. Set RUN_ALL_TESTS environment variable to run t
tryplot( testname => 'Histogram plot', tryplot( testname => 'Histogram plot',
cmd => q{seq 50 | awk '{print $1*$1}'}, cmd => q{seq 50 | gawk '{print $1*$1}'},
options => [qw(--lines --points), options => [qw(--lines --points),
qw(--histo 0 --binwidth 50 --ymin 0 --curvestyleall), 'with boxes'], qw(--histo 0 --binwidth 50 --ymin 0 --curvestyleall), 'with boxes'],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -907,7 +913,7 @@ tryplot( testname => 'Histogram plot',
EOF EOF
tryplot( testname => 'Cumulative histogram', tryplot( testname => 'Cumulative histogram',
cmd => q{seq 50 | awk '{print $1*$1}'}, cmd => q{seq 50 | gawk '{print $1*$1}'},
options => [qw(--lines --points), options => [qw(--lines --points),
qw(--histo 0 --histstyle cum --binwidth 50 --ymin 0 --curvestyleall), 'with boxes'], qw(--histo 0 --histstyle cum --binwidth 50 --ymin 0 --curvestyleall), 'with boxes'],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -954,7 +960,7 @@ tryplot( testname => 'Cumulative histogram',
EOF EOF
tryplot( testname => 'Circles', tryplot( testname => 'Circles',
cmd => q{seq 5 | awk '{print $1,$1,$1/10}'}, cmd => q{seq 5 | gawk '{print $1,$1,$1/10}'},
options => [qw(--circles --domain)], options => [qw(--circles --domain)],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -1008,7 +1014,7 @@ note( "Starting to run streaming tests. These will take several seconds each" );
# points, and then "exit", so I should have two frames worth of data plotted. I # points, and then "exit", so I should have two frames worth of data plotted. I
# pre-send a 0 so that the gnuplot autoscaling is always well-defined # pre-send a 0 so that the gnuplot autoscaling is always well-defined
tryplot( testname => 'basic streaming test', tryplot( testname => 'basic streaming test',
cmd => q{seq 500 | awk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 1.2");}'}, cmd => q{seq 500 | gawk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 1.2");}'},
options => [qw(--lines --points --stream)], options => [qw(--lines --points --stream)],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -1094,7 +1100,7 @@ tryplot( testname => 'basic streaming test',
EOF EOF
tryplot( testname => 'basic streaming test, twice as fast', tryplot( testname => 'basic streaming test, twice as fast',
cmd => q{seq 500 | awk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 0.6");}'}, cmd => q{seq 500 | gawk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 0.6");}'},
options => [qw(--lines --points --stream 0.4)], options => [qw(--lines --points --stream 0.4)],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -1181,7 +1187,7 @@ EOF
tryplot( testname => 'streaming with --xlen', tryplot( testname => 'streaming with --xlen',
cmd => q{seq 500 | awk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 0.6");}'}, cmd => q{seq 500 | gawk 'BEGIN{ print 0; } {print (NR==3)? "exit" : $0; fflush(); system("sleep 0.6");}'},
options => [qw(--lines --points --stream 0.4 --xlen 1.1)], options => [qw(--lines --points --stream 0.4 --xlen 1.1)],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -1267,7 +1273,7 @@ tryplot( testname => 'streaming with --xlen',
EOF EOF
tryplot( testname => 'streaming with --monotonic', tryplot( testname => 'streaming with --monotonic',
cmd => q{seq 500 | awk '{if(NR==11) {print "exit";} else {x=(NR-1)%5; if(x==0) {print -1,-1;} print x,NR;}; fflush(); system("sleep 0.6");}'}, cmd => q{seq 500 | gawk '{if(NR==11) {print "exit";} else {x=(NR-1)%5; if(x==0) {print -1,-1;} print x,NR;}; fflush(); system("sleep 0.6");}'},
options => [qw(--lines --points --stream 0.4 --domain --monotonic)], options => [qw(--lines --points --stream 0.4 --domain --monotonic)],
refplot => <<'EOF' ); refplot => <<'EOF' );
@ -1673,7 +1679,7 @@ tryplot( testname => 'streaming with --monotonic',
EOF EOF
tryplot( testname => '--timefmt streaming plot with --xlen', tryplot( testname => '--timefmt streaming plot with --xlen',
cmd => q{seq 5 | awk 'BEGIN{ print strftime("%d %b %Y %T",1382249107-1,1),-4;} {if(NR==3) {print "exit";} else{ print strftime("%d %b %Y %T",1382249107+$1,1),$1;} fflush(); system("sleep 0.6")}'}, cmd => q{seq 5 | gawk 'BEGIN{ print strftime("%d %b %Y %T",1382249107-1,1),-4;} {if(NR==3) {print "exit";} else{ print strftime("%d %b %Y %T",1382249107+$1,1),$1;} fflush(); system("sleep 0.6")}'},
options => ['--points', '--lines', options => ['--points', '--lines',
'--domain', '--timefmt', '%d %b %Y %H:%M:%S', '--domain', '--timefmt', '%d %b %Y %H:%M:%S',
qw(--stream 0.4 --xlen 3)], qw(--stream 0.4 --xlen 3)],
@ -1761,7 +1767,7 @@ tryplot( testname => '--timefmt streaming plot with --xlen',
EOF EOF
tryplot( testname => '--timefmt streaming plot with --monotonic', tryplot( testname => '--timefmt streaming plot with --monotonic',
cmd => q{seq 10 | awk '{x=(NR-1)%5; if(x==0) {print strftime("%d %b %Y %T",1382249107-1,-4),-4;} print strftime("%d %b %Y %T",1382249107+x,1),NR; fflush(); system("sleep 0.6")}'}, cmd => q{seq 10 | gawk '{x=(NR-1)%5; if(x==0) {print strftime("%d %b %Y %T",1382249107-1,-4),-4;} print strftime("%d %b %Y %T",1382249107+x,1),NR; fflush(); system("sleep 0.6")}'},
options => ['--points', '--lines', options => ['--points', '--lines',
'--domain', '--timefmt', '%d %b %Y %H:%M:%S', '--domain', '--timefmt', '%d %b %Y %H:%M:%S',
qw(--stream 0.4 --monotonic)], qw(--stream 0.4 --monotonic)],