diff options
author | Pavel Raiskup <praiskup@redhat.com> | 2014-10-27 14:05:44 +0100 |
---|---|---|
committer | Pavel Raiskup <praiskup@redhat.com> | 2014-10-27 14:05:44 +0100 |
commit | 62fdcbeaa5db9c2413a61f5f9a82d36835cb70bb (patch) | |
tree | 585ffd9bfbac6945bd0475f73523a4666e051e09 /controller/bin/dtf-controller.in | |
parent | f0e3aae770431b243403d74cf4d90bd7b673f319 (diff) | |
download | postgresql-setup-tests-62fdcbeaa5db9c2413a61f5f9a82d36835cb70bb.tar.gz postgresql-setup-tests-62fdcbeaa5db9c2413a61f5f9a82d36835cb70bb.tar.xz postgresql-setup-tests-62fdcbeaa5db9c2413a61f5f9a82d36835cb70bb.zip |
controller: better connect with other utilities
* controller/bin/dtf-controller.in (subcommand): Generate
stdout and stderr files separately.
(child_task): Generate '*.err' and '*.out' logs for subcommands.
Call dtf-run-remote with --distro/--distro-version options. Call
the dtf-result-stats finally and save its output to results.html.
(main): Simple debugging info and comment adjusting.
* controller/libexec/dtf-commit-results.in: Tak three arguments
now.
* controller/libexec/dtf-result-stats.in: Better read the
'tester/run' output.
* controller/share/dtf-controller/ansible/playbooks/fedora.yml:
Run the 'run --force' instead of 'run' on remote host.
* controller/share/dtf-controller/results-stats-templates/html.tmpl
React on exit_status 2.
Diffstat (limited to 'controller/bin/dtf-controller.in')
-rw-r--r-- | controller/bin/dtf-controller.in | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/controller/bin/dtf-controller.in b/controller/bin/dtf-controller.in index e8fc5c8..cf78070 100644 --- a/controller/bin/dtf-controller.in +++ b/controller/bin/dtf-controller.in @@ -33,8 +33,17 @@ sub load_runfile sub subcommand { my $cmd = $_[0]; - my $out_file = $_[1] . ".stdout"; - my $err_file = $_[1] . ".stderr"; + my $out_file = "/dev/null"; + my $err_file = "/dev/null"; + + if (defined $_[1]) { + $out_file = $_[1]; + } + if (defined $_[2]) { + $err_file = $_[2]; + } + + print STDERR "running: " . join(' ', @$cmd) . "\n"; my $pid = fork(); if ($pid eq 0) { @@ -58,11 +67,12 @@ sub child_task my $rc = subcommand [ '@bindir@/dtf-run-remote', - '--taskdir', - $run->{taskdir}, - '--workdir', - $dir, - ], "$dir/dtf-run-remote"; + '--taskdir', $run->{taskdir}, + '--workdir', $dir, + '--distro', $run->{distro}, + '--distro-version', $run->{distro_version}, + ], "$dir/dtf-run-remote.out", + "$dir/dtf-run-remote.err"; # Note that the 'dtf-run-remote' must return EXIT_SUCCESS even if some of # its tests failed. @@ -71,19 +81,28 @@ sub child_task exit (1); } - my $resultdir = "$config->{db}/$run->{distro}/" - . "$run->{distro_version}/$run->{arch}/" - . "results_$config->{starttime}-$run->{stamp}"; + my $db = $config->{db}; + my $respath = "$run->{distro}/" + . "$run->{distro_version}/$run->{arch}/"; + my $taskdir = $respath + . "results_$config->{starttime}-$run->{stamp}"; $rc = subcommand [ '@libexecdir@/dtf-commit-results', "$dir", - "$config->{db}/$run->{distro}/$run->{distro_version}/$run->{arch}/", - ], "$resultdir"; + "$taskdir", + "$db" + ]; if ($rc ne 0) { print STDERR "$task: failed dtf-commit-results"; exit (1); } + + subcommand [ + '@libexecdir@/dtf-result-stats', + "$db/$respath", + ], "$db/$respath/results.xml", "$db/$respath/dtf-result-stats.stderr" + and exit(1); } sub main @@ -98,13 +117,15 @@ sub main # dies on error - which is OK my $dir = File::Temp->newdir("/tmp/dtf-controller-XXXXXX", CLEANUP => 0); + print "results into $dir\n"; + ($run->{stamp} = $dir) =~ s/.*-//; my $pid = fork(); if ($pid == 0) { child_task($run, $dir, $config); - ## child ## + ## child's successful run ## exit (0); } else { @@ -123,7 +144,7 @@ sub main $child = waitpid (-1, 0); } while ($child > 0); - print "Finished.."; + print "Finished..\n"; } GetOptions( |