testcurl.pl 19 KB

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