summaryrefslogtreecommitdiffstats
path: root/controller
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2014-10-24 10:02:41 +0200
committerPavel Raiskup <praiskup@redhat.com>2014-10-24 10:02:41 +0200
commitfbe706dccdd35bfdfd163b7107ea90f801830321 (patch)
treef87730d347a5029ca998cd8d2447a8fdc2c927be /controller
parenta2f777c19494999c5bec3ee50b63a627155d5d9b (diff)
downloadpostgresql-setup-tests-fbe706dccdd35bfdfd163b7107ea90f801830321.tar.gz
postgresql-setup-tests-fbe706dccdd35bfdfd163b7107ea90f801830321.tar.xz
postgresql-setup-tests-fbe706dccdd35bfdfd163b7107ea90f801830321.zip
controller: autoconfiscate #2
Move 'results_stats' and 'commit_results' binaries into libexec and adjust appropriately. Also html template is now in $pkgdatadir. * .gitignore: Add tags/ChangeLog generated files. * README: Just some random notes. Needs to be rewritten anyway. * controller/.gitignore: Add newly 'make'd files. * controller/Makefile.am: Generate libexec/bin files. * controller/commit_results: Move to controller/libexec as dtf-result-stats.in. * controller/configure.ac: Also substitute resulttemplatedir. * controller/etc/dtf.conf.d/config.sh.template: The DTF_DATABASE was misleading - use rather DTF_DATABASE_DEFAULT. * controller/libexec/dtf-commit-results.in: Moved from controller/commit_results. * controller/result_stats: Moved to controller/libexec/dtf-result-stats.in. * controller/libexec/dtf-result-stats.in: Moved from controller/result_stats. * controller/result_templates/html.tmpl: Moved to controller/share/dtf-controller/results-stats-templates/html.tmpl.
Diffstat (limited to 'controller')
-rw-r--r--controller/.gitignore2
-rw-r--r--controller/Makefile.am17
-rwxr-xr-xcontroller/commit_results24
-rw-r--r--controller/configure.ac1
-rw-r--r--controller/etc/dtf.conf.d/config.sh.template2
-rw-r--r--controller/libexec/dtf-commit-results.in19
-rw-r--r--[-rwxr-xr-x]controller/libexec/dtf-result-stats.in (renamed from controller/result_stats)9
-rw-r--r--controller/share/dtf-controller/results-stats-templates/html.tmpl (renamed from controller/result_templates/html.tmpl)0
8 files changed, 45 insertions, 29 deletions
diff --git a/controller/.gitignore b/controller/.gitignore
index 0ce42e7..ccbdbd2 100644
--- a/controller/.gitignore
+++ b/controller/.gitignore
@@ -2,7 +2,9 @@
build-aux
config.*
dtf.sh
+dtf-commit-results
dtf-get-machine
+dtf-result-stats
dtf-run-remote
generated-vars.yml
Makefile
diff --git a/controller/Makefile.am b/controller/Makefile.am
index 4df5e25..9fecd61 100644
--- a/controller/Makefile.am
+++ b/controller/Makefile.am
@@ -4,7 +4,9 @@ sysconf_DATA = etc/dtf.sh
pkgdata_DATA = ./share/dtf-controller/parse_credsfile
-libexec_SCRIPTS = libexec/dtf-wait-for-ssh
+libexec_SCRIPTS = libexec/dtf-wait-for-ssh \
+ libexec/dtf-commit-results \
+ libexec/dtf-result-stats
ansiblevarsdir = $(pkgdatadir)/ansible/vars
ansibleplaybooksdir = $(pkgdatadir)/ansible/playbooks
@@ -14,6 +16,9 @@ ansiblevars_DATA = share/dtf-controller/ansible/vars/generated-vars.yml
dtfplaybookdir = $(pkgdatadir)/ansible/playbooks
ansibleplaybooks_DATA = share/dtf-controller/ansible/playbooks/fedora.yml
+resulttemplatedir = $(pkgdatadir)/results-stats-templates
+resulttemplate_DATA = share/dtf-controller/results-stats-templates/html.tmpl
+
share/dtf-controller/ansible/vars/generated-vars.yml: \
share/dtf-controller/ansible/vars/generated-vars.yml.in .dep
$(INSTANTIATE)
@@ -21,6 +26,12 @@ share/dtf-controller/ansible/vars/generated-vars.yml: \
.dep: $(c_s)
touch .dep
+libexec/dtf-commit-results: libexec/dtf-commit-results.in .dep
+ $(INSTANTIATE_SCRIPT)
+
+libexec/dtf-result-stats: libexec/dtf-result-stats.in .dep
+ $(INSTANTIATE_SCRIPT)
+
bin/dtf-run-remote: bin/dtf-run-remote.in .dep
$(INSTANTIATE_SCRIPT)
@@ -32,6 +43,8 @@ etc/dtf.sh: etc/dtf.sh.in .dep
GENERATED_FILES = $(bin_SCRIPTS) \
$(sysconf_DATA) \
- share/dtf-controller/ansible/vars/generated-vars.yml
+ share/dtf-controller/ansible/vars/generated-vars.yml \
+ libexec/dtf-commit-results \
+ libexec/dtf-result-stats
CLEANFILES = $(GENERATED_FILES)
diff --git a/controller/commit_results b/controller/commit_results
deleted file mode 100755
index f18a361..0000000
--- a/controller/commit_results
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-
-srcdir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) || exit 1
-. "$srcdir/config/config.sh" || {
- echo >&2 "sorry, but $srcdir/config/config.sh not found"
- exit 1
-}
-
-# argparse
-resultdir="$1"
-ressubdir="$2"
-test -n "$ressubdir" || { "no path specified" ; exit 1 ; }
-test -n "$3" && DTF_DATABASE="$2"
-
-# checks
-test -z "$DTF_DATABASE" && exit 1
-test -f "$resultdir/dtf.tar.gz" || exit 1
-
-# run
-if test ! -d "$DTF_DATABASE/$ressubdir"; then
- mkdir -p "$DTF_DATABASE/$ressubdir"
-fi
-
-( cd "$resultdir" && tar -xf dtf.tar.gz && cp -r dtf "$DTF_DATABASE/$ressubdir" )
diff --git a/controller/configure.ac b/controller/configure.ac
index 819680a..0c85544 100644
--- a/controller/configure.ac
+++ b/controller/configure.ac
@@ -18,6 +18,7 @@ sed_subst_var_pattern(libexecdir)
sed_subst_var_pattern(pkgdatadir)
sed_subst_var_pattern(pkgname)
sed_subst_var_pattern(prefix)
+sed_subst_var_pattern(resulttemplatedir)
sed_subst_var_pattern(sysconfdir)
sed_subst_var_pattern(top_srcdir)
-e 's|@__FILE__[[@]]|\$@|g'"
diff --git a/controller/etc/dtf.conf.d/config.sh.template b/controller/etc/dtf.conf.d/config.sh.template
index 11aa40b..aae9f08 100644
--- a/controller/etc/dtf.conf.d/config.sh.template
+++ b/controller/etc/dtf.conf.d/config.sh.template
@@ -24,7 +24,7 @@ export DTF_OPENSTACK_DEFAULT_ID=dropbear
# Directory where the testsuite should keep its (persistent) results. Make sure
# that this directory is backed up.
-export DTF_DATABASE=/var/lib/dtf_results
+export DTF_DATABASE_DEFAULT=/var/lib/dtf_results
# Presenter place
# ---------------
diff --git a/controller/libexec/dtf-commit-results.in b/controller/libexec/dtf-commit-results.in
new file mode 100644
index 0000000..86b31d7
--- /dev/null
+++ b/controller/libexec/dtf-commit-results.in
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+. "@sysconfdir@/dtf.sh" || exit 1
+
+# argparse
+resultdir="$1"
+
+db="$DTF_DATABASE_DEFAULT"
+test -n "$2" && db="$2"
+
+if test -z "$db" \
+ || test -z "$resultdir" \
+ || test ! -f "$resultdir/dtf.tar.gz"
+then
+ echo >&2 "something is wrong, try bash -x"
+ exit 1
+fi
+
+( cd "$resultdir" && tar -xf dtf.tar.gz && cp -r dtf "$db/$ressubdir" )
diff --git a/controller/result_stats b/controller/libexec/dtf-result-stats.in
index a92d6d6..d4db46f 100755..100644
--- a/controller/result_stats
+++ b/controller/libexec/dtf-result-stats.in
@@ -22,7 +22,7 @@ sub html_printer
my $results = $_[0];
my $task_ids = $_[1];
- my $xslate = Text::Xslate->new(path => ["$srcdir/result_templates"]);
+ my $xslate = Text::Xslate->new(path => ['@resulttemplatedir@']);
my $content = $xslate->render("html.tmpl", {
results => $results,
@@ -31,6 +31,11 @@ sub html_printer
print encode_utf8($content);
}
+if (! defined $ARGV[0] || ! -d $ARGV[0]) {
+ print STDERR "Please specify correct working directory\n";
+ exit (1);
+}
+
my $workdir = $ARGV[0];
my $data = [];
@@ -39,7 +44,7 @@ my $task_ids = {};
# go through *each* result directory
my $olddir = getcwd;
-for (`find "$workdir" -maxdepth 1 -type d -name 'result_*'`) {
+for (`find "$workdir" -maxdepth 1 -type d`) {
chomp;
chdir $_;
diff --git a/controller/result_templates/html.tmpl b/controller/share/dtf-controller/results-stats-templates/html.tmpl
index 8a09ad7..8a09ad7 100644
--- a/controller/result_templates/html.tmpl
+++ b/controller/share/dtf-controller/results-stats-templates/html.tmpl