add tests for scm inputs
[?]
Mar 17, 2011, 8:48 AM
WFJ3ZPRMZ52NFPPGRJTVNLYLFFN2DYP3JHNTPVRQAEULEF7VCGGACDependencies
- [2]
W6J4PVRPremove debug statement - [3]
JRVI4XTVtests: Use $(builddir) instead of `pwd`. - [4]
DCHQR576add bzr-repo target - [5]
PVBTVPKJnix needs env vars as absolute paths - [6]
G2ZB6464first test, not yet in buildprocess - [7]
VOBFCHIXuse top_srcdir in stead of srcdir - [8]
OSZDLGMPadd target to make simple git/hg/svn inputs - [9]
I3TU2UJQ - [10]
HX4QYOYAadd first evaluations tests - [11]
7RO7CINMsetup environment variables for tests - [12]
WHS5RMPO
Change contents
- edit in tests/Makefile.am at line 10
PATH=$(abs_top_srcdir)/src/script:$$PATH \ - replacement in tests/Makefile.am at line 24
rm -rf db.sqlite data nix git-repo hg-repo svn-repo svn-checkout bzr-reporm -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
dirs : git-repo hg-repo svn-repo bzr-repodirs : 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-repobzr-checkout-repo :ln -s bzr-repo bzr-checkout-repo - replacement in tests/evaluation-tests.pl.in at line 13
use Test::Simple tests => 1;use Test::Simple tests => 14; - edit in tests/evaluation-tests.pl.in at line 21
my $jobsBaseUri = "file://".getcwd; - replacement in tests/evaluation-tests.pl.in at line 23
my $jobset = $project->jobsets->create({name => "basic", nixexprinput => "input", nixexprpath => "basic.nix", emailoverride => ""});my $jobsetinput = $jobset->jobsetinputs->create({name => "input", type => "path"});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
ok( nrBuildsForJobset("tests", "basic") == 3 , "Evaluating jobs/basic.nix should result in 3 builds"); - edit in tests/evaluation-tests.pl.in at line 58
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
{ 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 $outcp -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;};}