Add tests for "git describe --long".

[?]
Apr 30, 2012, 3:59 AM
3RL7VFKEVVQBVKLKM7ZS3M67BOGGJ3OWPARHG64AOUTZTPPYCHLQC

Dependencies

  • [2] PU7CQACN use abs_builddir for svn checkout
  • [3] OB7GB5DL Test environment cleanups
  • [4] HE3GX5IP Optimize fetch-git.
  • [5] DCHQR576 add bzr-repo target
  • [6] RBZRCTAL hydra: fixed and re-enabled evaluation tests
  • [7] OSZDLGMP add target to make simple git/hg/svn inputs
  • [8] JRVI4XTV tests: Use $(builddir) instead of `pwd`.
  • [9] VOBFCHIX use top_srcdir in stead of srcdir
  • [10] HX4QYOYA add first evaluations tests
  • [11] L4AI5YL6 Rename hydra_*.pl to hydra-*
  • [12] V2ALOFRR Fix the test
  • [13] N3KBVX6G Set $PERL5LIB properly in hydra-init in "make check"
  • [14] W6J4PVRP remove debug statement
  • [15] WFJ3ZPRM add tests for scm inputs
  • [16] FAIJDQKZ
  • [17] GAZHOBWE Better fix
  • [18] 5SMQ2PLK Fix tests
  • [19] G2ZB6464 first test, not yet in buildprocess
  • [20] EDDTVGB4 set BZR_HOME env var so bzr won't fail
  • [21] I3TU2UJQ
  • [22] ZHBEOOUQ show evaluation errors in log of tests
  • [23] SBKX3YH2 cleanup
  • [24] AMFMXR52 Provide a command ‘hydra-init’ to initialise/upgrade the database
  • [25] WHS5RMPO

