6
6
# | (__| |_| | _ <| |___
7
7
# \___|\___/|_| \_\_____|
9
# Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
9
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
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.
22
# $Id: testcurl.pl,v 1.85 2009-07-14 15:36:12 gknauf Exp $
23
22
###########################################################################
25
24
###########################
26
25
# What is This Script?
27
26
###########################
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.
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.
62
63
# Turn on warnings (equivalent to -w, which can't be used with /usr/bin/env)
63
64
#BEGIN { $^W = 1; }
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
68
70
use vars qw($name $email $desc $confopts $runtestopts $setupfile $mktarball
69
$extvercmd $nocvsup $nobuildconf $crosscompile $timestamp);
71
$extvercmd $nogitpull $nobuildconf $crosscompile
71
74
# version of this script
72
$version='$Revision: 1.85 $';
75
$version='2010-04-13';
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.
81
if (-f ".git/config") {
79
86
$setupfile = 'setup';
81
88
if ($ARGV[0] =~ /--target=/) {
102
109
elsif ($ARGV[0] =~ /--configure=/) {
103
110
$confopts = (split(/=/, shift @ARGV))[1];
105
elsif ($ARGV[0] =~ /--nocvsup/) {
112
elsif (($ARGV[0] eq "--nocvsup") || ($ARGV[0] eq "--nogitpull")) {
109
116
elsif ($ARGV[0] =~ /--nobuildconf/) {
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"
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!"
348
355
$build="build-$$";
368
375
# get in the curl source tree root
371
# Do the CVS thing, or not...
374
# this is a temporary fix to make things work again, remove later
375
logit "remove ares/aclocal.m4";
376
unlink "ares/aclocal.m4";
378
logit "update from CVS";
382
# update quietly to the latest CVS
384
logit "Skipping CVS update (--nocvsup)";
389
system("cvs -Q up -dP 2>&1");
394
# return !RETURNVALUE so that errors return 0 while goodness
402
logit "failed CVS update attempt number $att.";
405
last; # get out of the loop
411
mydie "failed to update from CVS ($cvsstat), exiting";
414
# Set timestamp to the UTC the CVS update took place.
415
$timestamp = scalar(gmtime)." UTC";
378
# Do the git thing, or not...
380
# update quietly to the latest git
382
logit "skipping git pull (--nogitpull)";
386
logit "run git pull in curl";
387
system("git pull 2>&1");
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:";
397
if (-d "ares/.git") {
399
logit "run git pull in ares";
400
system("git pull 2>&1");
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:";
410
chdir "$pwd/$CURLDIR";
412
# Set timestamp to the UTC the git update took place.
413
$timestamp = scalar(gmtime)." UTC" if (!$gitstat);
418
416
if($nobuildconf) {
419
logit "told to not run buildconf";
417
logit "told to not run buildconf";
421
419
elsif ($configurebuild) {
422
420
# remove possible left-overs from the past
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"))) {
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";