~ubuntu-branches/ubuntu/natty/curl/natty-security

« back to all changes in this revision

Viewing changes to tests/testcurl.pl

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2010-06-20 13:56:28 UTC
  • mfrom: (3.4.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100620135628-e30tp9jldq6hq985
Tags: 7.21.0-1ubuntu1
* Merge from debian unstable.  Remaining changes: LP: #596334
  - Keep build deps in main:
    - Drop build dependencies: stunnel, 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:
6
6
#                            | (__| |_| |  _ <| |___
7
7
#                             \___|\___/|_| \_\_____|
8
8
#
9
 
# Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
 
9
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
10
10
#
11
11
# This software is licensed as described in the file COPYING, which
12
12
# you should have received as part of this distribution. The terms
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.85 2009-07-14 15:36:12 gknauf Exp $
23
22
###########################################################################
24
23
 
25
24
###########################
26
25
#  What is This Script?
27
26
###########################
28
27
 
29
 
# testcurl.pl is the master script to use for automatic testing of CVS-curl.
 
28
# testcurl.pl is the master script to use for automatic testing of curl
 
29
# directly off its source repository.
30
30
# This is written for the purpose of being run from a crontab job or similar
31
31
# at a regular interval. The output is suitable to be mailed to
32
32
# curl-autocompile@haxx.se to be dealt with automatically (make sure the
46
46
# --extvercmd=[command]    Command to use for displaying version with cross compiles.
47
47
# --mktarball=[command]    Command to run after completed test
48
48
# --name=[name]            Set name to report as
49
 
# --nocvsup                Don't update from CVS even though it is a CVS tree
 
49
# --nocvsup                Don't pull from git even though it is a git tree
 
50
# --nogitpull              Don't pull from git even though it is a git tree
50
51
# --nobuildconf            Don't run buildconf
51
52
# --runtestopts=[options]  Options to pass to runtests.pl
52
53
# --setup=[file name]      File name to read setup from (deprecated)
53
54
# --target=[your os]       Specify your target environment.
54
55
#
55
 
# if [curl-daily-name] is omitted, a 'curl' CVS directory is assumed.
 
56
# if [curl-daily-name] is omitted, a 'curl' git directory is assumed.
56
57
#
57
58
 
58
59
use strict;
62
63
# Turn on warnings (equivalent to -w, which can't be used with /usr/bin/env)
63
64
#BEGIN { $^W = 1; }
64
65
 
65
 
use vars qw($version $fixed $infixed $CURLDIR $CVS $pwd $build $buildlog
 
66
use vars qw($version $fixed $infixed $CURLDIR $git $pwd $build $buildlog
66
67
            $buildlogname $configurebuild $targetos $confsuffix $binext
67
68
            $libext);
 
69
 
68
70
use vars qw($name $email $desc $confopts $runtestopts $setupfile $mktarball
69
 
            $extvercmd $nocvsup $nobuildconf $crosscompile $timestamp);
 
71
            $extvercmd $nogitpull $nobuildconf $crosscompile
 
72
            $timestamp);
70
73
 
71
74
# version of this script
72
 
$version='$Revision: 1.85 $';
 
75
$version='2010-04-13';
73
76
$fixed=0;
74
77
 
75
 
# Determine if we're running from CVS or a canned copy of curl,
 
78
# Determine if we're running from git or a canned copy of curl,
76
79
# or if we got a specific target option or setup file option.
77
80
$CURLDIR="curl";
78
 
$CVS=1;
 
81
if (-f ".git/config") {
 
82
  $CURLDIR = "./";
 
83
}
 
84
 
 
85
$git=1;
79
86
$setupfile = 'setup';
80
87
while ($ARGV[0]) {
81
88
  if ($ARGV[0] =~ /--target=/) {
102
109
  elsif ($ARGV[0] =~ /--configure=/) {
103
110
    $confopts = (split(/=/, shift @ARGV))[1];
104
111
  }
105
 
  elsif ($ARGV[0] =~ /--nocvsup/) {
106
 
    $nocvsup=1;
 
112
  elsif (($ARGV[0] eq "--nocvsup") || ($ARGV[0] eq "--nogitpull")) {
 
113
    $nogitpull=1;
107
114
    shift @ARGV;
108
115
  }
109
116
  elsif ($ARGV[0] =~ /--nobuildconf/) {
119
126
  }
120
127
  else {
121
128
    $CURLDIR=shift @ARGV;
122
 
    $CVS=0;
 
129
    $git=0; # a given dir, assume not using git
123
130
  }
124
131
}
125
132
 
334
341
$pwd = getcwd();
335
342
 
336
343
if (-d $CURLDIR) {
337
 
  if ($CVS && -d "$CURLDIR/CVS") {
338
 
    logit "$CURLDIR is verified to be a fine source dir";
 
344
  if ($git && -d "$CURLDIR/.git") {
 
345
    logit "$CURLDIR is verified to be a fine git source dir";
339
346
    # remove the generated sources to force them to be re-generated each
340
347
    # time we run this test
341
348
    unlink "$CURLDIR/src/hugehelp.c";
342
 
  } elsif (!$CVS && -f "$CURLDIR/tests/testcurl.pl") {
 
349
  } elsif (!$git && -f "$CURLDIR/tests/testcurl.pl") {
343
350
    logit "$CURLDIR is verified to be a fine daily source dir"
344
351
  } else {
345
 
    mydie "$CURLDIR is not a daily source dir or checked out from CVS!"
 
352
    mydie "$CURLDIR is not a daily source dir or checked out from git!"
346
353
  }
347
354
}
348
355
$build="build-$$";
368
375
# get in the curl source tree root
369
376
chdir $CURLDIR;
370
377
 
371
 
# Do the CVS thing, or not...
372
 
if ($CVS) {
373
 
 
374
 
  # this is a temporary fix to make things work again, remove later
375
 
  logit "remove ares/aclocal.m4";
376
 
  unlink "ares/aclocal.m4";
377
 
 
378
 
  logit "update from CVS";
379
 
  my $cvsstat;
380
 
 
381
 
  sub cvsup() {
382
 
    # update quietly to the latest CVS
383
 
    if($nocvsup) {
384
 
        logit "Skipping CVS update (--nocvsup)";
385
 
        return 1;
386
 
    }
387
 
    else {
388
 
        logit "run cvs up";
389
 
        system("cvs -Q up -dP 2>&1");
390
 
    }
391
 
 
392
 
    $cvsstat=$?;
393
 
 
394
 
    # return !RETURNVALUE so that errors return 0 while goodness
395
 
    # returns 1
396
 
    return !$cvsstat;
397
 
  }
398
 
 
399
 
  my $att=0;
400
 
  while (!cvsup()) {
401
 
    $att++;
402
 
    logit "failed CVS update attempt number $att.";
403
 
    if ($att > 20) {
404
 
      $cvsstat=111;
405
 
      last; # get out of the loop
406
 
    }
407
 
    sleep 5;
408
 
  }
409
 
 
410
 
  if ($cvsstat != 0) {
411
 
    mydie "failed to update from CVS ($cvsstat), exiting";
412
 
  }
413
 
  elsif (!$nocvsup) {
414
 
    # Set timestamp to the UTC the CVS update took place.
415
 
    $timestamp = scalar(gmtime)." UTC";
 
378
# Do the git thing, or not...
 
379
if ($git) {
 
380
  # update quietly to the latest git
 
381
  if($nogitpull) {
 
382
    logit "skipping git pull (--nogitpull)";
 
383
  } else {
 
384
    my $gitstat = 0;
 
385
    my @commits;
 
386
    logit "run git pull in curl";
 
387
    system("git pull 2>&1");
 
388
    $gitstat += $?;
 
389
    logit "failed to update from curl git ($?), continue anyway" if ($?);
 
390
    # get the last 5 commits for show (even if no pull was made)
 
391
    @commits=`git log --pretty=oneline --abbrev-commit -5`;
 
392
    logit "The most recent curl git commits:";
 
393
    for (@commits) {
 
394
      chomp ($_);
 
395
      logit "  $_";
 
396
    }
 
397
    if (-d "ares/.git") {
 
398
      chdir "ares";
 
399
      logit "run git pull in ares";
 
400
      system("git pull 2>&1");
 
401
      $gitstat += $?;
 
402
      logit "failed to update from ares git ($?), continue anyway" if ($?);
 
403
      # get the last 5 commits for show (even if no pull was made)
 
404
      @commits=`git log --pretty=oneline --abbrev-commit -5`;
 
405
      logit "The most recent ares git commits:";
 
406
      for (@commits) {
 
407
        chomp ($_);
 
408
        logit "  $_";
 
409
      }
 
410
      chdir "$pwd/$CURLDIR";
 
411
    }
 
412
    # Set timestamp to the UTC the git update took place.
 
413
    $timestamp = scalar(gmtime)." UTC" if (!$gitstat);
416
414
  }
417
415
 
418
416
  if($nobuildconf) {
419
 
      logit "told to not run buildconf";
 
417
    logit "told to not run buildconf";
420
418
  }
421
419
  elsif ($configurebuild) {
422
420
    # remove possible left-overs from the past
447
445
  }
448
446
}
449
447
 
450
 
# Set timestamp to the one in curlver.h if this isn't a CVS test build.
 
448
# Set timestamp to the one in curlver.h if this isn't a git test build.
451
449
if ((-f "include/curl/curlver.h") &&
452
450
    (open(F, "<include/curl/curlver.h"))) {
453
451
  while (<F>) {
454
452
    chomp;
455
453
    if ($_ =~ /^\#define\s+LIBCURL_TIMESTAMP\s+\"(.+)\".*$/) {
456
454
      my $stampstring = $1;
457
 
      if ($stampstring !~ /CVS/) {
 
455
      if ($stampstring !~ /DEV/) {
458
456
          $stampstring =~ s/\s+UTC//;
459
457
          $timestamp = $stampstring." UTC";
460
458
      }