]> granicus.if.org Git - curl/commitdiff
changed testcurl script to allow building test harness
authorYang Tse <yangsita@gmail.com>
Thu, 11 Jun 2009 01:22:35 +0000 (01:22 +0000)
committerYang Tse <yangsita@gmail.com>
Thu, 11 Jun 2009 01:22:35 +0000 (01:22 +0000)
programs when cross-compiling for a *-*-mingw* host.

CHANGES
tests/testcurl.pl

diff --git a/CHANGES b/CHANGES
index b65b41721ead599e331ed6a6146db9ef551d7a1b..bd4add6bb2edd104649febcbe0afa818493d1b2c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@
 
                                   Changelog
 
+Yang Tse (11 Jun 2009)
+- I adapted testcurl script to allow building test harness programs when
+  cross-compiling for a *-*-mingw* host.
+
 Daniel Stenberg (10 Jun 2009)
 - Fabian Keil ran clang on the (lib)curl code, found a bunch of warnings and
   contributed a range of patches to fix them.
index 4b53195232ef097321b2b1b39c30aa701d9387a7..530f060171700ac2690a4eda9594c5127e078670 100755 (executable)
@@ -228,6 +228,22 @@ sub mydie($){
     exit 1;
 }
 
+sub get_host_triplet {
+  my $triplet;
+  my $configfile = "$pwd/$build/lib/config.h";
+
+  if(-f $configfile && -s $configfile && open(LIBCONFIGH, "<$configfile")) {
+    while(<LIBCONFIGH>) {
+      if($_ =~ /^\#define\s+OS\s+"*([^"][^"]*)"*\s*/) {
+        $triplet = $1;
+        last;
+      }
+    }
+    close(LIBCONFIGH);
+  }
+  return $triplet;
+}
+
 if (open(F, "$setupfile")) {
   while (<F>) {
     if (/(\w+)=(.*)/) {
@@ -683,11 +699,28 @@ if ($configurebuild && !$crosscompile) {
   } else {
     logit "the tests were successful!";
   }
-} else {
-  # dummy message to feign success
+}
+else {
   if($crosscompile) {
-    logit "cross-compiling, can't run tests";
+    # build test harness programs for selected cross-compiles
+    my $host_triplet = get_host_triplet();
+    if($host_triplet =~ /([^-]+)-([^-]+)-mingw(.*)/) {
+      chdir "$pwd/$build/tests";
+      logit_spaced "build test harness";
+      open(F, "$make -i 2>&1 |") or die;
+      open(LOG, ">$buildlog") or die;
+      while (<F>) {
+        s/$pwd//g;
+        print;
+        print LOG;
+      }
+      close(F);
+      close(LOG);
+      chdir "$pwd/$build";
+    }
+    logit_spaced "cross-compiling, can't run tests";
   }
+  # dummy message to feign success
   print "TESTDONE: 1 tests out of 0 (dummy message)\n";
 }