Change contents

  • replacement in tests/Makefile.am at line 36
    [5.1][5.1:85]()
    repos : dirs git-repo hg-repo svn-repo svn-checkout-repo bzr-repo bzr-checkout-repo
    [5.1]
    [5.252]
    repos : dirs
  • edit in tests/Makefile.am at line 46
    [5.391][5.67:68](),[5.68][5.62:73](),[5.73][5.78:196](),[5.78][5.78:196](),[5.196][5.74:84](),[5.84][5.205:245](),[5.205][5.205:245](),[5.245][3.52:129](),[3.129][5.312:313](),[5.312][5.312:313](),[5.313][5.85:96](),[5.96][5.323:349](),[5.323][5.323:349](),[5.349][2.0:53](),[2.53][5.397:509](),[5.404][5.397:509](),[5.397][5.397:509](),[5.509][5.119:150](),[5.150][5.95:180](),[5.180][5.205:257](),[5.205][5.205:257](),[5.257][5.181:259](),[5.259][5.854:855](),[5.855][5.237:346](),[5.307][5.237:346](),[5.346][5.260:261]()
    git-repo :
    git init git-repo
    touch git-repo/git-file
    (cd git-repo; git add git-file ; git commit -m "add git file" git-file)
    hg-repo :
    hg init hg-repo
    touch hg-repo/hg-file
    (cd hg-repo; hg add hg-file ; hg commit -m "add hg file" hg-file -u foobar)
    svn-repo :
    svnadmin create svn-repo
    svn co file://$(abs_builddir)/svn-repo svn-checkout
    touch svn-checkout/svn-file
    svn add svn-checkout/svn-file
    svn commit -m "add svn file" svn-checkout/svn-file
    bzr-repo :
    bzr init bzr-repo
    BZR_HOME=$(abs_builddir)/data bzr whoami "build <build@donotemail.com>" -d bzr-repo
    touch bzr-repo/bzr-file
    bzr add bzr-repo/bzr-file
    BZR_HOME=$(abs_builddir)/data bzr commit -m "add bzr-file" bzr-repo/bzr-file
    svn-checkout-repo :
    ln -s svn-repo svn-checkout-repo
    bzr-checkout-repo :
    ln -s bzr-repo bzr-checkout-repo
  • replacement in tests/Setup.pm at line 78
    [4.4354][4.4354:4463]()
    my ($scm, $update, $repo) = @_;
    my ($res, $stdout, $stderr) = captureStdoutStderr(60, ($update, $repo));
    [4.4354]
    [4.4463]
    my ($scm, $update) = @_;
    my ($res, $stdout, $stderr) = captureStdoutStderr(60, ($update, $scm));
  • replacement in tests/Setup.pm at line 81
    [4.4529][4.4529:4620]()
    print STDOUT "Update $scm repository: $stdout" if $stdout ne "";
    return $stdout ne "";
    [4.4529]
    [5.822]
    my ($message, $loop, $status) = $stdout =~ m/::(.*) -- (.*) -- (.*)::/;
    print STDOUT "Update $scm repository: $message\n";
    return ($loop eq "continue", $status eq "updated");
  • replacement in tests/evaluation-tests.pl at line 10
    [5.969][4.4621:4651]()
    use Test::Simple tests => 48;
    [5.969]
    [5.998]
    use Test::Simple tests => 60;
  • replacement in tests/evaluation-tests.pl at line 55
    [5.1184][5.2279:2298](),[5.1680][5.2279:2298](),[5.2298][5.1655:1763](),[5.1680][5.1655:1763](),[5.1763][5.2299:2400]()
    # Test scm inputs
    my @scminputs = ("svn", "svn-checkout", "git", "bzr", "bzr-checkout", "hg");
    foreach my $scm (@scminputs) {
    $jobset = createJobsetWithOneInput($scm, "$scm-input.nix", "src", $scm, "$jobsBaseUri/$scm-repo");
    [5.1184]
    [5.252]
    # Test scm inputs
    my @scminputs = (
    {
    name => "svn",
    nixexpr => "svn-input.nix",
    type => "svn",
    uri => "$jobsBaseUri/svn-repo",
    update => getcwd . "/jobs/svn-update.sh"
    },
    {
    name => "svn-checkout",
    nixexpr => "svn-checkout-input.nix",
    type => "svn-checkout",
    uri => "$jobsBaseUri/svn-checkout-repo",
    update => getcwd . "/jobs/svn-checkout-update.sh"
    },
    {
    name => "git",
    nixexpr => "git-input.nix",
    type => "git",
    uri => "$jobsBaseUri/git-repo",
    update => getcwd . "/jobs/git-update.sh"
    },
    {
    name => "deepgit",
    nixexpr => "deepgit-input.nix",
    type => "git",
    uri => "$jobsBaseUri/git-repo master 1",
    update => getcwd . "/jobs/git-update.sh"
    },
    {
    name => "bzr",
    nixexpr => "bzr-input.nix",
    type => "bzr",
    uri => "$jobsBaseUri/bzr-repo",
    update => getcwd . "/jobs/bzr-update.sh"
    },
    {
    name => "bzr-checkout",
    nixexpr => "bzr-checkout-input.nix",
    type => "bzr-checkout",
    uri => "$jobsBaseUri/bzr-checkout-repo",
    update => getcwd . "/jobs/bzr-checkout-update.sh"
    },
    {
    name => "hg",
    nixexpr => "hg-input.nix",
    type => "hg",
    uri => "$jobsBaseUri/hg-repo",
    update => getcwd . "/jobs/hg-update.sh"
    }
    );
  • replacement in tests/evaluation-tests.pl at line 108
    [5.253][4.4652:4981]()
    my $c = 1;
    my $q = 1;
    do {
    # Verify that it can be fetched and queued.
    ok(evalSucceeds($jobset), "$c Evaluating jobs/$scm-input.nix should exit with return code 0."); $c++;
    ok(nrQueuedBuildsForJobset($jobset) == $q, "$c Evaluating jobs/$scm-input.nix should result in 1 build in queue"); $c++;
    [5.253]
    [5.0]
    foreach my $scm ( @scminputs ) {
    my $scmName = $scm->{"name"};
    my $nixexpr = $scm->{"nixexpr"};
    my $type = $scm->{"type"};
    my $uri = $scm->{"uri"};
    my $update = $scm->{"update"};
    $jobset = createJobsetWithOneInput($scmName, $nixexpr, "src", $type, $uri);
  • replacement in tests/evaluation-tests.pl at line 116
    [5.1][4.4982:5291]()
    # Verify that it is deterministic and not queued again.
    ok(evalSucceeds($jobset), "$c Evaluating jobs/$scm-input.nix should exit with return code 0."); $c++;
    ok(nrQueuedBuildsForJobset($jobset) == $q, "$c Evaluating jobs/$scm-input.nix should result in $q build in queue"); $c++;
    [5.1]
    [4.5291]
    my $state = 0;
    my $q = 0;
    my ($loop, $updated) = updateRepository($scmName, $update);
    while($loop) {
    my $c = 0;
  • replacement in tests/evaluation-tests.pl at line 122
    [4.5292][4.5292:5394]()
    $q++;
    } while(updateRepository($scm, getcwd . "/jobs/$scm-update.sh", getcwd . "/$scm-repo/"));
    [4.5292]
    [4.5394]
    # Verify that it can be fetched and possibly queued.
    ok(evalSucceeds($jobset), "$scmName:$state.$c: Evaluating nix-expression."); $c++;
    # Verify that the evaluation has queued a new job and evaluate again to ...
    if ($updated) {
    $q++;
    ok(nrQueuedBuildsForJobset($jobset) == $q, "$scmName:$state.$c: Expect $q jobs in the queue."); $c++;
    ok(evalSucceeds($jobset), "$scmName:$state.$c: Evaluating nix-expression again."); $c++;
    }
    # ... check that it is deterministic and not queued again.
    ok(nrQueuedBuildsForJobset($jobset) == $q, "$scmName:$state.$c: Expect $q jobs in the queue."); $c++;
    $state++;
    ($loop, $updated) = updateRepository($scmName, $update, getcwd . "/$scmName-repo/");
    }
  • edit in tests/jobs/bzr-checkout-update.sh at line 2
    [4.5410]
    repo="$1"
    STATE_FILE=$(pwd)/.bzr-checkout-state
    if test -e $STATE_FILE; then
    state=$(cat $STATE_FILE)
    test $state -gt 1 && state=0
    else
    state=0;
    fi
    case $state in
    (0) echo "::Create repo. -- continue -- updated::"
    ln -s bzr-repo bzr-checkout-repo
    ;;
    (*) echo "::End. -- stop -- nothing::" ;;
    esac
    echo $(($state + 1)) > $STATE_FILE
  • edit in tests/jobs/bzr-update.sh at line 2
    [4.5471]
    repo="$1"
    STATE_FILE=$(pwd)/.bzr-state
    if test -e $STATE_FILE; then
    state=$(cat $STATE_FILE)
    test $state -gt 1 && state=0
    else
    state=0;
    fi
    export BZR_HOME; # Set by the Makefile
    case $state in
    (0) echo "::Create repo. -- continue -- updated::"
    bzr init bzr-repo
    bzr whoami "build <build@donotemail.com>" -d bzr-repo
    touch bzr-repo/bzr-file
    bzr add bzr-repo/bzr-file
    bzr commit -m "add bzr-file" bzr-repo/bzr-file
    ;;
    (*) echo "::End. -- stop -- nothing::";;
    esac
    echo $(($state + 1)) > $STATE_FILE
  • file addition: deepgit-builder.sh (----------)
    [5.1729]
    #! /bin/sh
    set -e
    mkdir $out
    cp -v $src/* $out/
    git describe --long > $out/Version
  • file addition: deepgit-input.nix (----------)
    [5.1729]
    with import ./config.nix;
    { src }:
    {
    copy =
    mkDerivation {
    name = "git-input";
    builder = ./scm-builder.sh;
    inherit src;
    };
    }
  • edit in tests/jobs/git-update.sh at line 2
    [4.5523]
    [4.5523]
    # This script is used both by git & deepgit checks.
  • replacement in tests/jobs/git-update.sh at line 4
    [4.5524][4.5524:5550]()
    cd "$1"
    STATE_FILE=.state
    [4.5524]
    [4.5550]
    repo=git-repo
    STATE_FILE=$(pwd)/.git-state
  • edit in tests/jobs/git-update.sh at line 8
    [4.5608]
    [4.5608]
    test $state -gt 3 && state=0
  • replacement in tests/jobs/git-update.sh at line 14
    [4.5645][4.5645:5776]()
    (0)
    echo "Add new file."
    touch git-file-2
    git add git-file-2 >&2
    git commit -m "add git file 2" git-file-2 >&2
    [4.5645]
    [4.5776]
    (0) echo "::Create repo. -- continue -- updated::"
    git init $repo
    cd $repo
    touch foo
    git add foo
    git commit -m "Add foo"
    git tag -a -m "First Tag." tag0
    git checkout -b master HEAD
  • replacement in tests/jobs/git-update.sh at line 23
    [4.5783][4.5783:5927]()
    (1)
    echo "Rewrite commit."
    echo 1 > git-file-2
    git add git-file-2 >&2
    git commit --amend -m "add git file 2" git-file-2 >&2
    [4.5783]
    [4.5927]
    (1) echo "::Create new commit. -- continue -- updated::"
    cd $repo
    # Increase depth to make sure the tag is not fetched by default.
    echo 0 > foo
    git add foo
    git commit -m "Increase depth 0"
    echo 1 > foo
    git add foo
    git commit -m "Increase depth 1"
    echo 2 > foo
    git add foo
    git commit -m "Increase depth 2"
    echo 0 > bar
    git add bar
    git commit -m "Add bar with 0"
    ;;
    (2) echo "::Amend commit. (push -f) -- continue -- updated::"
    cd $repo
    echo 1 > bar
    git add bar
    git commit --amend -m "Add bar with 1"
  • edit in tests/jobs/git-update.sh at line 45
    [4.5934]
    [4.5934]
    (*) echo "::End. -- stop -- nothing::"
    rm -rf $repo
    ;;
  • edit in tests/jobs/hg-update.sh at line 2
    [4.6027]
    repo="$1"
    STATE_FILE=$(pwd)/.hg-state
    if test -e $STATE_FILE; then
    state=$(cat $STATE_FILE)
    test $state -gt 1 && state=0
    else
    state=0;
    fi
    case $state in
    (0) echo "::Create repo. -- continue -- updated::"
    hg init hg-repo
    touch hg-repo/hg-file
    cd hg-repo
    hg add hg-file
    hg commit -m "add hg file" hg-file -u foobar
    ;;
    (*) echo "::End. -- stop -- nothing::" ;;
    esac
    echo $(($state + 1)) > $STATE_FILE
  • edit in tests/jobs/svn-checkout-update.sh at line 2
    [4.6078]
    repo="$1"
    STATE_FILE=$(pwd)/.svn-checkout-state
    if test -e $STATE_FILE; then
    state=$(cat $STATE_FILE)
    test $state -gt 1 && state=0
    else
    state=0;
    fi
    case $state in
    (0) echo "::Create repo. -- continue -- updated::"
    ln -s svn-repo svn-checkout-repo
    ;;
    (*) echo "::End. -- stop -- nothing::" ;;
    esac
    echo $(($state + 1)) > $STATE_FILE
  • edit in tests/jobs/svn-update.sh at line 2
    [4.6139]
    repo="$1"
    STATE_FILE=$(pwd)/.svn-state
    if test -e $STATE_FILE; then
    state=$(cat $STATE_FILE)
    test $state -gt 1 && state=0
    else
    state=0;
    fi
    case $state in
    (0) echo "::Create repo. -- continue -- updated::"
    svnadmin create svn-repo
    svn co $repo svn-checkout
    touch svn-checkout/svn-file
    svn add svn-checkout/svn-file
    svn commit -m "add svn file" svn-checkout/svn-file
    ;;
    (*) echo "::End. -- stop -- nothing::";;
    esac
    echo $(($state + 1)) > $STATE_FILE