diff options
-rw-r--r-- | controller/ansible/dummy-wrapper.yml (renamed from ansible/dummy-wrapper.yml) | 0 | ||||
-rw-r--r-- | controller/ansible/fedora.yml (renamed from ansible/fedora.yml) | 10 | ||||
-rw-r--r-- | controller/ansible/include/additional-packages.yml (renamed from ansible/include/additional-packages.yml) | 0 | ||||
-rw-r--r-- | controller/ansible/include/beakerlib.yml (renamed from ansible/include/beakerlib.yml) | 0 | ||||
-rw-r--r-- | controller/ansible/include/download-results.yml (renamed from ansible/include/download-results.yml) | 2 | ||||
-rw-r--r-- | controller/ansible/include/prepare-testenv.yml (renamed from ansible/include/prepare-testenv.yml) | 0 | ||||
-rwxr-xr-x | controller/ansible/run_include (renamed from ansible/run_include) | 2 | ||||
-rwxr-xr-x | controller/ansible_helpers/wait-for-ssh (renamed from ansible_helpers/wait-for-ssh) | 0 | ||||
-rw-r--r-- | controller/config/.gitignore (renamed from config/.gitignore) | 0 | ||||
-rw-r--r-- | controller/config/config.sh.template (renamed from config/config.sh.template) | 0 | ||||
-rw-r--r-- | controller/config/hosts.template (renamed from config/hosts.template) | 0 | ||||
-rw-r--r-- | controller/config/os/EXAMPLE.sh (renamed from config/os/EXAMPLE.sh) | 0 | ||||
-rwxr-xr-x | controller/controller (renamed from controller) | 5 | ||||
-rwxr-xr-x | controller/get_machine (renamed from get_machine) | 0 | ||||
-rw-r--r-- | controller/parse_credsfile (renamed from parse_credsfile) | 0 | ||||
-rw-r--r-- | controller/private/os/EXAMPLE.yml (renamed from private/os/EXAMPLE.yml) | 0 | ||||
-rwxr-xr-x | controller/result_stats (renamed from runner/result_stats) | 0 | ||||
-rw-r--r-- | controller/result_templates/html.tmpl (renamed from runner/result_templates/html.tmpl) | 0 | ||||
-rwxr-xr-x | controller/run_remote (renamed from run_remote) | 30 | ||||
-rwxr-xr-x | dist | 15 | ||||
-rw-r--r-- | dist.include | 5 | ||||
-rw-r--r-- | postgresql-tests/config.sh | 10 | ||||
-rw-r--r-- | postgresql-tests/dist.include | 6 | ||||
-rw-r--r-- | postgresql-tests/gen-data/databases/pagila.sh (renamed from gen-data/databases/pagila.sh) | 0 | ||||
-rwxr-xr-x | postgresql-tests/gen-data/dist/dist (renamed from gen-data/dist/dist) | 0 | ||||
-rw-r--r-- | postgresql-tests/gen-data/dist/dist.exclude (renamed from gen-data/dist/dist.exclude) | 0 | ||||
-rw-r--r-- | postgresql-tests/gen-data/dist/dist.list (renamed from gen-data/dist/dist.list) | 0 | ||||
-rwxr-xr-x | postgresql-tests/gen-data/generate (renamed from gen-data/generate) | 0 | ||||
-rwxr-xr-x | postgresql-tests/gen-data/prep (renamed from gen-data/prep) | 0 | ||||
-rwxr-xr-x | postgresql-tests/gen-data/remote_generate (renamed from gen-data/remote_generate) | 4 | ||||
-rw-r--r-- | postgresql-tests/gen-data/tasks/basic/run.sh (renamed from gen-data/tasks/basic/run.sh) | 0 | ||||
-rw-r--r-- | postgresql-tests/gen-data/tasks/locale-cz/run.sh (renamed from gen-data/tasks/locale-cz/run.sh) | 0 | ||||
-rw-r--r-- | postgresql-tests/gen-data/tasks/locale-utf-typo/run.sh (renamed from gen-data/tasks/locale-utf-typo/run.sh) | 0 | ||||
-rw-r--r-- | postgresql-tests/gen-data/tasks/templates/locale-change.sh (renamed from gen-data/tasks/templates/locale-change.sh) | 0 | ||||
-rw-r--r-- | postgresql-tests/lib_pgsql.sh (renamed from lib_pgsql.sh) | 0 | ||||
l--------- | postgresql-tests/libdtf | 1 | ||||
l--------- | postgresql-tests/run | 1 | ||||
-rw-r--r-- | postgresql-tests/tasks/initdb/config.sh (renamed from tasks/initdb/config.sh) | 0 | ||||
-rwxr-xr-x | postgresql-tests/tasks/initdb/runtest.sh (renamed from tasks/initdb/runtest.sh) | 0 | ||||
-rw-r--r-- | postgresql-tests/tasks/initdb_old/config.sh (renamed from tasks/initdb_old/config.sh) | 0 | ||||
-rwxr-xr-x | postgresql-tests/tasks/initdb_old/runtest.sh (renamed from tasks/initdb_old/runtest.sh) | 0 | ||||
-rw-r--r-- | postgresql-tests/tasks/upgrade-basic/config.sh (renamed from tasks/upgrade-basic/config.sh) | 0 | ||||
-rw-r--r-- | postgresql-tests/tasks/upgrade-basic/runtest.sh (renamed from tasks/upgrade-basic/runtest.sh) | 0 | ||||
-rw-r--r-- | postgresql-tests/tasks/upgrade-utf8-syntax/config.sh (renamed from tasks/upgrade-utf8-syntax/config.sh) | 0 | ||||
-rw-r--r-- | postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh (renamed from tasks/upgrade-utf8-syntax/runtest.sh) | 0 | ||||
-rwxr-xr-x | tester/dtf-prepare-testsuite | 8 | ||||
-rw-r--r-- | tester/libdtf/libdtf.sh (renamed from lib.sh) | 2 | ||||
-rwxr-xr-x | tester/run (renamed from run) | 60 |
48 files changed, 111 insertions, 50 deletions
diff --git a/ansible/dummy-wrapper.yml b/controller/ansible/dummy-wrapper.yml index 524b0ea..524b0ea 100644 --- a/ansible/dummy-wrapper.yml +++ b/controller/ansible/dummy-wrapper.yml diff --git a/ansible/fedora.yml b/controller/ansible/fedora.yml index 9b0c592..cc64eac 100644 --- a/ansible/fedora.yml +++ b/controller/ansible/fedora.yml @@ -37,14 +37,12 @@ local_action: add_host hostname={{ machine_ip.stdout }} groupname=temp_group - - local_action: shell cd .. ; ./dist - - hosts: temp_group user: root gather_facts: False tasks: - - copy: src=../postgresql-setup-tests.tar.gz - dest=/root/postgresql-setup-tests.tar.gz + - copy: src={{ opt_workdir }}/{{ opt_testsuite_name }}.tar.gz + dest=/root/{{ opt_testsuite_name }}.tar.gz - include: include/beakerlib.yml @@ -53,9 +51,9 @@ - include: include/additional-packages.yml when: dtf_rpm_files_list is defined - - shell: cd /root && tar -xf postgresql-setup-tests.tar.gz + - shell: cd /root && tar -xf {{ opt_testsuite_name }}.tar.gz - - shell: cd /root/postgresql-setup-tests && ./run &>/var/tmp/dtf-run.overview + - shell: cd /root/{{ opt_testsuite_name }}&& ./run &>/var/tmp/dtf-run.overview register: test_result ignore_errors: yes diff --git a/ansible/include/additional-packages.yml b/controller/ansible/include/additional-packages.yml index f821255..f821255 100644 --- a/ansible/include/additional-packages.yml +++ b/controller/ansible/include/additional-packages.yml diff --git a/ansible/include/beakerlib.yml b/controller/ansible/include/beakerlib.yml index 0461f25..0461f25 100644 --- a/ansible/include/beakerlib.yml +++ b/controller/ansible/include/beakerlib.yml diff --git a/ansible/include/download-results.yml b/controller/ansible/include/download-results.yml index 74b35b8..4404e08 100644 --- a/ansible/include/download-results.yml +++ b/controller/ansible/include/download-results.yml @@ -2,4 +2,4 @@ - shell: cd /var/tmp ; tar -czf dtf.tar.gz dtf -- fetch: src=/var/tmp/dtf.tar.gz dest="{{ opt_tmp_resultdir }}/" flat=yes +- fetch: src=/var/tmp/dtf.tar.gz dest="{{ opt_workdir }}/" flat=yes diff --git a/ansible/include/prepare-testenv.yml b/controller/ansible/include/prepare-testenv.yml index a63e51a..a63e51a 100644 --- a/ansible/include/prepare-testenv.yml +++ b/controller/ansible/include/prepare-testenv.yml diff --git a/ansible/run_include b/controller/ansible/run_include index 2b6ccfc..4e84c7d 100755 --- a/ansible/run_include +++ b/controller/ansible/run_include @@ -13,7 +13,7 @@ export playbook=$(readlink -f "$1") ansible-playbook -i "$workdir/../config/hosts" \ --extra-vars "include_file=$playbook" \ --extra-vars "script_name=dummy" \ - --extra-vars "opt_tmp_resultdir=/tmp/dtf-$(date +%H%M%S%N)" \ + --extra-vars "opt_workdir=/tmp/dtf-$(date +%H%M%S%N)" \ --extra-vars "target=host" \ "dummy-wrapper.yml" ) diff --git a/ansible_helpers/wait-for-ssh b/controller/ansible_helpers/wait-for-ssh index eb3880a..eb3880a 100755 --- a/ansible_helpers/wait-for-ssh +++ b/controller/ansible_helpers/wait-for-ssh diff --git a/config/.gitignore b/controller/config/.gitignore index 57c4fcb..57c4fcb 100644 --- a/config/.gitignore +++ b/controller/config/.gitignore diff --git a/config/config.sh.template b/controller/config/config.sh.template index 94cbe22..94cbe22 100644 --- a/config/config.sh.template +++ b/controller/config/config.sh.template diff --git a/config/hosts.template b/controller/config/hosts.template index 6850700..6850700 100644 --- a/config/hosts.template +++ b/controller/config/hosts.template diff --git a/config/os/EXAMPLE.sh b/controller/config/os/EXAMPLE.sh index b5ba270..b5ba270 100644 --- a/config/os/EXAMPLE.sh +++ b/controller/config/os/EXAMPLE.sh diff --git a/controller b/controller/controller index 7f628d6..e0cffe9 100755 --- a/controller +++ b/controller/controller @@ -7,7 +7,7 @@ # (still) local variables distro=fedora -distro_ver=20 +distro_ver=21 arch=x86_64 starttime=$(date -u +%Y%m%d_%H%M%S_%N) @@ -55,11 +55,14 @@ prereq_resultdir workdir=$(mktemp -d "/var/tmp/dtf_postgresql_setup-XXXXXX") +# cp /var/tmp/dtf_postgresql_setup-yK12r7/dtf.tar.gz "$workdir" ./run_remote \ --distro="$distro" \ --distro-version="$distro_ver" \ --workdir="$workdir" \ --openstack-instance="$DTF_OPENSTACK_ID" \ + "$(test -f additional_packages \ + && echo '--extra-rpms-file=additional_packages')" \ || die "can not perform run_remote" resultdir="$DTF_DATABASE/$distro/$distro_ver/$arch" diff --git a/get_machine b/controller/get_machine index 7d4e619..7d4e619 100755 --- a/get_machine +++ b/controller/get_machine diff --git a/parse_credsfile b/controller/parse_credsfile index df2a6bf..df2a6bf 100644 --- a/parse_credsfile +++ b/controller/parse_credsfile diff --git a/private/os/EXAMPLE.yml b/controller/private/os/EXAMPLE.yml index d44cbac..d44cbac 100644 --- a/private/os/EXAMPLE.yml +++ b/controller/private/os/EXAMPLE.yml diff --git a/runner/result_stats b/controller/result_stats index a92d6d6..a92d6d6 100755 --- a/runner/result_stats +++ b/controller/result_stats diff --git a/runner/result_templates/html.tmpl b/controller/result_templates/html.tmpl index 8a09ad7..8a09ad7 100644 --- a/runner/result_templates/html.tmpl +++ b/controller/result_templates/html.tmpl diff --git a/run_remote b/controller/run_remote index 39e45dd..0f7ccc3 100755 --- a/run_remote +++ b/controller/run_remote @@ -1,24 +1,37 @@ #!/bin/bash +. config/config.sh || { + echo >&2 "sorry, but config/config.sh not found" + exit 1 +} + longopts="verbose,help,force,testid:,listonly" run_playbook=${run_playbook-ansible/fedora.yml} opt_workdir=/var/tmp/dbt-results opt_distro=fedora -opt_openstack_instance=dropbear +opt_openstack_instance="$DTF_OPENSTACK_ID" opt_distro_ver=20 opt_extra_rpms= +opt_taskdir= die() { echo >&2 "$@" ; exit 1 ; } longopts="distro:,distro-version:,workdir:,openstack-instance:,extra-rpms-file:" +longopts+=",taskdir:" ARGS=$(getopt -o "v" -l "$longopts" -n "getopt" -- "$@") \ || exit 1 eval set -- "$ARGS" while true; do case "$1" in + --taskdir) + opt=$(sed -e 's/^--//' -e 's/[^[a-zA-Z0-9]/_/g'<<<"$1") + eval "opt_$opt=\"${2,,}\"" + shift 2 + ;; + --distro) opt_distro="$2" shift 2 @@ -35,6 +48,7 @@ while true; do ;; --workdir) + # where the remote results are fetched into opt_workdir="$2" shift 2 ;; @@ -51,6 +65,8 @@ while true; do esac done +test -z "$opt_taskdir" && die "you must specify --taskdir" + credsfile="$(readlink -f "./private/os/$opt_openstack_instance.yml")" test -z "$credsfile" && die "--ansible-creds option must be specified" test ! -f "$credsfile" && die "file $credsfile not found" @@ -61,15 +77,25 @@ test ! -r "$config_os_file" && die "file $config_os_file not found" config_os_id="$opt_distro$opt_distro_ver" +tarball() +( + testsuite_name="$(basename "$opt_taskdir")" + echo "$testsuite_name" + "$opt_taskdir/run" --dist | gzip > "$opt_workdir/$testsuite_name.tar.gz" +) + +testsuite_name="$(tarball)" || die "can not create dist tarball" + export ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook "$run_playbook" \ --extra-vars "opt_distro=$opt_distro" \ --extra-vars "opt_distro_ver=$opt_distro_ver" \ - --extra-vars "opt_tmp_resultdir=$opt_workdir" \ + --extra-vars "opt_workdir=$opt_workdir" \ --extra-vars "opt_credsfile=$credsfile" \ --extra-vars "os_flavor_id=${os_flavor_ids[$config_os_id]}" \ --extra-vars "os_image_id=${os_image_ids[$config_os_id]}" \ --extra-vars "os_keypair=${os_keypair}" \ --extra-vars "os_security_group=${os_security_group}" \ --extra-vars "os_network_dev=${os_network_dev}" \ + --extra-vars "opt_testsuite_name=${testsuite_name}" \ --extra-vars "${opt_extra_rpms:+dtf_rpm_files_list=$opt_extra_rpms}" @@ -1,15 +0,0 @@ -#!/bin/bash - -name=postgresql-setup-tests -tarball="$name.tar.gz" - -test -e .git || exit 1 - -mkdir "$name" -while read line; do - line=${line##postgresql-setup-tests/} - cp -R "$line" "$name" -done < dist.include - -tar -czf $tarball --wildcards -T dist.include -rm -rf $name diff --git a/dist.include b/dist.include deleted file mode 100644 index 3af4cfc..0000000 --- a/dist.include +++ /dev/null @@ -1,5 +0,0 @@ -postgresql-setup-tests/README -postgresql-setup-tests/tasks -postgresql-setup-tests/lib.sh -postgresql-setup-tests/lib_pgsql.sh -postgresql-setup-tests/run diff --git a/postgresql-tests/config.sh b/postgresql-tests/config.sh new file mode 100644 index 0000000..c5bd47a --- /dev/null +++ b/postgresql-tests/config.sh @@ -0,0 +1,10 @@ +# include PostgreSQL specific test-library +. "$srcdir/lib_pgsql.sh" || exit 1 + +# this is needed for some tests +export dtf_dataurl=http://pensioner.lab.eng.brq.redhat.com/root-tests/data/postgresql/ + +dtf_cb_dist_tasks() +{ + tar -ch "$dir" --exclude gen-data +} diff --git a/postgresql-tests/dist.include b/postgresql-tests/dist.include new file mode 100644 index 0000000..ed7c787 --- /dev/null +++ b/postgresql-tests/dist.include @@ -0,0 +1,6 @@ +config.sh +dist.include +libdtf +lib_pgsql.sh +run +tasks diff --git a/gen-data/databases/pagila.sh b/postgresql-tests/gen-data/databases/pagila.sh index a01d818..a01d818 100644 --- a/gen-data/databases/pagila.sh +++ b/postgresql-tests/gen-data/databases/pagila.sh diff --git a/gen-data/dist/dist b/postgresql-tests/gen-data/dist/dist index c9aea1b..c9aea1b 100755 --- a/gen-data/dist/dist +++ b/postgresql-tests/gen-data/dist/dist diff --git a/gen-data/dist/dist.exclude b/postgresql-tests/gen-data/dist/dist.exclude index 484ab7e..484ab7e 100644 --- a/gen-data/dist/dist.exclude +++ b/postgresql-tests/gen-data/dist/dist.exclude diff --git a/gen-data/dist/dist.list b/postgresql-tests/gen-data/dist/dist.list index 832aca4..832aca4 100644 --- a/gen-data/dist/dist.list +++ b/postgresql-tests/gen-data/dist/dist.list diff --git a/gen-data/generate b/postgresql-tests/gen-data/generate index d8ead6b..d8ead6b 100755 --- a/gen-data/generate +++ b/postgresql-tests/gen-data/generate diff --git a/gen-data/prep b/postgresql-tests/gen-data/prep index b5b19b5..b5b19b5 100755 --- a/gen-data/prep +++ b/postgresql-tests/gen-data/prep diff --git a/gen-data/remote_generate b/postgresql-tests/gen-data/remote_generate index a2ec172..eee11f6 100755 --- a/gen-data/remote_generate +++ b/postgresql-tests/gen-data/remote_generate @@ -12,3 +12,7 @@ scp="scp $ssh_opts" $scp dist/dist.tar.gz "$where:/root" $ssh "$where" "cd /root ; tar -xf dist.tar.gz ; ./prep && ./generate" + +rm -rf remote_results +mkdir remote_results +$scp -r "$where:/root/results" ./remote_results diff --git a/gen-data/tasks/basic/run.sh b/postgresql-tests/gen-data/tasks/basic/run.sh index 0118ad3..0118ad3 100644 --- a/gen-data/tasks/basic/run.sh +++ b/postgresql-tests/gen-data/tasks/basic/run.sh diff --git a/gen-data/tasks/locale-cz/run.sh b/postgresql-tests/gen-data/tasks/locale-cz/run.sh index 1788557..1788557 100644 --- a/gen-data/tasks/locale-cz/run.sh +++ b/postgresql-tests/gen-data/tasks/locale-cz/run.sh diff --git a/gen-data/tasks/locale-utf-typo/run.sh b/postgresql-tests/gen-data/tasks/locale-utf-typo/run.sh index 9004a88..9004a88 100644 --- a/gen-data/tasks/locale-utf-typo/run.sh +++ b/postgresql-tests/gen-data/tasks/locale-utf-typo/run.sh diff --git a/gen-data/tasks/templates/locale-change.sh b/postgresql-tests/gen-data/tasks/templates/locale-change.sh index 8f7964f..8f7964f 100644 --- a/gen-data/tasks/templates/locale-change.sh +++ b/postgresql-tests/gen-data/tasks/templates/locale-change.sh diff --git a/lib_pgsql.sh b/postgresql-tests/lib_pgsql.sh index 13bfc82..13bfc82 100644 --- a/lib_pgsql.sh +++ b/postgresql-tests/lib_pgsql.sh diff --git a/postgresql-tests/libdtf b/postgresql-tests/libdtf new file mode 120000 index 0000000..2aca4c4 --- /dev/null +++ b/postgresql-tests/libdtf @@ -0,0 +1 @@ +../tester/libdtf
\ No newline at end of file diff --git a/postgresql-tests/run b/postgresql-tests/run new file mode 120000 index 0000000..adeed00 --- /dev/null +++ b/postgresql-tests/run @@ -0,0 +1 @@ +../tester/run
\ No newline at end of file diff --git a/tasks/initdb/config.sh b/postgresql-tests/tasks/initdb/config.sh index c7f6619..c7f6619 100644 --- a/tasks/initdb/config.sh +++ b/postgresql-tests/tasks/initdb/config.sh diff --git a/tasks/initdb/runtest.sh b/postgresql-tests/tasks/initdb/runtest.sh index ee520d6..ee520d6 100755 --- a/tasks/initdb/runtest.sh +++ b/postgresql-tests/tasks/initdb/runtest.sh diff --git a/tasks/initdb_old/config.sh b/postgresql-tests/tasks/initdb_old/config.sh index 2386677..2386677 100644 --- a/tasks/initdb_old/config.sh +++ b/postgresql-tests/tasks/initdb_old/config.sh diff --git a/tasks/initdb_old/runtest.sh b/postgresql-tests/tasks/initdb_old/runtest.sh index 6a8d63c..6a8d63c 100755 --- a/tasks/initdb_old/runtest.sh +++ b/postgresql-tests/tasks/initdb_old/runtest.sh diff --git a/tasks/upgrade-basic/config.sh b/postgresql-tests/tasks/upgrade-basic/config.sh index a1d4a2f..a1d4a2f 100644 --- a/tasks/upgrade-basic/config.sh +++ b/postgresql-tests/tasks/upgrade-basic/config.sh diff --git a/tasks/upgrade-basic/runtest.sh b/postgresql-tests/tasks/upgrade-basic/runtest.sh index 5dd85bb..5dd85bb 100644 --- a/tasks/upgrade-basic/runtest.sh +++ b/postgresql-tests/tasks/upgrade-basic/runtest.sh diff --git a/tasks/upgrade-utf8-syntax/config.sh b/postgresql-tests/tasks/upgrade-utf8-syntax/config.sh index bed95ad..bed95ad 100644 --- a/tasks/upgrade-utf8-syntax/config.sh +++ b/postgresql-tests/tasks/upgrade-utf8-syntax/config.sh diff --git a/tasks/upgrade-utf8-syntax/runtest.sh b/postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh index 9e7d9cf..9e7d9cf 100644 --- a/tasks/upgrade-utf8-syntax/runtest.sh +++ b/postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh diff --git a/tester/dtf-prepare-testsuite b/tester/dtf-prepare-testsuite new file mode 100755 index 0000000..76031a9 --- /dev/null +++ b/tester/dtf-prepare-testsuite @@ -0,0 +1,8 @@ +#!/bin/bash -x + +tasks_srcdir="$1" + +srcdir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) || exit 1 + +ln -sf "$srcdir/run" "$tasks_srcdir" +ln -sf "$srcdir/libdtf" "$tasks_srcdir" diff --git a/lib.sh b/tester/libdtf/libdtf.sh index b8ef034..5724404 100644 --- a/lib.sh +++ b/tester/libdtf/libdtf.sh @@ -1,8 +1,6 @@ # package-agnostic function library. The "dtf_" prefix stands for # "destructive test framework". -. "$(dirname "$BASH_SOURCE")/lib_pgsql.sh" - dtf_die() { echo >&2 "$@"; exit 1; } dtf_generate_results_tarball() @@ -2,10 +2,14 @@ ## CONFIG ## -export dtf_resultdir=${dtf_resultdir_override-/var/tmp/dtf} -export dtf_srcdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") -export dtf_testdir=${dtf_testdir-$dtf_srcdir} -export dtf_dataurl=http://pensioner.lab.eng.brq.redhat.com/root-tests/data/postgresql/ +srcdir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) || exit 1 + +export DTF_LIBDIR=${DTF_LIBDIR-$srcdir/libdtf} +export DTF_TASKS=${DTF_TASKS-$srcdir/tasks} +export DTF_RESULTDIR=${DTF_RESULTDIR-/var/tmp/dtf} + +# when exists per-testsuite config.sh, source it here +test -r "$srcdir/config.sh" && . "$srcdir/config.sh" export dtf_resultxml_file=/var/tmp/dtf.xml @@ -14,7 +18,7 @@ export dtf_option_force=0 export dtf_option_testids="" export dtf_option_listonly=0 -. "$dtf_srcdir/lib.sh" +. "$DTF_LIBDIR/libdtf.sh" || exit 1 ## F.DEFS ## @@ -29,6 +33,26 @@ die() exit 1 } +dist() +( + cd "$srcdir/../" + dir="$(basename "$srcdir")" + test -t 1 && die "can't put tarball to stdout" + + if test -f "$dir/dist.include"; then + cmd="tar -ch" + while read line; do + cmd+=" $dir/$line" + done <"$srcdir/dist.include" + + $cmd + elif declare -f "dtf_cb_dist_tasks" >/dev/null; then + dtf_cb_dist_tasks + else + tar -ch "$dir" + fi +) + # run TESTDIR # ----------- # source the $TESTDIR/runtest.sh @@ -48,7 +72,7 @@ run() ( cd "$dtf_workdir" - outlog="$dtf_resultdir/$dtf_test_id.log" + outlog="$DTF_RESULTDIR/$dtf_test_id.log" output_wrapper="cat > $outlog" test $dtf_option_verbose = 1 \ @@ -73,19 +97,17 @@ run() set -o pipefail - ( . "$dtf_srcdir/lib.sh" || exit 1 - - . ./config.sh + ( . ./config.sh . ./runtest.sh rv=$? test -n "$DTF_RESULT_TARBALL" \ - && cp "$DTF_RESULT_TARBALL" "$dtf_resultdir/$dtf_test_id.tar.gz" + && cp "$DTF_RESULT_TARBALL" "$DTF_RESULTDIR/$dtf_test_id.tar.gz" { echo "---" echo "exit_status: $rv" echo "finished: \"$(date)\"" - } >> "$dtf_resultdir/$dtf_test_id.result" + } >> "$DTF_RESULTDIR/$dtf_test_id.result" exit $rv ) 2>&1 | eval "$output_wrapper" @@ -98,13 +120,13 @@ run() prepare_resultdir() { - if test -e "$dtf_resultdir"; then - test $dtf_option_force -eq 0 && die "result dir $dtf_resultdir exits" + if test -e "$DTF_RESULTDIR"; then + test $dtf_option_force -eq 0 && die "result dir $DTF_RESULTDIR exits" - rm -rf "$dtf_resultdir" || die "can not remove $dtf_resultdir" + rm -rf "$DTF_RESULTDIR" || die "can not remove $DTF_RESULTDIR" fi - mkdir -p "$dtf_resultdir" || die "can not create $dtf_resultdir" + mkdir -p "$DTF_RESULTDIR" || die "can not create $DTF_RESULTDIR" } show_help() @@ -124,7 +146,7 @@ EOHELP test -n "$1" && exit "$1" } -longopts="verbose,help,force,testid:,listonly" +longopts="verbose,help,force,testid:,listonly,dist" ARGS=$(getopt -o "v" -l "$longopts" -n "getopt" -- "$@") if [ $? -ne 0 ]; then echo "getopt error" @@ -153,6 +175,10 @@ while true; do --help) show_help 0 ;; + --dist) + dist + exit $? + ;; --) shift break @@ -173,7 +199,7 @@ while read i; do else dtf_resultxml_cache "<result>Fail</result></test>" fi -done <<<"$(find "$dtf_testdir" -name runtest.sh)" +done <<<"$(find "$DTF_TASKS" -name runtest.sh)" dtf_resultxml_finish exit $result |