add tests for scm inputs

[?]
Mar 17, 2011, 8:48 AM
WFJ3ZPRMZ52NFPPGRJTVNLYLFFN2DYP3JHNTPVRQAEULEF7VCGGAC

Dependencies

  • [2] W6J4PVRP remove debug statement
  • [3] JRVI4XTV tests: Use $(builddir) instead of `pwd`.
  • [4] DCHQR576 add bzr-repo target
  • [5] PVBTVPKJ nix needs env vars as absolute paths
  • [6] G2ZB6464 first test, not yet in buildprocess
  • [7] VOBFCHIX use top_srcdir in stead of srcdir
  • [8] OSZDLGMP add target to make simple git/hg/svn inputs
  • [9] I3TU2UJQ
  • [10] HX4QYOYA add first evaluations tests
  • [11] 7RO7CINM setup environment variables for tests
  • [12] WHS5RMPO

Change contents

  • edit in tests/Makefile.am at line 10
    [3.354]
    [5.291]
    PATH=$(abs_top_srcdir)/src/script:$$PATH \
  • replacement in tests/Makefile.am at line 24
    [5.455][4.0:75]()
    rm -rf db.sqlite data nix git-repo hg-repo svn-repo svn-checkout bzr-repo
    [5.455]
    [5.125]
    rm -rf db.sqlite data nix git-repo hg-repo svn-repo svn-checkout svn-checkout-repo bzr-repo bzr-checkout-repo
  • replacement in tests/Makefile.am at line 31
    [5.253][4.76:118]()
    dirs : git-repo hg-repo svn-repo bzr-repo
    [5.253]
    [5.157]
    dirs : git-repo hg-repo svn-repo svn-checkout-repo bzr-repo bzr-checkout-repo
  • edit in tests/Makefile.am at line 62
    [4.307]
    svn-checkout-repo :
    ln -s svn-repo svn-checkout-repo
    bzr-checkout-repo :
    ln -s bzr-repo bzr-checkout-repo
  • replacement in tests/evaluation-tests.pl.in at line 13
    [5.969][5.969:998]()
    use Test::Simple tests => 1;
    [5.969]
    [5.998]
    use Test::Simple tests => 14;
  • edit in tests/evaluation-tests.pl.in at line 21
    [5.1052]
    [5.1052]
    my $jobsBaseUri = "file://".getcwd;
  • replacement in tests/evaluation-tests.pl.in at line 23
    [5.1157][5.1157:1374]()
    my $jobset = $project->jobsets->create({name => "basic", nixexprinput => "input", nixexprpath => "basic.nix", emailoverride => ""});
    my $jobsetinput = $jobset->jobsetinputs->create({name => "input", type => "path"});
    [5.1157]
    [5.1374]
    sub nrBuildsForJobset {
    my ($project, $jobset) = @_;
    return $db->resultset('Builds')->search({ project => $project, jobset => $jobset},{})->count ;
    }
    sub createJobsetWithOneSCMInput {
    my ($jobsetName, $nixexprpath, $type, $uri) = @_;
    my $jobset = $project->jobsets->create({name => $jobsetName, nixexprinput => "jobs", nixexprpath => $nixexprpath, emailoverride => ""});
    my $jobsetinput;
    my $jobsetinputals;
    $jobsetinput = $jobset->jobsetinputs->create({name => "jobs", type => "path"});
    $jobsetinputals = $jobsetinput->jobsetinputalts->create({altnr => 0, value => getcwd."/jobs"});
    $jobsetinput = $jobset->jobsetinputs->create({name => "src", type => $type});
    $jobsetinputals = $jobsetinput->jobsetinputalts->create({altnr => 0, value => $uri});
    }
    sub evalSucceeds {
    my ($project, $jobset) = @_;
    return captureStdoutStderr(60, ("../src/script/hydra_evaluator.pl", $project, $jobset));
    }
    my $jobset = $project->jobsets->create({name => "basic", nixexprinput => "jobs", nixexprpath => "basic.nix", emailoverride => ""});
    my $jobsetinput = $jobset->jobsetinputs->create({name => "jobs", type => "path"});
  • edit in tests/evaluation-tests.pl.in at line 55
    [5.1653]
    [5.1653]
    ok( nrBuildsForJobset("tests", "basic") == 3 , "Evaluating jobs/basic.nix should result in 3 builds");
  • edit in tests/evaluation-tests.pl.in at line 58
    [5.1680]
    [2.0]
    my @scminputs = ("svn", "svn-checkout", "git", "bzr", "bzr-checkout", "hg");
    foreach my $scm (@scminputs) {
    createJobsetWithOneSCMInput($scm, "$scm-input.nix", $scm, "$jobsBaseUri/$scm-repo");
    ok(evalSucceeds("tests", $scm), "Evaluating jobs/$scm-input.nix should exit with return code 0.");
    ok(nrBuildsForJobset("tests", $scm) == 1, "Evaluating jobs/$scm-input.nix should result in 1 build")
    }
  • edit in tests/jobs/basic.nix at line 1
    [5.1747][5.1748:1759]()
    { input }:
  • file addition: bzr-checkout-input.nix (----------)
    [5.1729]
    { src }:
    {
    copy =
    derivation {
    name = "bzr-checkout-input";
    system = builtins.currentSystem;
    builder = ./scm-builder.sh;
    };
    }
  • file addition: bzr-input.nix (----------)
    [5.1729]
    { src }:
    {
    copy =
    derivation {
    name = "bzr-input";
    system = builtins.currentSystem;
    builder = ./scm-builder.sh;
    };
    }
  • file addition: git-input.nix (----------)
    [5.1729]
    { src }:
    {
    copy =
    derivation {
    name = "git-input";
    system = builtins.currentSystem;
    builder = ./scm-builder.sh;
    };
    }
  • file addition: hg-input.nix (----------)
    [5.1729]
    { src }:
    {
    copy =
    derivation {
    name = "hg-input";
    system = builtins.currentSystem;
    builder = ./scm-builder.sh;
    };
    }
  • file addition: scm-builder.sh (----------)
    [5.1729]
    mkdir $out
    cp -v $src/* $out/
  • file addition: svn-checkout-input.nix (----------)
    [5.1729]
    { src }:
    {
    copy =
    derivation {
    name = "bzr-checkout-input";
    system = builtins.currentSystem;
    builder = ./scm-builder.sh;
    };
    }
  • file addition: svn-input.nix (----------)
    [5.1729]
    { src }:
    {
    copy =
    derivation {
    name = "svn-input";
    system = builtins.currentSystem;
    builder = ./scm-builder.sh;
    };
    }