1#!/usr/local/bin/perl -w 2# 3# Run the test suite and generate a report 4# 5 6if (! -f "Configure") { 7 print "Please run perl util/selftest.pl in the OpenSSL directory.\n"; 8 exit 1; 9} 10 11my $report="testlog"; 12my $os="??"; 13my $version="??"; 14my $platform0="??"; 15my $platform="??"; 16my $options="??"; 17my $last="??"; 18my $ok=0; 19my $cc="cc"; 20my $cversion="??"; 21my $sep="-----------------------------------------------------------------------------\n"; 22my $not_our_fault="\nPlease ask your system administrator/vendor for more information.\n[Problems with your operating system setup should not be reported\nto the OpenSSL project.]\n"; 23 24open(OUT,">$report") or die; 25 26print OUT "OpenSSL self-test report:\n\n"; 27 28$uname=`uname -a`; 29$uname="??\n" if $uname eq ""; 30 31$c=`sh config -t`; 32foreach $_ (split("\n",$c)) { 33 $os=$1 if (/Operating system: (.*)$/); 34 $platform0=$1 if (/Configuring for (.*)$/); 35} 36 37system "sh config" if (! -f "Makefile.ssl"); 38 39if (open(IN,"<Makefile.ssl")) { 40 while (<IN>) { 41 $version=$1 if (/^VERSION=(.*)$/); 42 $platform=$1 if (/^PLATFORM=(.*)$/); 43 $options=$1 if (/^OPTIONS=(.*)$/); 44 $cc=$1 if (/^CC= *(.*)$/); 45 } 46 close(IN); 47} else { 48 print OUT "Error running config!\n"; 49} 50 51$cversion=`$cc -v 2>&1`; 52$cversion=`$cc -V 2>&1` if $cversion =~ "usage"; 53$cversion=`$cc --version` if $cversion eq ""; 54$cversion =~ s/Reading specs.*\n//; 55$cversion =~ s/usage.*\n//; 56chomp $cversion; 57 58if (open(IN,"<CHANGES")) { 59 while(<IN>) {
| 1#!/usr/local/bin/perl -w 2# 3# Run the test suite and generate a report 4# 5 6if (! -f "Configure") { 7 print "Please run perl util/selftest.pl in the OpenSSL directory.\n"; 8 exit 1; 9} 10 11my $report="testlog"; 12my $os="??"; 13my $version="??"; 14my $platform0="??"; 15my $platform="??"; 16my $options="??"; 17my $last="??"; 18my $ok=0; 19my $cc="cc"; 20my $cversion="??"; 21my $sep="-----------------------------------------------------------------------------\n"; 22my $not_our_fault="\nPlease ask your system administrator/vendor for more information.\n[Problems with your operating system setup should not be reported\nto the OpenSSL project.]\n"; 23 24open(OUT,">$report") or die; 25 26print OUT "OpenSSL self-test report:\n\n"; 27 28$uname=`uname -a`; 29$uname="??\n" if $uname eq ""; 30 31$c=`sh config -t`; 32foreach $_ (split("\n",$c)) { 33 $os=$1 if (/Operating system: (.*)$/); 34 $platform0=$1 if (/Configuring for (.*)$/); 35} 36 37system "sh config" if (! -f "Makefile.ssl"); 38 39if (open(IN,"<Makefile.ssl")) { 40 while (<IN>) { 41 $version=$1 if (/^VERSION=(.*)$/); 42 $platform=$1 if (/^PLATFORM=(.*)$/); 43 $options=$1 if (/^OPTIONS=(.*)$/); 44 $cc=$1 if (/^CC= *(.*)$/); 45 } 46 close(IN); 47} else { 48 print OUT "Error running config!\n"; 49} 50 51$cversion=`$cc -v 2>&1`; 52$cversion=`$cc -V 2>&1` if $cversion =~ "usage"; 53$cversion=`$cc --version` if $cversion eq ""; 54$cversion =~ s/Reading specs.*\n//; 55$cversion =~ s/usage.*\n//; 56chomp $cversion; 57 58if (open(IN,"<CHANGES")) { 59 while(<IN>) {
|
60 if (/\*\) (.{0,55})/) {
| 60 if (/\*\) (.{0,55})/ && !/applies to/) {
|
61 $last=$1; 62 last; 63 } 64 } 65 close(IN); 66} 67 68print OUT "OpenSSL version: $version\n"; 69print OUT "Last change: $last...\n"; 70print OUT "Options: $options\n" if $options ne ""; 71print OUT "OS (uname): $uname"; 72print OUT "OS (config): $os\n"; 73print OUT "Target (default): $platform0\n"; 74print OUT "Target: $platform\n"; 75print OUT "Compiler: $cversion\n"; 76print OUT "\n"; 77 78print "Checking compiler...\n"; 79if (open(TEST,">cctest.c")) { 80 print TEST "#include <stdio.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n"; 81 close(TEST); 82 system("$cc -o cctest cctest.c"); 83 if (`./cctest` !~ /Hello world/) { 84 print OUT "Compiler doesn't work.\n"; 85 print OUT $not_our_fault; 86 goto err; 87 } 88 system("ar r cctest.a /dev/null"); 89 if (not -f "cctest.a") { 90 print OUT "Check your archive tool (ar).\n"; 91 print OUT $not_our_fault; 92 goto err; 93 } 94} else { 95 print OUT "Can't create cctest.c\n"; 96} 97if (open(TEST,">cctest.c")) { 98 print TEST "#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n"; 99 close(TEST); 100 system("$cc -o cctest -Iinclude cctest.c"); 101 $cctest = `./cctest`; 102 if ($cctest !~ /OpenSSL $version/) { 103 if ($cctest =~ /OpenSSL/) { 104 print OUT "#include uses headers from different OpenSSL version!\n"; 105 } else { 106 print OUT "Can't compile test program!\n"; 107 } 108 print OUT $not_our_fault; 109 goto err; 110 } 111} else { 112 print OUT "Can't create cctest.c\n"; 113} 114 115print "Running make...\n"; 116if (system("make 2>&1 | tee make.log") > 255) { 117 118 print OUT "make failed!\n"; 119 if (open(IN,"<make.log")) { 120 print OUT $sep; 121 while (<IN>) { 122 print OUT; 123 } 124 close(IN); 125 print OUT $sep; 126 } else { 127 print OUT "make.log not found!\n"; 128 } 129 goto err; 130} 131 132$_=$options; 133s/no-asm//; 134if (/no-/) 135{ 136 print OUT "Test skipped.\n"; 137 goto err; 138} 139 140if (`echo 4+1 | bc` != 5) 141{ 142 print OUT "Can't run bc! Test skipped.\n"; 143 print OUT $not_our_fault; 144 goto err; 145} 146 147print "Running make test...\n"; 148if (system("make test 2>&1 | tee maketest.log") > 255) 149 { 150 print OUT "make test failed!\n"; 151} else { 152 $ok=1; 153} 154 155if ($ok and open(IN,"<maketest.log")) { 156 while (<IN>) { 157 $ok=2 if /^platform: $platform/; 158 } 159 close(IN); 160} 161 162if ($ok != 2) { 163 print OUT "Failure!\n"; 164 if (open(IN,"<make.log")) { 165 print OUT $sep; 166 while (<IN>) { 167 print OUT; 168 } 169 close(IN); 170 print OUT $sep; 171 } else { 172 print OUT "make.log not found!\n"; 173 } 174 if (open(IN,"<maketest.log")) { 175 while (<IN>) { 176 print OUT; 177 } 178 close(IN); 179 print OUT $sep; 180 } else { 181 print OUT "maketest.log not found!\n"; 182 } 183} else { 184 print OUT "Test passed.\n"; 185} 186err: 187close(OUT); 188 189print "\n"; 190open(IN,"<$report") or die; 191while (<IN>) { 192 if (/$sep/) { 193 print "[...]\n"; 194 last; 195 } 196 print; 197} 198print "\nTest report in file $report\n"; 199
| 61 $last=$1; 62 last; 63 } 64 } 65 close(IN); 66} 67 68print OUT "OpenSSL version: $version\n"; 69print OUT "Last change: $last...\n"; 70print OUT "Options: $options\n" if $options ne ""; 71print OUT "OS (uname): $uname"; 72print OUT "OS (config): $os\n"; 73print OUT "Target (default): $platform0\n"; 74print OUT "Target: $platform\n"; 75print OUT "Compiler: $cversion\n"; 76print OUT "\n"; 77 78print "Checking compiler...\n"; 79if (open(TEST,">cctest.c")) { 80 print TEST "#include <stdio.h>\n#include <errno.h>\nmain(){printf(\"Hello world\\n\");}\n"; 81 close(TEST); 82 system("$cc -o cctest cctest.c"); 83 if (`./cctest` !~ /Hello world/) { 84 print OUT "Compiler doesn't work.\n"; 85 print OUT $not_our_fault; 86 goto err; 87 } 88 system("ar r cctest.a /dev/null"); 89 if (not -f "cctest.a") { 90 print OUT "Check your archive tool (ar).\n"; 91 print OUT $not_our_fault; 92 goto err; 93 } 94} else { 95 print OUT "Can't create cctest.c\n"; 96} 97if (open(TEST,">cctest.c")) { 98 print TEST "#include <openssl/opensslv.h>\nmain(){printf(OPENSSL_VERSION_TEXT);}\n"; 99 close(TEST); 100 system("$cc -o cctest -Iinclude cctest.c"); 101 $cctest = `./cctest`; 102 if ($cctest !~ /OpenSSL $version/) { 103 if ($cctest =~ /OpenSSL/) { 104 print OUT "#include uses headers from different OpenSSL version!\n"; 105 } else { 106 print OUT "Can't compile test program!\n"; 107 } 108 print OUT $not_our_fault; 109 goto err; 110 } 111} else { 112 print OUT "Can't create cctest.c\n"; 113} 114 115print "Running make...\n"; 116if (system("make 2>&1 | tee make.log") > 255) { 117 118 print OUT "make failed!\n"; 119 if (open(IN,"<make.log")) { 120 print OUT $sep; 121 while (<IN>) { 122 print OUT; 123 } 124 close(IN); 125 print OUT $sep; 126 } else { 127 print OUT "make.log not found!\n"; 128 } 129 goto err; 130} 131 132$_=$options; 133s/no-asm//; 134if (/no-/) 135{ 136 print OUT "Test skipped.\n"; 137 goto err; 138} 139 140if (`echo 4+1 | bc` != 5) 141{ 142 print OUT "Can't run bc! Test skipped.\n"; 143 print OUT $not_our_fault; 144 goto err; 145} 146 147print "Running make test...\n"; 148if (system("make test 2>&1 | tee maketest.log") > 255) 149 { 150 print OUT "make test failed!\n"; 151} else { 152 $ok=1; 153} 154 155if ($ok and open(IN,"<maketest.log")) { 156 while (<IN>) { 157 $ok=2 if /^platform: $platform/; 158 } 159 close(IN); 160} 161 162if ($ok != 2) { 163 print OUT "Failure!\n"; 164 if (open(IN,"<make.log")) { 165 print OUT $sep; 166 while (<IN>) { 167 print OUT; 168 } 169 close(IN); 170 print OUT $sep; 171 } else { 172 print OUT "make.log not found!\n"; 173 } 174 if (open(IN,"<maketest.log")) { 175 while (<IN>) { 176 print OUT; 177 } 178 close(IN); 179 print OUT $sep; 180 } else { 181 print OUT "maketest.log not found!\n"; 182 } 183} else { 184 print OUT "Test passed.\n"; 185} 186err: 187close(OUT); 188 189print "\n"; 190open(IN,"<$report") or die; 191while (<IN>) { 192 if (/$sep/) { 193 print "[...]\n"; 194 last; 195 } 196 print; 197} 198print "\nTest report in file $report\n"; 199
|