Remove building with NOCRYPTO option
[minix.git] / external / bsd / tcpdump / dist / tests / TESTonce
blob30ffccdb27f9224c65292fd8b81c36d952645c11
1 #!/usr/bin/env perl
3 system("mkdir -p NEW DIFF");
5 if(@ARGV != 4) {
6 print "Usage: TESTonce name input output options\n";
7 exit 20;
10 $name=$ARGV[0];
11 $input=$ARGV[1];
12 $output=$ARGV[2];
13 $options=$ARGV[3];
15 my $r;
17 if ($^O eq 'MSWin32') {
18 $r = system "..\\windump -n -r $input $options 2>NUL | sed 's/\\r//' | tee NEW/$output | diff $output - >DIFF/$output.diff";
19 # need to do same as below for Cygwin.
21 else {
22 # we used to do this as a nice pipeline, but the problem is that $r fails to
23 # to be set properly if the tcpdump core dumps.
24 $r = system "../tcpdump 2>/dev/null -n -r $input $options >NEW/$output";
25 if($r == 0x100) {
26 # this means tcpdump exited with code 1.
27 open(OUTPUT, ">>"."NEW/$output") || die "fail to open $output\n";
28 printf OUTPUT "EXIT CODE %08x\n", $r;
29 close(OUTPUT);
30 $r = 0;
32 if($r == 0) {
33 $r = system "cat NEW/$output | diff $output - >DIFF/$output.diff";
35 #print sprintf("END: %08x\n", $r);
38 if($r == 0) {
39 printf " %-30s: passed\n", $name;
40 unlink "DIFF/$output.diff";
41 exit 0;
43 printf " %-30s: TEST FAILED", $name;
44 open FOUT, '>>failure-outputs.txt';
45 printf FOUT "Failed test: $name\n\n";
46 close FOUT;
47 if(-f "DIFF/$output.diff") {
48 system "cat DIFF/$output.diff >> failure-outputs.txt";
51 if($r == -1) {
52 print " (failed to execute: $!)\n";
53 exit 30;
56 # this is not working right, $r == 0x8b00 when there is a core dump.
57 # clearly, we need some platform specific perl magic to take this apart, so look for "core"
58 # too.
59 if($r & 127 || -f "core") {
60 my $with = ($r & 128) ? 'with' : 'without';
61 if(-f "core") {
62 $with = "with";
64 printf " (terminated with signal %u, %s coredump)\n", ($r & 127), $with;
65 exit ($r & 128) ? 10 : 20;
67 print "\n";
68 exit $r >> 8;