smtp: use the upload buffer size for scratch buffer malloc
[platform/upstream/curl.git] / tests / testcurl.pl
index 5cb25f9..9749bc7 100755 (executable)
@@ -6,11 +6,11 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
-# are also available at http://curl.haxx.se/docs/copyright.html.
+# are also available at https://curl.haxx.se/docs/copyright.html.
 #
 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
 # copies of the Software, and permit persons to whom the Software is
@@ -32,7 +32,7 @@
 # curl-autocompile@haxx.se to be dealt with automatically (make sure the
 # subject includes the word "autobuild" as the mail gets silently discarded
 # otherwise).  The most current build status (with a resonable backlog) will
-# be published on the curl site, at http://curl.haxx.se/auto/
+# be published on the curl site, at https://curl.haxx.se/auto/
 
 # USAGE:
 # testcurl.pl [options] [curl-daily-name] > output
@@ -46,6 +46,7 @@
 # --extvercmd=[command]    Command to use for displaying version with cross compiles.
 # --mktarball=[command]    Command to run after completed test
 # --name=[name]            Set name to report as
+# --notes=[notes]          More human-readable information about this configuration
 # --nocvsup                Don't pull from git even though it is a git tree
 # --nogitpull              Don't pull from git even though it is a git tree
 # --nobuildconf            Don't run buildconf
@@ -60,6 +61,7 @@
 use strict;
 
 use Cwd;
+use File::Spec;
 
 # Turn on warnings (equivalent to -w, which can't be used with /usr/bin/env)
 #BEGIN { $^W = 1; }
@@ -73,7 +75,7 @@ use vars qw($name $email $desc $confopts $runtestopts $setupfile $mktarball
             $timestamp $notes);
 
 # version of this script
-$version='2012-11-30';
+$version='2014-11-25';
 $fixed=0;
 
 # Determine if we're running from git or a canned copy of curl,
