~ubuntu-branches/ubuntu/maverick/curl/maverick

« back to all changes in this revision

Viewing changes to tests/testcurl.pl

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2009-12-11 19:33:21 UTC
  • mfrom: (3.4.2 squeeze) (40.1.2 curl)
  • Revision ID: james.westby@ubuntu.com-20091211193321-tenukopudyznzbjj
* Merge with Debian testing.  Remaining changes:
  - Keep build deps in main:
    - Drop build dependencies: stunnel, libdb4.6-dev, libssh2-1-dev
    - Add build-dependency on openssh-server
    - Drop libssh2-1-dev from libcurl4-openssl-dev's Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20
20
# KIND, either express or implied.
21
21
#
22
 
# $Id: testcurl.pl,v 1.74 2009-05-12 11:24:29 yangtse Exp $
 
22
# $Id: testcurl.pl,v 1.85 2009-07-14 15:36:12 gknauf Exp $
23
23
###########################################################################
24
24
 
25
25
###########################
69
69
            $extvercmd $nocvsup $nobuildconf $crosscompile $timestamp);
70
70
 
71
71
# version of this script
72
 
$version='$Revision: 1.74 $';
 
72
$version='$Revision: 1.85 $';
73
73
$fixed=0;
74
74
 
75
75
# Determine if we're running from CVS or a canned copy of curl,
137
137
    $binext = '.exe';
138
138
    $libext = '.lib';
139
139
  }
