quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

testcurl.pl (22056B)


      1 #!/usr/bin/env perl
      2 #***************************************************************************
      3 #                                  _   _ ____  _
      4 #  Project                     ___| | | |  _ \| |
      5 #                             / __| | | | |_) | |
      6 #                            | (__| |_| |  _ <| |___
      7 #                             \___|\___/|_| \_\_____|
      8 #
      9 # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
     10 #
     11 # This software is licensed as described in the file COPYING, which
     12 # you should have received as part of this distribution. The terms
     13 # are also available at https://curl.se/docs/copyright.html.
     14 #
     15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
     16 # copies of the Software, and permit persons to whom the Software is
     17 # furnished to do so, under the terms of the COPYING file.
     18 #
     19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
     20 # KIND, either express or implied.
     21 #
     22 # SPDX-License-Identifier: curl
     23 #
     24 ###########################################################################
     25 
     26 ###########################
     27 #  What is This Script?
     28 ###########################
     29 
     30 # testcurl.pl is the master script to use for automatic testing of curl
     31 # directly off its source repository.
     32 # This is written for the purpose of being run from a crontab job or similar
     33 # at a regular interval. The output is suitable to be mailed to
     34 # curl-autocompile@haxx.se to be dealt with automatically (make sure the
     35 # subject includes the word "autobuild" as the mail gets silently discarded
     36 # otherwise).  The most current build status (with a reasonable backlog) will
     37 # be published on the curl site, at https://curl.se/auto/
     38 
     39 # USAGE:
     40 # testcurl.pl [options] [curl-daily-name] > output
     41 
     42 # Options:
     43 #
     44 # --configure=[options]    Configure options
     45 # --crosscompile           This is a crosscompile
     46 # --desc=[desc]            Description of your test system
     47 # --email=[email]          Set email address to report as
     48 # --extvercmd=[command]    Command to use for displaying version with cross compiles.
     49 # --mktarball=[command]    Command to run after completed test
     50 # --name=[name]            Set name to report as
     51 # --notes=[notes]          More human-readable information about this configuration
     52 # --nocvsup                Don't pull from git even though it is a git tree
     53 # --nogitpull              Don't pull from git even though it is a git tree
     54 # --nobuildconf            Don't run autoreconf -fi
     55 # --noconfigure            Don't run configure
     56 # --runtestopts=[options]  Options to pass to runtests.pl
     57 # --setup=[file name]      File name to read setup from (deprecated)
     58 # --target=[your os]       Specify your target environment.
     59 #
     60 # if [curl-daily-name] is omitted, a 'curl' git directory is assumed.
     61 #
     62 
     63 use strict;
     64 
     65 use Cwd;
     66 use File::Spec;
     67 
     68 # Turn on warnings (equivalent to -w, which can't be used with /usr/bin/env)
     69 #BEGIN { $^W = 1; }
     70 
     71 use vars qw($version $fixed $infixed $CURLDIR $git $pwd $build $buildlog
     72             $buildlogname $configurebuild $targetos $confheader $binext
     73             $libext);
     74 
     75 use vars qw($name $email $desc $confopts $runtestopts $setupfile $mktarball
     76             $extvercmd $nogitpull $nobuildconf $crosscompile
     77             $timestamp $notes);
     78 
     79 # version of this script
     80 $version='2024-11-28';
     81 $fixed=0;
     82 
     83 # Determine if we're running from git or a canned copy of curl,
     84 # or if we got a specific target option or setup file option.
     85 $CURLDIR="curl";
     86 if(-f ".git/config") {
     87     $CURLDIR = "./";
     88 }
     89 
     90 $git=1;
     91 $setupfile = 'setup';
     92 $configurebuild = 1;
     93 while($ARGV[0]) {
     94     if($ARGV[0] =~ /--target=/) {
     95         $targetos = (split(/=/, shift @ARGV, 2))[1];
     96     }
     97     elsif($ARGV[0] =~ /--setup=/) {
     98         $setupfile = (split(/=/, shift @ARGV, 2))[1];
     99     }
    100     elsif($ARGV[0] =~ /--extvercmd=/) {
    101         $extvercmd = (split(/=/, shift @ARGV, 2))[1];
    102     }
    103     elsif($ARGV[0] =~ /--mktarball=/) {
    104         $mktarball = (split(/=/, shift @ARGV, 2))[1];
    105     }
    106     elsif($ARGV[0] =~ /--name=/) {
    107         $name = (split(/=/, shift @ARGV, 2))[1];
    108     }
    109     elsif($ARGV[0] =~ /--email=/) {
    110         $email = (split(/=/, shift @ARGV, 2))[1];
    111     }
    112     elsif($ARGV[0] =~ /--desc=/) {
    113         $desc = (split(/=/, shift @ARGV, 2))[1];
    114     }
    115     elsif($ARGV[0] =~ /--notes=/) {
    116         $notes = (split(/=/, shift @ARGV, 2))[1];
    117     }
    118     elsif($ARGV[0] =~ /--configure=(.*)/) {
    119         $confopts = $1;
    120         shift @ARGV;
    121     }
    122     elsif(($ARGV[0] eq "--nocvsup") || ($ARGV[0] eq "--nogitpull")) {
    123         $nogitpull=1;
    124         shift @ARGV;
    125     }
    126     elsif($ARGV[0] =~ /--nobuildconf/) {
    127         $nobuildconf=1;
    128         shift @ARGV;
    129     }
    130     elsif($ARGV[0] =~ /--noconfigure/) {
    131         $configurebuild=0;
    132         shift @ARGV;
    133     }
    134     elsif($ARGV[0] =~ /--crosscompile/) {
    135         $crosscompile=1;
    136         shift @ARGV;
    137     }
    138     elsif($ARGV[0] =~ /--runtestopts=/) {
    139         $runtestopts = (split(/=/, shift @ARGV, 2))[1];
    140     }
    141     else {
    142         $CURLDIR=shift @ARGV;
    143         $git=0; # a given dir, assume not using git
    144     }
    145 }
    146 
    147 # Do the platform-specific stuff here
    148 $confheader = 'curl_config.h';
    149 $binext = '';
    150 $libext = '.la'; # .la since both libcurl and libcares are made with libtool
    151 if($^O eq 'MSWin32' || $targetos) {
    152     if(!$targetos) {
    153         # If no target defined on Windows, let's assume vc
    154         $targetos = 'vc';
    155     }
    156     if($targetos =~ /vc/ || $targetos =~ /borland/) {
    157         $binext = '.exe';
    158         $libext = '.lib';
    159     }
    160     elsif($targetos =~ /mingw/) {
    161         $binext = '.exe';
    162         if($^O eq 'MSWin32') {
    163             $libext = '.a';
    164         }
    165     }
    166 }
    167 
    168 if(($^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys') &&
    169    ($targetos =~ /vc/ || $targetos =~ /mingw32/ ||
    170     $targetos =~ /borland/)) {
    171 
    172   # Set these things only when building ON Windows and for Win32 platform.
    173   # FOR Windows since we might be cross-compiling on another system. Non-
    174   # Windows builds still default to configure-style builds with curl_config.h.
    175 
    176   $configurebuild = 0;
    177   $confheader = 'config-win32.h';
    178 }
    179 
    180 $ENV{LC_ALL}="C" if(($ENV{LC_ALL}) && ($ENV{LC_ALL} !~ /^C$/));
    181 $ENV{LC_CTYPE}="C" if(($ENV{LC_CTYPE}) && ($ENV{LC_CTYPE} !~ /^C$/));
    182 $ENV{LANG}="C";
    183 
    184 sub rmtree($) {
    185     my $target = $_[0];
    186     if($^O eq 'MSWin32') {
    187         foreach (glob($target)) {
    188             s:/:\\:g;
    189             system("rd /s /q $_");
    190         }
    191     } else {
    192         system("rm -rf $target");
    193     }
    194 }
    195 
    196 sub grepfile($$) {
    197     my ($target, $fn) = @_;
    198     open(my $fh, "<", $fn) or die;
    199     while(<$fh>) {
    200         if(/$target/) {
    201             close($fh);
    202             return 1;
    203         }
    204     }
    205     close($fh);
    206     return 0;
    207 }
    208 
    209 sub logit($) {
    210     my $text=$_[0];
    211     if($text) {
    212         print "testcurl: $text\n";
    213     }
    214 }
    215 
    216 sub logit_spaced($) {
    217     my $text=$_[0];
    218     if($text) {
    219         print "\ntestcurl: $text\n\n";
    220     }
    221 }
    222 
    223 sub mydie($){
    224     my $text=$_[0];
    225     logit "$text";
    226     chdir $pwd; # cd back to the original root dir
    227 
    228     if($pwd && $build) {
    229         # we have a build directory name, remove the dir
    230         logit "removing the $build dir";
    231         rmtree "$pwd/$build";
    232     }
    233     if(-r $buildlog) {
    234         # we have a build log output file left, remove it
    235         logit "removing the $buildlogname file";
    236         unlink "$buildlog";
    237     }
    238     logit "ENDING HERE"; # last line logged!
    239     exit 1;
    240 }
    241 
    242 sub get_host_triplet {
    243   my $triplet;
    244   my $configfile = "$pwd/$build/lib/curl_config.h";
    245 
    246   if(-f $configfile && -s $configfile && open(my $libconfigh, "<", "$configfile")) {
    247       while(<$libconfigh>) {
    248           if($_ =~ /^\#define\s+CURL_OS\s+"*([^"][^"]*)"*\s*/) {
    249               $triplet = $1;
    250               last;
    251           }
    252       }
    253       close($libconfigh);
    254   }
    255   return $triplet;
    256 }
    257 
    258 if($name && $email && $desc) {
    259     # having these fields set are enough to continue, skip reading the setup
    260     # file
    261     $infixed=4;
    262     $fixed=4;
    263 }
    264 elsif(open(my $f, "<", "$setupfile")) {
    265     while(<$f>) {
    266         if(/(\w+)=(.*)/) {
    267             eval "\$$1=$2;";
    268         }
    269     }
    270     close($f);
    271     $infixed=$fixed;
    272 }
    273 else {
    274     $infixed=0;    # so that "additional args to configure" works properly first time...
    275 }
    276 
    277 if(!$name) {
    278     print "please enter your name\n";
    279     $name = <>;
    280     chomp $name;
    281     $fixed=1;
    282 }
    283 
    284 if(!$email) {
    285     print "please enter your contact email address\n";
    286     $email = <>;
    287     chomp $email;
    288     $fixed=2;
    289 }
    290 
    291 if(!$desc) {
    292     print "please enter a one line system description\n";
    293     $desc = <>;
    294     chomp $desc;
    295     $fixed=3;
    296 }
    297 
    298 if(!$confopts) {
    299     if($infixed < 4) {
    300         print "please enter your additional arguments to configure\n";
    301         print "examples: --with-openssl --enable-debug --enable-ipv6\n";
    302         $confopts = <>;
    303         chomp $confopts;
    304     }
    305 }
    306 
    307 
    308 if($fixed < 4) {
    309     $fixed=4;
    310     open(my $f, ">", "$setupfile") or die;
    311     print $f "name='$name'\n";
    312     print $f "email='$email'\n";
    313     print $f "desc='$desc'\n";
    314     print $f "confopts='$confopts'\n";
    315     print $f "notes='$notes'\n";
    316     print $f "fixed='$fixed'\n";
    317     close($f);
    318 }
    319 
    320 # Enable picky compiler warnings unless explicitly disabled
    321 if(($confopts !~ /--enable-debug/) &&
    322    ($confopts !~ /--enable-warnings/) &&
    323    ($confopts !~ /--disable-warnings/)) {
    324     $confopts .= " --enable-warnings";
    325 }
    326 
    327 my $str1066os = 'o' x 1066;
    328 
    329 # Set timestamp to the UTC this script is running. Its value might
    330 # be changed later in the script to the value present in curlver.h
    331 $timestamp = scalar(gmtime)." UTC";
    332 
    333 logit "STARTING HERE"; # first line logged, for scripts to trigger on
    334 logit 'TRANSFER CONTROL ==== 1120 CHAR LINE' . $str1066os . 'LINE_END';
    335 logit "NAME = $name";
    336 logit "EMAIL = $email";
    337 logit "DESC = $desc";
    338 logit "NOTES = $notes";
    339 logit "CONFOPTS = $confopts";
    340 logit "RUNTESTOPTS = ".$runtestopts;
    341 logit "CPPFLAGS = ".$ENV{CPPFLAGS};
    342 logit "CFLAGS = ".$ENV{CFLAGS};
    343 logit "LDFLAGS = ".$ENV{LDFLAGS};
    344 logit "LIBS = ".$ENV{LIBS};
    345 logit "CC = ".$ENV{CC};
    346 logit "TMPDIR = ".$ENV{TMPDIR};
    347 logit "MAKEFLAGS = ".$ENV{MAKEFLAGS};
    348 logit "ACLOCAL_FLAGS = ".$ENV{ACLOCAL_FLAGS};
    349 logit "PKG_CONFIG_PATH = ".$ENV{PKG_CONFIG_PATH};
    350 logit "DYLD_LIBRARY_PATH = ".$ENV{DYLD_LIBRARY_PATH};
    351 logit "LD_LIBRARY_PATH = ".$ENV{LD_LIBRARY_PATH};
    352 logit "LIBRARY_PATH = ".$ENV{LIBRARY_PATH};
    353 logit "SHLIB_PATH = ".$ENV{SHLIB_PATH};
    354 logit "LIBPATH = ".$ENV{LIBPATH};
    355 logit "target = ".$targetos;
    356 logit "version = $version"; # script version
    357 logit "date = $timestamp";  # When the test build starts
    358 
    359 $str1066os = undef;
    360 
    361 # Make $pwd to become the path without newline. We'll use that in order to cut
    362 # off that path from all possible logs and error messages etc.
    363 $pwd = getcwd();
    364 
    365 my $have_embedded_ares = 0;
    366 
    367 if(-d $CURLDIR) {
    368     if($git && -d "$CURLDIR/.git") {
    369         logit "$CURLDIR is verified to be a fine git source dir";
    370         # remove the generated sources to force them to be re-generated each
    371         # time we run this test
    372         unlink "$CURLDIR/src/tool_hugehelp.c";
    373         # find out if curl source dir has an in-tree c-ares repo
    374         $have_embedded_ares = 1 if(-f "$CURLDIR/ares/GIT-INFO");
    375     } elsif(!$git && -f "$CURLDIR/tests/testcurl.pl") {
    376         logit "$CURLDIR is verified to be a fine daily source dir";
    377         # find out if curl source dir has an in-tree c-ares extracted tarball
    378         $have_embedded_ares = 1 if(-f "$CURLDIR/ares/ares_build.h");
    379     } else {
    380         mydie "$CURLDIR is not a daily source dir or checked out from git!"
    381     }
    382 }
    383 
    384 # make the path absolute so we can use it everywhere
    385 $CURLDIR = File::Spec->rel2abs("$CURLDIR");
    386 
    387 $build="build-$$";
    388 $buildlogname="buildlog-$$";
    389 $buildlog="$pwd/$buildlogname";
    390 
    391 # remove any previous left-overs
    392 rmtree "build-*";
    393 rmtree "buildlog-*";
    394 
    395 # this is to remove old build logs that ended up in the wrong dir
    396 foreach(glob("$CURLDIR/buildlog-*")) { unlink $_; }
    397 
    398 # create a dir to build in
    399 mkdir $build, 0777;
    400 
    401 if(-d $build) {
    402     logit "build dir $build was created fine";
    403 } else {
    404     mydie "failed to create dir $build";
    405 }
    406 
    407 # get in the curl source tree root
    408 chdir $CURLDIR;
    409 
    410 # Do the git thing, or not...
    411 if($git) {
    412     my $gitstat = 0;
    413     my @commits;
    414 
    415     # update quietly to the latest git
    416     if($nogitpull) {
    417         logit "skipping git pull (--nogitpull)";
    418     } else {
    419         logit "run git pull in curl";
    420         system("git pull 2>&1");
    421         $gitstat += $?;
    422         logit "failed to update from curl git ($?), continue anyway" if($?);
    423 
    424         # Set timestamp to the UTC the git update took place.
    425         $timestamp = scalar(gmtime)." UTC" if(!$gitstat);
    426     }
    427 
    428     # get the last 5 commits for show (even if no pull was made)
    429     @commits=`git log --pretty=oneline --abbrev-commit -5`;
    430     logit "The most recent curl git commits:";
    431     for(@commits) {
    432         chomp ($_);
    433         logit "  $_";
    434     }
    435 
    436     if(-d "ares/.git") {
    437         chdir "ares";
    438 
    439         if($nogitpull) {
    440             logit "skipping git pull (--nogitpull) in ares";
    441         } else {
    442             logit "run git pull in ares";
    443             system("git pull 2>&1");
    444             $gitstat += $?;
    445             logit "failed to update from ares git ($?), continue anyway" if($?);
    446 
    447             # Set timestamp to the UTC the git update took place.
    448             $timestamp = scalar(gmtime)." UTC" if(!$gitstat);
    449         }
    450 
    451         # get the last 5 commits for show (even if no pull was made)
    452         @commits=`git log --pretty=oneline --abbrev-commit -5`;
    453         logit "The most recent ares git commits:";
    454         for (@commits) {
    455             chomp ($_);
    456             logit "  $_";
    457         }
    458 
    459         chdir "$CURLDIR";
    460     }
    461 
    462     if($nobuildconf) {
    463         logit "told to not run autoreconf -fi";
    464     }
    465     elsif($configurebuild) {
    466         # remove possible left-overs from the past
    467         unlink "configure";
    468         unlink "autom4te.cache";
    469 
    470         # generate the build files
    471         logit "invoke autoreconf";
    472         open(my $f, "-|", "autoreconf -fi 2>&1") or die;
    473         open(my $log, ">", "$buildlog") or die;
    474         while(<$f>) {
    475             my $ll = $_;
    476             print $ll;
    477             print $log $ll;
    478         }
    479         close($f);
    480         close($log);
    481 
    482         logit "autoreconf -fi was successful";
    483     }
    484     else {
    485         logit "autoreconf -fi was successful (dummy message)";
    486     }
    487 
    488 } else {
    489     # Show snapshot git commit when available
    490     if(open (my $f, '<', "docs/tarball-commit.txt")) {
    491         my $commit = <$f>;
    492         chomp $commit;
    493         logit "The most recent curl git commits:";
    494         logit "  $commit";
    495         close($f);
    496     }
    497 }
    498 
    499 # Set timestamp to the one in curlver.h if this isn't a git test build.
    500 if((-f "include/curl/curlver.h") &&
    501     (open(my $f, "<", "include/curl/curlver.h"))) {
    502     while(<$f>) {
    503         chomp;
    504         if($_ =~ /^\#define\s+LIBCURL_TIMESTAMP\s+\"(.+)\".*$/) {
    505             my $stampstring = $1;
    506             if($stampstring !~ /DEV/) {
    507                $stampstring =~ s/\s+UTC//;
    508                 $timestamp = $stampstring." UTC";
    509             }
    510             last;
    511         }
    512     }
    513     close($f);
    514 }
    515 
    516 # Show timestamp we are using for this test build.
    517 logit "timestamp = $timestamp";
    518 
    519 if($configurebuild) {
    520     if(-f "configure") {
    521         logit "configure created (at least it exists)";
    522     } else {
    523         mydie "no configure created/found";
    524     }
    525 } else {
    526    logit "configure created (dummy message)"; # dummy message to feign success
    527 }
    528 
    529 sub findinpath {
    530     my $c;
    531     my $e;
    532     my $x = ($^O eq 'MSWin32') ? '.exe' : '';
    533     my $s = ($^O eq 'MSWin32') ? ';' : ':';
    534     my $p=$ENV{'PATH'};
    535     my @pa = split($s, $p);
    536     for $c (@_) {
    537         for $e (@pa) {
    538             if(-x "$e/$c$x") {
    539                 return $c;
    540             }
    541         }
    542     }
    543 }
    544 
    545 my $make = findinpath("gmake", "make", "nmake");
    546 if(!$make) {
    547     mydie "Couldn't find make in the PATH";
    548 }
    549 # force to 'nmake' for VC builds
    550 $make = "nmake" if($targetos =~ /vc/);
    551 logit "going with $make as make";
    552 
    553 # change to build dir
    554 chdir "$pwd/$build";
    555 
    556 if($configurebuild) {
    557     # run configure script
    558     print `$CURLDIR/configure $confopts 2>&1`;
    559 
    560     if(-f "lib/Makefile") {
    561         logit "configure seems to have finished fine";
    562     } else {
    563         mydie "configure didn't work";
    564     }
    565 } else {
    566     logit "copying files to build dir ...";
    567     if($^O eq 'MSWin32') {
    568         system("xcopy /s /q \"$CURLDIR\" .");
    569     }
    570 }
    571 
    572 if(-f "./libcurl.pc") {
    573     logit_spaced "display libcurl.pc";
    574     if(open(my $f, "<", "libcurl.pc")) {
    575         while(<$f>) {
    576             my $ll = $_;
    577             print $ll if(($ll !~ /^ *#/) && ($ll !~ /^ *$/));
    578         }
    579         close($f);
    580     }
    581 }
    582 
    583 logit_spaced "display lib/$confheader";
    584 open(my $f, "<", "lib/$confheader") or die "lib/$confheader: $!";
    585 while(<$f>) {
    586     print if /^ *#/;
    587 }
    588 close($f);
    589 
    590 if(($have_embedded_ares) &&
    591     (grepfile("^#define USE_ARES", "lib/$confheader"))) {
    592     print "\n";
    593     logit "setup to build ares";
    594 
    595     if(-f "./ares/libcares.pc") {
    596         logit_spaced  "display ares/libcares.pc";
    597         if(open($f, "<", "ares/libcares.pc")) {
    598             while(<$f>) {
    599                 my $ll = $_;
    600                 print $ll if(($ll !~ /^ *#/) && ($ll !~ /^ *$/));
    601             }
    602             close($f);
    603         }
    604     }
    605 
    606     if(-f "./ares/ares_build.h") {
    607         logit_spaced "display ares/ares_build.h";
    608         if(open($f, "<", "ares/ares_build.h")) {
    609             while(<$f>) {
    610                 my $ll = $_;
    611                 print $ll if(($ll =~ /^ *# *define *CARES_/) && ($ll !~ /__CARES_BUILD_H/));
    612             }
    613             close($f);
    614         }
    615     }
    616     else {
    617         mydie "no ares_build.h created/found";
    618     }
    619 
    620     $confheader =~ s/curl/ares/;
    621     logit_spaced "display ares/$confheader";
    622     if(open($f, "<", "ares/$confheader")) {
    623         while(<$f>) {
    624             print if /^ *#/;
    625         }
    626         close($f);
    627     }
    628 
    629     print "\n";
    630     logit "build ares";
    631     chdir "ares";
    632 
    633     if($targetos && !$configurebuild) {
    634         logit "$make -f Makefile.$targetos";
    635         open($f, "-|", "$make -f Makefile.$targetos 2>&1") or die;
    636     }
    637     else {
    638         logit "$make";
    639         open($f, "-|", "$make 2>&1") or die;
    640     }
    641     while(<$f>) {
    642         s/$pwd//g;
    643         print;
    644     }
    645     close($f);
    646 
    647     if(-f "libcares$libext") {
    648         logit "ares is now built successfully (libcares$libext)";
    649     } else {
    650         mydie "ares build failed (libcares$libext)";
    651     }
    652 
    653     # cd back to the curl build dir
    654     chdir "$pwd/$build";
    655 }
    656 
    657 my $mkcmd = "$make -i" . ($targetos && !$configurebuild ? " $targetos" : "");
    658 logit "$mkcmd";
    659 open(my $f, "-|", "$mkcmd 2>&1") or die;
    660 while(<$f>) {
    661     s/$pwd//g;
    662     print;
    663 }
    664 close($f);
    665 
    666 if(-f "lib/libcurl$libext") {
    667     logit "libcurl was created fine (libcurl$libext)";
    668 }
    669 else {
    670     mydie "libcurl was not created (libcurl$libext)";
    671 }
    672 
    673 if(-f "src/curl$binext") {
    674     logit "curl was created fine (curl$binext)";
    675 }
    676 else {
    677     mydie "curl was not created (curl$binext)";
    678 }
    679 
    680 if(!$crosscompile || (($extvercmd ne '') && (-x $extvercmd))) {
    681     logit "display curl${binext} --version output";
    682     my $cmd = ($extvercmd ne '' ? $extvercmd.' ' : '')."./src/curl${binext} --version|";
    683     open($f, "<", $cmd);
    684     while(<$f>) {
    685         # strip CR from output on non-Windows platforms (WINE on Linux)
    686         s/\r// if($^O ne 'MSWin32');
    687         print;
    688     }
    689     close($f);
    690 }
    691 
    692 if($configurebuild && !$crosscompile) {
    693     my $host_triplet = get_host_triplet();
    694     # build example programs for selected build targets
    695     if(($host_triplet =~ /([^-]+)-([^-]+)-irix(.*)/) ||
    696        ($host_triplet =~ /([^-]+)-([^-]+)-aix(.*)/) ||
    697        ($host_triplet =~ /([^-]+)-([^-]+)-osf(.*)/) ||
    698        ($host_triplet =~ /([^-]+)-([^-]+)-solaris2(.*)/)) {
    699         chdir "$pwd/$build/docs/examples";
    700         logit_spaced "build examples";
    701         open($f, "-|", "$make -i 2>&1") or die;
    702         open(my $log, ">", "$buildlog") or die;
    703         while(<$f>) {
    704             s/$pwd//g;
    705             print;
    706             print $log $_;
    707         }
    708         close($f);
    709         close($log);
    710         chdir "$pwd/$build";
    711     }
    712     # build and run full test suite
    713     my $o;
    714     if($runtestopts) {
    715         $o = "TEST_F=\"$runtestopts\" ";
    716     }
    717     logit "$make -k ${o}test-full";
    718     open($f, "-|", "$make -k ${o}test-full 2>&1") or die;
    719     open(my $log, ">", "$buildlog") or die;
    720     while(<$f>) {
    721         s/$pwd//g;
    722         print;
    723         print $log $_;
    724     }
    725     close($f);
    726     close($log);
    727 
    728     if(grepfile("^TEST", $buildlog)) {
    729         logit "tests were run";
    730     } else {
    731         mydie "test suite failure";
    732     }
    733 
    734     if(grepfile("^TESTFAIL:", $buildlog)) {
    735         logit "the tests were not successful";
    736     } else {
    737         logit "the tests were successful!";
    738     }
    739 }
    740 else {
    741     if($crosscompile) {
    742         my $host_triplet = get_host_triplet();
    743         # build example programs for selected cross-compiles
    744         if(($host_triplet =~ /([^-]+)-([^-]+)-mingw(.*)/) ||
    745            ($host_triplet =~ /([^-]+)-([^-]+)-android(.*)/)) {
    746             chdir "$pwd/$build/docs/examples";
    747             logit_spaced "build examples";
    748             open($f, "-|", "$make -i 2>&1") or die;
    749             open(my $log, ">", "$buildlog") or die;
    750             while(<$f>) {
    751                 s/$pwd//g;
    752                 print;
    753                 print $log $_;
    754             }
    755             close($f);
    756             close($log);
    757             chdir "$pwd/$build";
    758         }
    759         # build test harness programs for selected cross-compiles
    760         if($host_triplet =~ /([^-]+)-([^-]+)-mingw(.*)/) {
    761             chdir "$pwd/$build/tests";
    762             logit_spaced "build test harness";
    763             open(my $f, "-|", "$make -i 2>&1") or die;
    764             open(my $log, ">", "$buildlog") or die;
    765             while(<$f>) {
    766                 s/$pwd//g;
    767                 print;
    768                 print $log $_;
    769             }
    770             close($f);
    771             close($log);
    772             chdir "$pwd/$build";
    773         }
    774         logit_spaced "cross-compiling, can't run tests";
    775     }
    776     # dummy message to feign success
    777     print "TESTDONE: 1 tests out of 0 (dummy message)\n";
    778 }
    779 
    780 # create a tarball if we got that option.
    781 if(($mktarball ne '') && (-x $mktarball)) {
    782     system($mktarball);
    783 }
    784 
    785 logit "enddate = ".scalar(gmtime)." UTC";  # When the run ends
    786 # mydie to cleanup
    787 mydie "ending nicely";