@@ -88,25 +90,28 @@ $setupfile = 'setup';
 $configurebuild = 1;
 while ($ARGV[0]) {
   if ($ARGV[0] =~ /--target=/) {
-    $targetos = (split(/=/, shift @ARGV))[1];
+    $targetos = (split(/=/, shift @ARGV, 2))[1];
   }
   elsif ($ARGV[0] =~ /--setup=/) {
-    $setupfile = (split(/=/, shift @ARGV))[1];
+    $setupfile = (split(/=/, shift @ARGV, 2))[1];
   }
   elsif ($ARGV[0] =~ /--extvercmd=/) {
-    $extvercmd = (split(/=/, shift @ARGV))[1];
+    $extvercmd = (split(/=/, shift @ARGV, 2))[1];
   }
   elsif ($ARGV[0] =~ /--mktarball=/) {
-    $mktarball = (split(/=/, shift @ARGV))[1];
+    $mktarball = (split(/=/, shift @ARGV, 2))[1];
   }
   elsif ($ARGV[0] =~ /--name=/) {
-    $name = (split(/=/, shift @ARGV))[1];
+    $name = (split(/=/, shift @ARGV, 2))[1];
   }
   elsif ($ARGV[0] =~ /--email=/) {
-    $email = (split(/=/, shift @ARGV))[1];
+    $email = (split(/=/, shift @ARGV, 2))[1];
   }
   elsif ($ARGV[0] =~ /--desc=/) {
-    $desc = (split(/=/, shift @ARGV))[1];
+    $desc = (split(/=/, shift @ARGV, 2))[1];
+  }
+  elsif ($ARGV[0] =~ /--notes=/) {
+    $notes = (split(/=/, shift @ARGV, 2))[1];
   }
   elsif ($ARGV[0] =~ /--configure=(.*)/) {
     $confopts = $1;
@@ -258,7 +263,13 @@ sub get_host_triplet {
   return $triplet;
 }
 
-if (open(F, "$setupfile")) {
+if($name && $email && $desc) {
+  # having these fields set are enough to continue, skip reading the setup
+  # file
+  $infixed=4;
+  $fixed=4;
+}
+elsif (open(F, "$setupfile")) {
   while (<F>) {
     if (/(\w+)=(.*)/) {
       eval "\$$1=$2;";
@@ -266,7 +277,8 @@ if (open(F, "$setupfile")) {
   }
   close(F);
   $infixed=$fixed;
-} else {
+}
+else {
   $infixed=0;    # so that "additional args to configure" works properly first time...
 }
 
@@ -333,6 +345,7 @@ logit "EMAIL = $email";
 logit "DESC = $desc";
 logit "NOTES = $notes";
 logit "CONFOPTS = $confopts";
+logit "RUNTESTOPTS = ".$runtestopts;
 logit "CPPFLAGS = ".$ENV{CPPFLAGS};
 logit "CFLAGS = ".$ENV{CFLAGS};
 logit "LDFLAGS = ".$ENV{LDFLAGS};
@@ -375,6 +388,10 @@ if (-d $CURLDIR) {
     mydie "$CURLDIR is not a daily source dir or checked out from git!"
   }
 }
+
+# make the path absolute so we can use it everywhere
+$CURLDIR = File::Spec->rel2abs("$CURLDIR");
+
 $build="build-$$";
 $buildlogname="buildlog-$$";
 $buildlog="$pwd/$buildlogname";
@@ -400,40 +417,54 @@ chdir $CURLDIR;
 
 # Do the git thing, or not...
 if ($git) {
+  my $gitstat = 0;
+  my @commits;
+
   # update quietly to the latest git
   if($nogitpull) {
     logit "skipping git pull (--nogitpull)";
   } else {
-    my $gitstat = 0;
-    my @commits;
     logit "run git pull in curl";
     system("git pull 2>&1");
     $gitstat += $?;
     logit "failed to update from curl git ($?), continue anyway" if ($?);
+
+    # Set timestamp to the UTC the git update took place.
+    $timestamp = scalar(gmtime)." UTC" if (!$gitstat);
+  }
+
+  # get the last 5 commits for show (even if no pull was made)
+  @commits=`git log --pretty=oneline --abbrev-commit -5`;
+  logit "The most recent curl git commits:";
+  for (@commits) {
+    chomp ($_);
+    logit "  $_";
+  }
+
+  if (-d "ares/.git") {
+    chdir "ares";
+
+    if($nogitpull) {
+      logit "skipping git pull (--nogitpull) in ares";
+    } else {
+      logit "run git pull in ares";
+      system("git pull 2>&1");
+      $gitstat += $?;
+      logit "failed to update from ares git ($?), continue anyway" if ($?);
+
+      # Set timestamp to the UTC the git update took place.
+      $timestamp = scalar(gmtime)." UTC" if (!$gitstat);
+    }
+
     # get the last 5 commits for show (even if no pull was made)
     @commits=`git log --pretty=oneline --abbrev-commit -5`;
-    logit "The most recent curl git commits:";
+    logit "The most recent ares git commits:";
     for (@commits) {
       chomp ($_);
       logit "  $_";
     }
-    if (-d "ares/.git") {
-      chdir "ares";
-      logit "run git pull in ares";
-      system("git pull 2>&1");
-      $gitstat += $?;
-      logit "failed to update from ares git ($?), continue anyway" if ($?);
-      # get the last 5 commits for show (even if no pull was made)
-      @commits=`git log --pretty=oneline --abbrev-commit -5`;
-      logit "The most recent ares git commits:";
-      for (@commits) {
-        chomp ($_);
-        logit "  $_";
-      }
-      chdir "$pwd/$CURLDIR";
-    }
-    # Set timestamp to the UTC the git update took place.
-    $timestamp = scalar(gmtime)." UTC" if (!$gitstat);
+
+    chdir "$CURLDIR";
   }
 
   if($nobuildconf) {
@@ -532,7 +563,7 @@ chdir "$pwd/$build";
 
 if ($configurebuild) {
   # run configure script
-  print `../$CURLDIR/configure $confopts 2>&1`;
+  print `$CURLDIR/configure $confopts 2>&1`;
 
   if (-f "lib/Makefile") {
     logit "configure seems to have finished fine";
@@ -542,26 +573,25 @@ if ($configurebuild) {
 } else {
   logit "copying files to build dir ...";
   if (($^O eq 'MSWin32') && ($targetos !~ /netware/)) {
-    system("xcopy /s /q ..\\$CURLDIR .");
+    system("xcopy /s /q \"$CURLDIR\" .");
     system("buildconf.bat");
   }
   elsif ($targetos =~ /netware/) {
-    system("cp -afr ../$CURLDIR/* .");
-    system("cp -af ../$CURLDIR/Makefile.dist Makefile");
+    system("cp -afr $CURLDIR/* .");
+    system("cp -af $CURLDIR/Makefile.dist Makefile");
     system("$make -i -C lib -f Makefile.netware prebuild");
     system("$make -i -C src -f Makefile.netware prebuild");
-    if (-d "../$CURLDIR/ares") {
+    if (-d "$CURLDIR/ares") {
       system("$make -i -C ares -f Makefile.netware prebuild");
     }
   }
   elsif ($^O eq 'linux') {
-    system("cp -afr ../$CURLDIR/* .");
-    system("cp -af ../$CURLDIR/Makefile.dist Makefile");
-    system("cp -af ../$CURLDIR/include/curl/curlbuild.h.dist ./include/curl/curlbuild.h");
+    system("cp -afr $CURLDIR/* .");
+    system("cp -af $CURLDIR/Makefile.dist Makefile");
     system("$make -i -C lib -f Makefile.$targetos prebuild");
     system("$make -i -C src -f Makefile.$targetos prebuild");
-    if (-d "../$CURLDIR/ares") {
-      system("cp -af ../$CURLDIR/ares/ares_build.h.dist ./ares/ares_build.h");
+    if (-d "$CURLDIR/ares") {
+      system("cp -af $CURLDIR/ares/ares_build.h.dist ./ares/ares_build.h");
       system("$make -i -C ares -f Makefile.$targetos prebuild");
     }
   }
@@ -578,20 +608,6 @@ if(-f "./libcurl.pc") {
   }
 }
 
-if(-f "./include/curl/curlbuild.h") {
-  logit_spaced "display include/curl/curlbuild.h";
-  if(open(F, "<./include/curl/curlbuild.h")) {
-    while(<F>) {
-      my $ll = $_;
-      print $ll if(($ll =~ /^ *# *define *CURL_/) && ($ll !~ /__CURL_CURLBUILD_H/));
-    }
-    close(F);
-  }
-}
-else {
-  mydie "no curlbuild.h created/found";
-}
-
 logit_spaced "display lib/$confheader";
 open(F, "lib/$confheader") or die "lib/$confheader: $!";
 while (<F>) {