summaryrefslogtreecommitdiff
path: root/tests/testcurl.pl
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-06-11 01:22:35 +0000
committerYang Tse <yangsita@gmail.com>2009-06-11 01:22:35 +0000
commit7edcc22136f380bc8050708d0a39d423e232cdfb (patch)
treeb8fc63be2f4c480a329853f7330ccf95f3739c3a /tests/testcurl.pl
parent352177090f710fd155d22a79d11f621482c09640 (diff)
downloadcurl-7edcc22136f380bc8050708d0a39d423e232cdfb.tar.gz
changed testcurl script to allow building test harness
programs when cross-compiling for a *-*-mingw* host.
Diffstat (limited to 'tests/testcurl.pl')
-rwxr-xr-xtests/testcurl.pl39
1 files changed, 36 insertions, 3 deletions
diff --git a/tests/testcurl.pl b/tests/testcurl.pl
index 4b5319523..530f06017 100755
--- a/tests/testcurl.pl
+++ b/tests/testcurl.pl
@@ -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";
}