140
 
  elsif ($targetos =~ /mingw32/) {
 
140
  elsif ($targetos =~ /mingw/) {
141
141
    $binext = '.exe';
142
142
    if ($^O eq 'MSWin32') {
143
143
      $libext = '.a';
228
228
    exit 1;
229
229
}
230
230
 
 
231
sub get_host_triplet {
 
232
  my $triplet;
 
233
  my $configfile = "$pwd/$build/lib/curl_config.h";
 
234
 
 
235
  if(-f $configfile && -s $configfile && open(LIBCONFIGH, "<$configfile")) {
 
236
    while(<LIBCONFIGH>) {
 
237
      if($_ =~ /^\#define\s+OS\s+"*([^"][^"]*)"*\s*/) {
 
238
        $triplet = $1;
 
239
        last;
 
240
      }
 
241
    }
 
242
    close(LIBCONFIGH);
 
243
  }
 
244
  return $triplet;
 
245
}
 
246
 
231
247
if (open(F, "$setupfile")) {
232
248
  while (<F>) {
233
249
    if (/(\w+)=(.*)/) {
306
322
logit "LDFLAGS = ".$ENV{LDFLAGS};
307
323
logit "CC = ".$ENV{CC};
308
324
logit "MAKEFLAGS = ".$ENV{MAKEFLAGS};
 
325
logit "PKG_CONFIG_PATH = ".$ENV{PKG_CONFIG_PATH};
309
326
logit "target = ".$targetos;
310
327
logit "version = $version"; # script version
311
328
logit "date = $timestamp";  # When the test build starts
463
480
sub findinpath {
464
481
  my $c;
465
482
  my $e;
466
 
  my $x='';
467
 
  $x='.exe' if ($^O eq 'MSWin32');
468
 
  my $s=':';
469
 
  $s=';' if ($^O eq 'MSWin32');
 
483
  my $x = ($^O eq 'MSWin32') ? '.exe' : '';
 
484
  my $s = ($^O eq 'MSWin32') ? ';' : ':';
470
485
  my $p=$ENV{'PATH'};
471
486
  my @pa = split($s, $p);
472
487
  for $c (@_) {
482
497
if(!$make) {
483
498
    mydie "Couldn't find make in the PATH";
484
499
}
 
500
# force to 'nmake' for VC builds
 
501
$make = "nmake" if ($targetos =~ /vc/);
485
502
logit "going with $make as make";
486
503
 
487
504
# change to build dir
549
566
  mydie "no curlbuild.h created/found";
550
567
}
551
568
 
552
 
logit_spaced "display lib/config$confsuffix.h";
553
 
open(F, "lib/config$confsuffix.h") or die "lib/config$confsuffix.h: $!";
 
569
logit_spaced "display lib/curl_config$confsuffix.h";
 
570
open(F, "lib/curl_config$confsuffix.h") or die "lib/curl_config$confsuffix.h: $!";
554
571
while (<F>) {
555
572
  print if /^ *#/;
556
573
}
557
574
close(F);
558
575
 
559
 
if (grepfile("define USE_ARES", "lib/config$confsuffix.h")) {
 
576
if (grepfile("define USE_ARES", "lib/curl_config$confsuffix.h")) {
560
577
  print "\n";
561
578
  logit "setup to build ares";
562
579
 
585
602
    mydie "no ares_build.h created/found";
586
603
  }
587
604
 
588
 
  logit_spaced "display ares/config$confsuffix.h";
589
 
  if(open(F, "ares/config$confsuffix.h")) {
 
605
  logit_spaced "display ares/ares_config$confsuffix.h";
 
606
  if(open(F, "ares/ares_config$confsuffix.h")) {
590
607
      while (<F>) {
591
608
          print if /^ *#/;
592
609
      }
614
631
  if (-f "libcares$libext") {
615
632
    logit "ares is now built successfully (libcares$libext)";
616
633
  } else {
617
 
    logit "ares build failed (libares$libext)";
 
634
    mydie "ares build failed (libcares$libext)";
618
635
  }
619
636
 
620
637
  # cd back to the curl build dir
621
638
  chdir "$pwd/$build";
622
639
}
623
640
 
624
 
if ($configurebuild) {
625
 
  logit "$make -i";
626
 
  open(F, "$make -i 2>&1 |") or die;
627
 
  while (<F>) {
628
 
    s/$pwd//g;
629
 
    print;
630
 
  }
631
 
  close(F);
632
 
}
633
 
else {
634
 
  logit "$make -i $targetos";
635
 
  if ($^O eq 'MSWin32') {
636
 
    if ($targetos =~ /vc/) {
637
 
      open(F, "nmake -i $targetos|") or die;
638
 
    }
639
 
    else {
640
 
      open(F, "$make -i $targetos |") or die;
641
 
    }
642
 
  }
643
 
  else {
644
 
    open(F, "$make -i $targetos 2>&1 |") or die;
645
 
  }
646
 
  while (<F>) {
647
 
    s/$pwd//g;
648
 
    print;
649
 
  }
650
 
  close(F);
651
 
}
 
641
my $mkcmd = "$make -i" . ($targetos && !$configurebuild ? " $targetos" : "");
 
642
logit "$mkcmd";
 
643
open(F, "$mkcmd 2>&1 |") or die;
 
644
while (<F>) {
 
645
  s/$pwd//g;
 
646
  print;
 
647
}
 
648
close(F);
652
649
 
653
650
if (-f "lib/libcurl$libext") {
654
651
  logit "libcurl was created fine (libcurl$libext)";
669
666
  my $cmd = ($extvercmd ne '' ? $extvercmd.' ' : '')."./src/curl${binext} --version|";
670
667
  open(F, $cmd);
671
668
  while(<F>) {
672
 
      print;
673
 
      print LOG;
 
669
    # strip CR from output on non-win32 platforms (wine on Linux)
 
670
    s/\r// if ($^O ne 'MSWin32');
 
671
    print;
674
672
  }
675
673
  close(F);
676
674
}
702
700
  } else {
703
701
    logit "the tests were successful!";
704
702
  }
705
 
} else {
 
703
}
 
704
else {
 
705
  if($crosscompile) {
 
706
    # build test harness programs for selected cross-compiles
 
707
    my $host_triplet = get_host_triplet();
 
708
    if($host_triplet =~ /([^-]+)-([^-]+)-mingw(.*)/) {
 
709
      chdir "$pwd/$build/tests";
 
710
      logit_spaced "build test harness";
 
711
      open(F, "$make -i 2>&1 |") or die;
 
712
      open(LOG, ">$buildlog") or die;
 
713
      while (<F>) {
 
714
        s/$pwd//g;
 
715
        print;
 
716
        print LOG;
 
717
      }
 
718
      close(F);
 
719
      close(LOG);
 
720
      chdir "$pwd/$build";
 
721
    }
 
722
    logit_spaced "cross-compiling, can't run tests";
 
723
  }
706
724
  # dummy message to feign success
707
 
  if($crosscompile) {
708
 
    logit "cross-compiling, can't run tests";
709
 
  }
710
725
  print "TESTDONE: 1 tests out of 0 (dummy message)\n";
711
726
}
712
727