From 2422a081a5be0d5ac5afb122361bc283da67341f Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Wed, 22 Oct 2014 08:54:05 +0200 Subject: big reorg: prepare for generalization Try to split into three separate components -> controller, tester, and 'tasks' (postgresql-tasks in our case). The controller component is the main part which is able to run the task remotely. Tester is more-like library for 'tasks' component (should be reusable on the raw git level). * controller: Almost separated component. * postgresql-tasks: Likewise. * tester: Likewise. --- ansible/dummy-wrapper.yml | 7 - ansible/fedora.yml | 66 ------- ansible/include/additional-packages.yml | 6 - ansible/include/beakerlib.yml | 1 - ansible/include/download-results.yml | 5 - ansible/include/prepare-testenv.yml | 3 - ansible/run_include | 19 -- ansible_helpers/wait-for-ssh | 11 -- config/.gitignore | 2 - config/config.sh.template | 36 ---- config/hosts.template | 2 - config/os/EXAMPLE.sh | 20 -- controller | 70 ------- controller/ansible/dummy-wrapper.yml | 7 + controller/ansible/fedora.yml | 64 +++++++ controller/ansible/include/additional-packages.yml | 6 + controller/ansible/include/beakerlib.yml | 1 + controller/ansible/include/download-results.yml | 5 + controller/ansible/include/prepare-testenv.yml | 3 + controller/ansible/run_include | 19 ++ controller/ansible_helpers/wait-for-ssh | 11 ++ controller/config/.gitignore | 2 + controller/config/config.sh.template | 36 ++++ controller/config/hosts.template | 2 + controller/config/os/EXAMPLE.sh | 20 ++ controller/controller | 73 ++++++++ controller/get_machine | 85 +++++++++ controller/parse_credsfile | 14 ++ controller/private/os/EXAMPLE.yml | 7 + controller/result_stats | 74 ++++++++ controller/result_templates/html.tmpl | 42 +++++ controller/run_remote | 101 ++++++++++ dist | 15 -- dist.include | 5 - gen-data/databases/pagila.sh | 39 ---- gen-data/dist/dist | 4 - gen-data/dist/dist.exclude | 1 - gen-data/dist/dist.list | 5 - gen-data/generate | 129 ------------- gen-data/prep | 5 - gen-data/remote_generate | 14 -- gen-data/tasks/basic/run.sh | 6 - gen-data/tasks/locale-cz/run.sh | 5 - gen-data/tasks/locale-utf-typo/run.sh | 5 - gen-data/tasks/templates/locale-change.sh | 16 -- get_machine | 85 --------- lib.sh | 49 ----- lib_pgsql.sh | 157 ---------------- parse_credsfile | 14 -- postgresql-tests/config.sh | 10 + postgresql-tests/dist.include | 6 + postgresql-tests/gen-data/databases/pagila.sh | 39 ++++ postgresql-tests/gen-data/dist/dist | 4 + postgresql-tests/gen-data/dist/dist.exclude | 1 + postgresql-tests/gen-data/dist/dist.list | 5 + postgresql-tests/gen-data/generate | 129 +++++++++++++ postgresql-tests/gen-data/prep | 5 + postgresql-tests/gen-data/remote_generate | 18 ++ postgresql-tests/gen-data/tasks/basic/run.sh | 6 + postgresql-tests/gen-data/tasks/locale-cz/run.sh | 5 + .../gen-data/tasks/locale-utf-typo/run.sh | 5 + .../gen-data/tasks/templates/locale-change.sh | 16 ++ postgresql-tests/lib_pgsql.sh | 157 ++++++++++++++++ postgresql-tests/libdtf | 1 + postgresql-tests/run | 1 + postgresql-tests/tasks/initdb/config.sh | 4 + postgresql-tests/tasks/initdb/runtest.sh | 11 ++ postgresql-tests/tasks/initdb_old/config.sh | 4 + postgresql-tests/tasks/initdb_old/runtest.sh | 5 + postgresql-tests/tasks/upgrade-basic/config.sh | 2 + postgresql-tests/tasks/upgrade-basic/runtest.sh | 6 + .../tasks/upgrade-utf8-syntax/config.sh | 3 + .../tasks/upgrade-utf8-syntax/runtest.sh | 15 ++ private/os/EXAMPLE.yml | 7 - run | 179 ------------------ run_remote | 75 -------- runner/result_stats | 74 -------- runner/result_templates/html.tmpl | 42 ----- tasks/initdb/config.sh | 4 - tasks/initdb/runtest.sh | 11 -- tasks/initdb_old/config.sh | 4 - tasks/initdb_old/runtest.sh | 5 - tasks/upgrade-basic/config.sh | 2 - tasks/upgrade-basic/runtest.sh | 6 - tasks/upgrade-utf8-syntax/config.sh | 3 - tasks/upgrade-utf8-syntax/runtest.sh | 15 -- tester/dtf-prepare-testsuite | 8 + tester/libdtf/libdtf.sh | 47 +++++ tester/run | 205 +++++++++++++++++++++ 89 files changed, 1290 insertions(+), 1229 deletions(-) delete mode 100644 ansible/dummy-wrapper.yml delete mode 100644 ansible/fedora.yml delete mode 100644 ansible/include/additional-packages.yml delete mode 100644 ansible/include/beakerlib.yml delete mode 100644 ansible/include/download-results.yml delete mode 100644 ansible/include/prepare-testenv.yml delete mode 100755 ansible/run_include delete mode 100755 ansible_helpers/wait-for-ssh delete mode 100644 config/.gitignore delete mode 100644 config/config.sh.template delete mode 100644 config/hosts.template delete mode 100644 config/os/EXAMPLE.sh delete mode 100755 controller create mode 100644 controller/ansible/dummy-wrapper.yml create mode 100644 controller/ansible/fedora.yml create mode 100644 controller/ansible/include/additional-packages.yml create mode 100644 controller/ansible/include/beakerlib.yml create mode 100644 controller/ansible/include/download-results.yml create mode 100644 controller/ansible/include/prepare-testenv.yml create mode 100755 controller/ansible/run_include create mode 100755 controller/ansible_helpers/wait-for-ssh create mode 100644 controller/config/.gitignore create mode 100644 controller/config/config.sh.template create mode 100644 controller/config/hosts.template create mode 100644 controller/config/os/EXAMPLE.sh create mode 100755 controller/controller create mode 100755 controller/get_machine create mode 100644 controller/parse_credsfile create mode 100644 controller/private/os/EXAMPLE.yml create mode 100755 controller/result_stats create mode 100644 controller/result_templates/html.tmpl create mode 100755 controller/run_remote delete mode 100755 dist delete mode 100644 dist.include delete mode 100644 gen-data/databases/pagila.sh delete mode 100755 gen-data/dist/dist delete mode 100644 gen-data/dist/dist.exclude delete mode 100644 gen-data/dist/dist.list delete mode 100755 gen-data/generate delete mode 100755 gen-data/prep delete mode 100755 gen-data/remote_generate delete mode 100644 gen-data/tasks/basic/run.sh delete mode 100644 gen-data/tasks/locale-cz/run.sh delete mode 100644 gen-data/tasks/locale-utf-typo/run.sh delete mode 100644 gen-data/tasks/templates/locale-change.sh delete mode 100755 get_machine delete mode 100644 lib.sh delete mode 100644 lib_pgsql.sh delete mode 100644 parse_credsfile create mode 100644 postgresql-tests/config.sh create mode 100644 postgresql-tests/dist.include create mode 100644 postgresql-tests/gen-data/databases/pagila.sh create mode 100755 postgresql-tests/gen-data/dist/dist create mode 100644 postgresql-tests/gen-data/dist/dist.exclude create mode 100644 postgresql-tests/gen-data/dist/dist.list create mode 100755 postgresql-tests/gen-data/generate create mode 100755 postgresql-tests/gen-data/prep create mode 100755 postgresql-tests/gen-data/remote_generate create mode 100644 postgresql-tests/gen-data/tasks/basic/run.sh create mode 100644 postgresql-tests/gen-data/tasks/locale-cz/run.sh create mode 100644 postgresql-tests/gen-data/tasks/locale-utf-typo/run.sh create mode 100644 postgresql-tests/gen-data/tasks/templates/locale-change.sh create mode 100644 postgresql-tests/lib_pgsql.sh create mode 120000 postgresql-tests/libdtf create mode 120000 postgresql-tests/run create mode 100644 postgresql-tests/tasks/initdb/config.sh create mode 100755 postgresql-tests/tasks/initdb/runtest.sh create mode 100644 postgresql-tests/tasks/initdb_old/config.sh create mode 100755 postgresql-tests/tasks/initdb_old/runtest.sh create mode 100644 postgresql-tests/tasks/upgrade-basic/config.sh create mode 100644 postgresql-tests/tasks/upgrade-basic/runtest.sh create mode 100644 postgresql-tests/tasks/upgrade-utf8-syntax/config.sh create mode 100644 postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh delete mode 100644 private/os/EXAMPLE.yml delete mode 100755 run delete mode 100755 run_remote delete mode 100755 runner/result_stats delete mode 100644 runner/result_templates/html.tmpl delete mode 100644 tasks/initdb/config.sh delete mode 100755 tasks/initdb/runtest.sh delete mode 100644 tasks/initdb_old/config.sh delete mode 100755 tasks/initdb_old/runtest.sh delete mode 100644 tasks/upgrade-basic/config.sh delete mode 100644 tasks/upgrade-basic/runtest.sh delete mode 100644 tasks/upgrade-utf8-syntax/config.sh delete mode 100644 tasks/upgrade-utf8-syntax/runtest.sh create mode 100755 tester/dtf-prepare-testsuite create mode 100644 tester/libdtf/libdtf.sh create mode 100755 tester/run diff --git a/ansible/dummy-wrapper.yml b/ansible/dummy-wrapper.yml deleted file mode 100644 index 524b0ea..0000000 --- a/ansible/dummy-wrapper.yml +++ /dev/null @@ -1,7 +0,0 @@ -- name: "dummy-wrapper" - hosts: "{{ target }}" - remote_user: root - gather_facts: False - - tasks: - - include: "{{ include_file }}" diff --git a/ansible/fedora.yml b/ansible/fedora.yml deleted file mode 100644 index 9b0c592..0000000 --- a/ansible/fedora.yml +++ /dev/null @@ -1,66 +0,0 @@ -- name: self-standing testsuite - remote_user: root - gather_facts: False - hosts: localhost - vars_files: - - "{{ opt_credsfile }}" - - tasks: - - name: generate builder name - local_action: shell echo `dd if=/dev/urandom bs=1k count=10 | md5sum ; echo DBTESTS` - register: vm_name - - - debug: msg="osusername={{ os_username }}" - - - name: spin it up - local_action: nova_compute auth_url={{os_auth_url}} - flavor_id={{os_flavor_id}} image_id="{{ os_image_id }}" key_name={{ os_keypair }} - login_password={{os_nova_password}} login_tenant_name="{{os_tenant_name}}" - login_username={{os_username}} security_groups={{os_security_group}} - wait=yes name="{{vm_name.stdout}}" wait_for=600 - register: nova - - - debug: msg="{{ nova.info.addresses }}" - - # This is ugly as hell... Hopefully nothing will be changing. - - local_action: command echo "{{ nova.info.addresses[os_network_dev][1].addr }}" - register: machine_ip - - - debug: msg="{{ machine_ip.stdout }}" - - - name: wait for the host to be hot - local_action: wait_for host={{ machine_ip.stdout }} port=22 delay=5 timeout=600 - - - local_action: shell ../ansible_helpers/wait-for-ssh "root@{{ machine_ip.stdout }}" - - - name: add it to the special group - 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 - - - include: include/beakerlib.yml - - - include: include/prepare-testenv.yml - - - 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/postgresql-setup-tests && ./run &>/var/tmp/dtf-run.overview - register: test_result - ignore_errors: yes - - - include: include/download-results.yml - - - name: stop the vm - shell: echo "not implemented yet" - when: test_result.rc == 0 diff --git a/ansible/include/additional-packages.yml b/ansible/include/additional-packages.yml deleted file mode 100644 index f821255..0000000 --- a/ansible/include/additional-packages.yml +++ /dev/null @@ -1,6 +0,0 @@ -- local_action: shell cat "{{ dtf_rpm_files_list }}" | xargs -n 100 - register: additional_packages - -- debug: msg="{{ additional_packages.stdout }}" - -- shell: yum install -y {{ additional_packages.stdout }} diff --git a/ansible/include/beakerlib.yml b/ansible/include/beakerlib.yml deleted file mode 100644 index 0461f25..0000000 --- a/ansible/include/beakerlib.yml +++ /dev/null @@ -1 +0,0 @@ -- yum: conf_file=https://beaker-project.org/yum/beaker-server-Fedora.repo state=present name=beakerlib diff --git a/ansible/include/download-results.yml b/ansible/include/download-results.yml deleted file mode 100644 index 74b35b8..0000000 --- a/ansible/include/download-results.yml +++ /dev/null @@ -1,5 +0,0 @@ -- shell: cp -f /var/tmp/dtf-run.overview /var/tmp/dtf/ - -- shell: cd /var/tmp ; tar -czf dtf.tar.gz dtf - -- fetch: src=/var/tmp/dtf.tar.gz dest="{{ opt_tmp_resultdir }}/" flat=yes diff --git a/ansible/include/prepare-testenv.yml b/ansible/include/prepare-testenv.yml deleted file mode 100644 index a63e51a..0000000 --- a/ansible/include/prepare-testenv.yml +++ /dev/null @@ -1,3 +0,0 @@ -- yum: state=present name=postgresql-server - -- yum: state=present name=postgresql-upgrade diff --git a/ansible/run_include b/ansible/run_include deleted file mode 100755 index 2b6ccfc..0000000 --- a/ansible/run_include +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -export ANSIBLE_HOST_KEY_CHECKING=False - -workdir="$(dirname "${BASH_SOURCE[0]}")" -workdir=$(readlink -f "$workdir") - -export playbook=$(readlink -f "$1") - -( set -x - cd "$workdir" - - 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 "target=host" \ - "dummy-wrapper.yml" -) diff --git a/ansible_helpers/wait-for-ssh b/ansible_helpers/wait-for-ssh deleted file mode 100755 index eb3880a..0000000 --- a/ansible_helpers/wait-for-ssh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -x - -where="$1" - -test -z "$where" && echo >&2 "no host specified" && exit 1 - -while [ 1 ]; do - ssh -o StrictHostKeyChecking=no -q $where exit &>/dev/null && exit 0 -done - -exit 1 diff --git a/config/.gitignore b/config/.gitignore deleted file mode 100644 index 57c4fcb..0000000 --- a/config/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.sh -hosts diff --git a/config/config.sh.template b/config/config.sh.template deleted file mode 100644 index 94cbe22..0000000 --- a/config/config.sh.template +++ /dev/null @@ -1,36 +0,0 @@ -# OpenStack ID -# ------------ -# -# By default, based on DTF_OPENSTACK_ID content the corresponding OpenStack -# configuration is used. You may have multiple OpenStack instances configured - -# this option selects one. Based on the OpenStack ID (say 'EXAMPLE'), those -# configuration-like files are used: -# -# * private/os/'EXAMPLE'.yml -# File having OpenStack credentials in ansible variable file (YAML file -# with "key: value" lines). See the ./private/os/EXAMPLE.yml for -# variables you should set up. Keep this file secret. -# -# * config/os/'EXAMPLE'.sh -# This file must contain configuration for specific OpenStack instance. -# Usually information about available images, flavors, networking, etc. -# The template file config/os/EXAMPLE.sh may be used when configuring your -# testing environment. - -export DTF_OPENSTACK_ID=dropbear - -# Result Database -# --------------- -# Directory where the testsuite should keep its (persistent) results. Make sure -# that this directory is backed up. - -export DTF_DATABASE=/var/lib/dtf_results - -# Presenter place -# --------------- -# For now, only static results are available. DTF_PRESENTER_PLACE must contain -# rsync-compatible destination (it may be place accessible via ssh+rsync). It -# is expected that some httpd server is able to read the directory with results -# and publish them as static directory structure over http://. - -export DTF_PRESENTER_PLACE=user@example.org:/var/www/html/my_project/dtf diff --git a/config/hosts.template b/config/hosts.template deleted file mode 100644 index 6850700..0000000 --- a/config/hosts.template +++ /dev/null @@ -1,2 +0,0 @@ -[host] -10.64.27.30 diff --git a/config/os/EXAMPLE.sh b/config/os/EXAMPLE.sh deleted file mode 100644 index b5ba270..0000000 --- a/config/os/EXAMPLE.sh +++ /dev/null @@ -1,20 +0,0 @@ -## THIS IS EXAMPLE OPENSTACK DTF CONFIGURATION ## - -# variable declarations, should be C&Ped -declare -A os_flavor_ids os_image_ids -export os_flavor_ids=[] -export os_image_ids=[] - -# connection info about particular OpenStack instance - -# which ssh keys should be uploaded to created VMs -export os_keypair="keypair-id" -# group of firewall rules to be set on VMs -export os_security_group=test_group -# the name of network connection as is presented by ansible -export os_network_dev=network_name - -# per-distribution dictionary with images/flavors -os_flavor_ids["fedora20"]="2" -os_image_ids["fedora20"]="0461eef2-5921-4c01-95a6-6edf96d41b89" - diff --git a/controller b/controller deleted file mode 100755 index 7f628d6..0000000 --- a/controller +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -. config/config.sh || { - echo >&2 "sorry, but config/config.sh not found" - exit 1 -} - -# (still) local variables -distro=fedora -distro_ver=20 -arch=x86_64 -starttime=$(date -u +%Y%m%d_%H%M%S_%N) - -die() { echo "$@"; exit 1; } - -prereq_resultdir() -{ - test -d "$DTF_DATABASE" || mkdir -p "$DTF_DATABASE" -} - -unpack_results() -{ - local where="$1" - local tmp_results_dir="$2" - - local workdir=$(mktemp -d "/tmp/.dtf.XXXXXX") || die "can not create workdir" - - { pushd "$workdir" >/dev/null \ - && tar -xf "$tmp_results_dir/dtf.tar.gz" \ - && pushd dtf >/dev/null - } || die "can not unpack results" - - for i in *.log; do - local task_id="${i%%.log}" - local mydir="" - - # First item in tarball is the "main" directory - while read dirname; do - test -z "$mydir" && mydir="$dirname" - done <<<"$(tar xvf "$task_id.tar.gz")" - - # Give the unpacked results better name - rm "$task_id.tar.gz" - mv "$mydir" "$task_id.dir" - done - - { popd && popd ; } > /dev/null - - { mkdir -p "$(dirname "$where")" \ - && mv "$workdir/dtf" "$where" ; - } || die "can not create resultdir" -} - -prereq_resultdir - -workdir=$(mktemp -d "/var/tmp/dtf_postgresql_setup-XXXXXX") - -./run_remote \ - --distro="$distro" \ - --distro-version="$distro_ver" \ - --workdir="$workdir" \ - --openstack-instance="$DTF_OPENSTACK_ID" \ -|| die "can not perform run_remote" - -resultdir="$DTF_DATABASE/$distro/$distro_ver/$arch" -unpack_results "$resultdir/result_$starttime" "$workdir" - -./runner/result_stats "$resultdir" > "$resultdir/results.html" - -rsync -r "${DTF_DATABASE%%/}/" "${DTF_PRESENTER_PLACE%%/}" diff --git a/controller/ansible/dummy-wrapper.yml b/controller/ansible/dummy-wrapper.yml new file mode 100644 index 0000000..524b0ea --- /dev/null +++ b/controller/ansible/dummy-wrapper.yml @@ -0,0 +1,7 @@ +- name: "dummy-wrapper" + hosts: "{{ target }}" + remote_user: root + gather_facts: False + + tasks: + - include: "{{ include_file }}" diff --git a/controller/ansible/fedora.yml b/controller/ansible/fedora.yml new file mode 100644 index 0000000..cc64eac --- /dev/null +++ b/controller/ansible/fedora.yml @@ -0,0 +1,64 @@ +- name: self-standing testsuite + remote_user: root + gather_facts: False + hosts: localhost + vars_files: + - "{{ opt_credsfile }}" + + tasks: + - name: generate builder name + local_action: shell echo `dd if=/dev/urandom bs=1k count=10 | md5sum ; echo DBTESTS` + register: vm_name + + - debug: msg="osusername={{ os_username }}" + + - name: spin it up + local_action: nova_compute auth_url={{os_auth_url}} + flavor_id={{os_flavor_id}} image_id="{{ os_image_id }}" key_name={{ os_keypair }} + login_password={{os_nova_password}} login_tenant_name="{{os_tenant_name}}" + login_username={{os_username}} security_groups={{os_security_group}} + wait=yes name="{{vm_name.stdout}}" wait_for=600 + register: nova + + - debug: msg="{{ nova.info.addresses }}" + + # This is ugly as hell... Hopefully nothing will be changing. + - local_action: command echo "{{ nova.info.addresses[os_network_dev][1].addr }}" + register: machine_ip + + - debug: msg="{{ machine_ip.stdout }}" + + - name: wait for the host to be hot + local_action: wait_for host={{ machine_ip.stdout }} port=22 delay=5 timeout=600 + + - local_action: shell ../ansible_helpers/wait-for-ssh "root@{{ machine_ip.stdout }}" + + - name: add it to the special group + local_action: add_host hostname={{ machine_ip.stdout }} + groupname=temp_group + +- hosts: temp_group + user: root + gather_facts: False + tasks: + - copy: src={{ opt_workdir }}/{{ opt_testsuite_name }}.tar.gz + dest=/root/{{ opt_testsuite_name }}.tar.gz + + - include: include/beakerlib.yml + + - include: include/prepare-testenv.yml + + - include: include/additional-packages.yml + when: dtf_rpm_files_list is defined + + - shell: cd /root && tar -xf {{ opt_testsuite_name }}.tar.gz + + - shell: cd /root/{{ opt_testsuite_name }}&& ./run &>/var/tmp/dtf-run.overview + register: test_result + ignore_errors: yes + + - include: include/download-results.yml + + - name: stop the vm + shell: echo "not implemented yet" + when: test_result.rc == 0 diff --git a/controller/ansible/include/additional-packages.yml b/controller/ansible/include/additional-packages.yml new file mode 100644 index 0000000..f821255 --- /dev/null +++ b/controller/ansible/include/additional-packages.yml @@ -0,0 +1,6 @@ +- local_action: shell cat "{{ dtf_rpm_files_list }}" | xargs -n 100 + register: additional_packages + +- debug: msg="{{ additional_packages.stdout }}" + +- shell: yum install -y {{ additional_packages.stdout }} diff --git a/controller/ansible/include/beakerlib.yml b/controller/ansible/include/beakerlib.yml new file mode 100644 index 0000000..0461f25 --- /dev/null +++ b/controller/ansible/include/beakerlib.yml @@ -0,0 +1 @@ +- yum: conf_file=https://beaker-project.org/yum/beaker-server-Fedora.repo state=present name=beakerlib diff --git a/controller/ansible/include/download-results.yml b/controller/ansible/include/download-results.yml new file mode 100644 index 0000000..4404e08 --- /dev/null +++ b/controller/ansible/include/download-results.yml @@ -0,0 +1,5 @@ +- shell: cp -f /var/tmp/dtf-run.overview /var/tmp/dtf/ + +- shell: cd /var/tmp ; tar -czf dtf.tar.gz dtf + +- fetch: src=/var/tmp/dtf.tar.gz dest="{{ opt_workdir }}/" flat=yes diff --git a/controller/ansible/include/prepare-testenv.yml b/controller/ansible/include/prepare-testenv.yml new file mode 100644 index 0000000..a63e51a --- /dev/null +++ b/controller/ansible/include/prepare-testenv.yml @@ -0,0 +1,3 @@ +- yum: state=present name=postgresql-server + +- yum: state=present name=postgresql-upgrade diff --git a/controller/ansible/run_include b/controller/ansible/run_include new file mode 100755 index 0000000..4e84c7d --- /dev/null +++ b/controller/ansible/run_include @@ -0,0 +1,19 @@ +#!/bin/bash + +export ANSIBLE_HOST_KEY_CHECKING=False + +workdir="$(dirname "${BASH_SOURCE[0]}")" +workdir=$(readlink -f "$workdir") + +export playbook=$(readlink -f "$1") + +( set -x + cd "$workdir" + + ansible-playbook -i "$workdir/../config/hosts" \ + --extra-vars "include_file=$playbook" \ + --extra-vars "script_name=dummy" \ + --extra-vars "opt_workdir=/tmp/dtf-$(date +%H%M%S%N)" \ + --extra-vars "target=host" \ + "dummy-wrapper.yml" +) diff --git a/controller/ansible_helpers/wait-for-ssh b/controller/ansible_helpers/wait-for-ssh new file mode 100755 index 0000000..eb3880a --- /dev/null +++ b/controller/ansible_helpers/wait-for-ssh @@ -0,0 +1,11 @@ +#!/bin/bash -x + +where="$1" + +test -z "$where" && echo >&2 "no host specified" && exit 1 + +while [ 1 ]; do + ssh -o StrictHostKeyChecking=no -q $where exit &>/dev/null && exit 0 +done + +exit 1 diff --git a/controller/config/.gitignore b/controller/config/.gitignore new file mode 100644 index 0000000..57c4fcb --- /dev/null +++ b/controller/config/.gitignore @@ -0,0 +1,2 @@ +*.sh +hosts diff --git a/controller/config/config.sh.template b/controller/config/config.sh.template new file mode 100644 index 0000000..94cbe22 --- /dev/null +++ b/controller/config/config.sh.template @@ -0,0 +1,36 @@ +# OpenStack ID +# ------------ +# +# By default, based on DTF_OPENSTACK_ID content the corresponding OpenStack +# configuration is used. You may have multiple OpenStack instances configured - +# this option selects one. Based on the OpenStack ID (say 'EXAMPLE'), those +# configuration-like files are used: +# +# * private/os/'EXAMPLE'.yml +# File having OpenStack credentials in ansible variable file (YAML file +# with "key: value" lines). See the ./private/os/EXAMPLE.yml for +# variables you should set up. Keep this file secret. +# +# * config/os/'EXAMPLE'.sh +# This file must contain configuration for specific OpenStack instance. +# Usually information about available images, flavors, networking, etc. +# The template file config/os/EXAMPLE.sh may be used when configuring your +# testing environment. + +export DTF_OPENSTACK_ID=dropbear + +# Result Database +# --------------- +# Directory where the testsuite should keep its (persistent) results. Make sure +# that this directory is backed up. + +export DTF_DATABASE=/var/lib/dtf_results + +# Presenter place +# --------------- +# For now, only static results are available. DTF_PRESENTER_PLACE must contain +# rsync-compatible destination (it may be place accessible via ssh+rsync). It +# is expected that some httpd server is able to read the directory with results +# and publish them as static directory structure over http://. + +export DTF_PRESENTER_PLACE=user@example.org:/var/www/html/my_project/dtf diff --git a/controller/config/hosts.template b/controller/config/hosts.template new file mode 100644 index 0000000..6850700 --- /dev/null +++ b/controller/config/hosts.template @@ -0,0 +1,2 @@ +[host] +10.64.27.30 diff --git a/controller/config/os/EXAMPLE.sh b/controller/config/os/EXAMPLE.sh new file mode 100644 index 0000000..b5ba270 --- /dev/null +++ b/controller/config/os/EXAMPLE.sh @@ -0,0 +1,20 @@ +## THIS IS EXAMPLE OPENSTACK DTF CONFIGURATION ## + +# variable declarations, should be C&Ped +declare -A os_flavor_ids os_image_ids +export os_flavor_ids=[] +export os_image_ids=[] + +# connection info about particular OpenStack instance + +# which ssh keys should be uploaded to created VMs +export os_keypair="keypair-id" +# group of firewall rules to be set on VMs +export os_security_group=test_group +# the name of network connection as is presented by ansible +export os_network_dev=network_name + +# per-distribution dictionary with images/flavors +os_flavor_ids["fedora20"]="2" +os_image_ids["fedora20"]="0461eef2-5921-4c01-95a6-6edf96d41b89" + diff --git a/controller/controller b/controller/controller new file mode 100755 index 0000000..e0cffe9 --- /dev/null +++ b/controller/controller @@ -0,0 +1,73 @@ +#!/bin/bash + +. config/config.sh || { + echo >&2 "sorry, but config/config.sh not found" + exit 1 +} + +# (still) local variables +distro=fedora +distro_ver=21 +arch=x86_64 +starttime=$(date -u +%Y%m%d_%H%M%S_%N) + +die() { echo "$@"; exit 1; } + +prereq_resultdir() +{ + test -d "$DTF_DATABASE" || mkdir -p "$DTF_DATABASE" +} + +unpack_results() +{ + local where="$1" + local tmp_results_dir="$2" + + local workdir=$(mktemp -d "/tmp/.dtf.XXXXXX") || die "can not create workdir" + + { pushd "$workdir" >/dev/null \ + && tar -xf "$tmp_results_dir/dtf.tar.gz" \ + && pushd dtf >/dev/null + } || die "can not unpack results" + + for i in *.log; do + local task_id="${i%%.log}" + local mydir="" + + # First item in tarball is the "main" directory + while read dirname; do + test -z "$mydir" && mydir="$dirname" + done <<<"$(tar xvf "$task_id.tar.gz")" + + # Give the unpacked results better name + rm "$task_id.tar.gz" + mv "$mydir" "$task_id.dir" + done + + { popd && popd ; } > /dev/null + + { mkdir -p "$(dirname "$where")" \ + && mv "$workdir/dtf" "$where" ; + } || die "can not create resultdir" +} + +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" +unpack_results "$resultdir/result_$starttime" "$workdir" + +./runner/result_stats "$resultdir" > "$resultdir/results.html" + +rsync -r "${DTF_DATABASE%%/}/" "${DTF_PRESENTER_PLACE%%/}" diff --git a/controller/get_machine b/controller/get_machine new file mode 100755 index 0000000..7d4e619 --- /dev/null +++ b/controller/get_machine @@ -0,0 +1,85 @@ +#!/bin/bash + +die() { echo "$@" ; exit 1 ; } +info() { echo " * $@" ; } + +opt_openstack_instance=os1 +opt_distro=fedora +opt_distro_version=20 + +function show_help() +{ +cat <&2 +Usage: $0 OPTION + +Script is aimed to help sysadmin. + +Options: + --distro=NAME Distro name, like fedora + --distro-version=VERSION E.g. 20 for Fedora 20 + --openstack-instance=ID +EOHELP +test -n "$1" && exit "$1" +} + +boot() +( + set -o pipefail + nova boot "$1" --poll \ + --image "$2" \ + --flavor "$3" \ + --security-groups "$os_security_group" \ + --key-name "$os_keypair" \ + | grep "| id " | cut -d\| -f 3 | xargs -n 1 +) + +get_ip() +( + id="$1" + set -o pipefail + nova show "$id" | grep ' network ' \ + | cut -d\| -f 3 | cut -d, -f2 | xargs -n 1 +) + + +longopts="distro:,distro-version:,openstack-instance:" +ARGS=$(getopt -o "" -l "help,$longopts" -n "$0" -- "$@") \ + || exit 1 +eval set -- "$ARGS" + +while true; do + case "$1" in + --distro|--distro-version|--openstack-instance) + opt=$(sed -e 's/^--//' -e 's/[^[a-zA-Z0-9]/_/g'<<<"$1") + eval "opt_$opt=\"${2,,}\"" + shift 2 + ;; + + --help) + show_help 0 + ;; + + --) + shift + break; + esac +done + +. ./parse_credsfile "$opt_openstack_instance" || exit 1 +. ./config/os/"$opt_openstack_instance.sh" || exit 1 + +image_version=$opt_distro$opt_distro_version +image=${os_image_ids[$image_version]} +flavor=${os_flavor_ids[$image_version]} + +test -z "$image" && die "no image for '$image_version'" +test -z "$flavor" && die "no flavor for '$image_version'" + +info "booting machine $image_version from $image" + +machine=$(boot "testing-$image" "$image" "$flavor") + +info "machine id: $machine" + +ip=$(get_ip "$machine") +info "ip: $ip" diff --git a/controller/parse_credsfile b/controller/parse_credsfile new file mode 100644 index 0000000..df2a6bf --- /dev/null +++ b/controller/parse_credsfile @@ -0,0 +1,14 @@ +credsfile="private/os/$1.yml" + +while read line; do + if [[ "$line" =~ ^([a-zA-Z0-9_]*):\ ?(.*)$ ]]; then + key="${BASH_REMATCH[1]}" + if test "$key" = os_nova_password; then + key=os_password + fi + eval set ${BASH_REMATCH[2]} + eval export "${key^^}"="\"$@\"" + fi +done < "$credsfile" + +# vi: syntax=sh diff --git a/controller/private/os/EXAMPLE.yml b/controller/private/os/EXAMPLE.yml new file mode 100644 index 0000000..d44cbac --- /dev/null +++ b/controller/private/os/EXAMPLE.yml @@ -0,0 +1,7 @@ +## THIS IS EXAMPLE OPENSTACK CREDENTIALS FILE ## +--- +os_auth_url: http://openstack-controller.example.com:5000/v2.0 +os_tenant_id: 8289c1553643c7adf3476fb6234562c0 +os_tenant_name: Example Develpoment Group +os_username: jdoe +os_nova_password: plainPasswordKeepSecrete diff --git a/controller/result_stats b/controller/result_stats new file mode 100755 index 0000000..a92d6d6 --- /dev/null +++ b/controller/result_stats @@ -0,0 +1,74 @@ +#!/bin/perl + +use strict; +use warnings; +use utf8; + +use Data::Dumper; +use File::Basename; +use Cwd; +use Encode 'encode_utf8'; + +# teplates +use Text::Xslate; + +# yaml (quick) parser +use YAML::Syck; + +our $srcdir = dirname(__FILE__); + +sub html_printer +{ + my $results = $_[0]; + my $task_ids = $_[1]; + + my $xslate = Text::Xslate->new(path => ["$srcdir/result_templates"]); + + my $content = $xslate->render("html.tmpl", { + results => $results, + task_ids => $task_ids, + }); + print encode_utf8($content); +} + +my $workdir = $ARGV[0]; + +my $data = []; + +my $task_ids = {}; + +# go through *each* result directory +my $olddir = getcwd; +for (`find "$workdir" -maxdepth 1 -type d -name 'result_*'`) { + chomp; + chdir $_; + + my $run_results = {}; + $run_results->{dirname} = basename($_); + $run_results->{tasks} = {}; + $run_results->{exit_status} = 0; + + # go through each task + for (`find -maxdepth 1 -type f -name '*.result'`) { + chomp; + + (my $task_id = $_) =~ s/\.result$//; + $task_id =~ s/.*\///; + $task_ids->{$task_id} = 1; + + my $yaml_file = $_; + open my $fd, '<', $yaml_file + or die "can't open yaml file '$yaml_file'"; + + my $config = YAML::Syck::LoadFile($fd); + if ($config->{exit_status} != 0) { + $run_results->{exit_status} = 1; + } + $run_results->{tasks}->{$task_id} = $config; + } + + push @{$data}, $run_results; +} +chdir $olddir; + +html_printer $data, $task_ids; diff --git a/controller/result_templates/html.tmpl b/controller/result_templates/html.tmpl new file mode 100644 index 0000000..8a09ad7 --- /dev/null +++ b/controller/result_templates/html.tmpl @@ -0,0 +1,42 @@ + + + + + +Results + + + +
+ + + + +: for $task_ids.keys() -> $task_id { + +: } + + +: for $results -> $result { + : if ($result.exit_status) { + + : } else { + + : } + + : for $task_ids.keys() -> $task_id { + : if (not defined($result.tasks[$task_id].exit_status)) { + + : } elsif ($result.tasks[$task_id].exit_status == 0) { + + : } else { + + : } + : } + +:} + +
Run time<: $task_id :>
<: $result.dirname :>NOT AVAILABLEOKFAIL
+
+ + diff --git a/controller/run_remote b/controller/run_remote new file mode 100755 index 0000000..0f7ccc3 --- /dev/null +++ b/controller/run_remote @@ -0,0 +1,101 @@ +#!/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="$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 + ;; + + --distro-version) + opt_distro_ver="$2" + shift 2 + ;; + + --openstack-instance) + opt_openstack_instance="$2" + shift 2 + ;; + + --workdir) + # where the remote results are fetched into + opt_workdir="$2" + shift 2 + ;; + + --extra-rpms-file) + opt_extra_rpms="$(readlink -f "$2")" + shift 2 + ;; + + --) + shift + break + ;; + 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" + +config_os_file="$(readlink -f "./config/os/$opt_openstack_instance.sh")" +test ! -r "$config_os_file" && die "file $config_os_file not found" +. "$config_os_file" + +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_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}" diff --git a/dist b/dist deleted file mode 100755 index 9c97621..0000000 --- a/dist +++ /dev/null @@ -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/gen-data/databases/pagila.sh b/gen-data/databases/pagila.sh deleted file mode 100644 index a01d818..0000000 --- a/gen-data/databases/pagila.sh +++ /dev/null @@ -1,39 +0,0 @@ -create_pagila() -( - testit() - { - debug "testing database" - - local cmd="psql -tA -d pagila -c \"select city from city where city = 'Banjul';\"" - - out="$(admin_cmd "$cmd")" - test "$out" = Banjul || return 1 - test "$(wc -l < pagila_init.log)" -gt 335 || return 1 - - test "$({ grep ERROR | wc -l ; } < pagila_init.log)" -lt 2 - } - - debug "creating DB pagilla" - INDENT="$INDENT " - - pagila="pagila-0.10.1" - pagila_tarball="$pagila.zip" - pagila_link="http://pgfoundry.org/frs/download.php/1719/$pagila_tarball" - - cached_download $pagila_link - - debug "unzipping tarball" - unzip $pagila_tarball &>/dev/null || die "can not unzip pagila" - - pushd $pagila >/dev/null || die "can not switch directory" - admin_cmd "createdb pagila --owner postgres" || die "can't create db" - { su - postgres -c 'psql -d pagila' < pagila-schema.sql \ - && su - postgres -c 'psql -d pagila' < pagila-data.sql - } &>pagila_init.log || die "can not initialize pagila" - - cp pagila_init.log /tmp - - testit || die "can not test" - - popd >/dev/null || die "can't go back" -) diff --git a/gen-data/dist/dist b/gen-data/dist/dist deleted file mode 100755 index c9aea1b..0000000 --- a/gen-data/dist/dist +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# !!!! creating tar-BOMB !!!! -tar -cf dist/dist.tar.gz -T dist/dist.list -X dist/dist.exclude diff --git a/gen-data/dist/dist.exclude b/gen-data/dist/dist.exclude deleted file mode 100644 index 484ab7e..0000000 --- a/gen-data/dist/dist.exclude +++ /dev/null @@ -1 +0,0 @@ -results/* diff --git a/gen-data/dist/dist.list b/gen-data/dist/dist.list deleted file mode 100644 index 832aca4..0000000 --- a/gen-data/dist/dist.list +++ /dev/null @@ -1,5 +0,0 @@ -prep -generate -databases -tasks -results diff --git a/gen-data/generate b/gen-data/generate deleted file mode 100755 index d8ead6b..0000000 --- a/gen-data/generate +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/bash - -GEN_DATADIR=/var/lib/pgsql/data -CACHEDIR=/var/cache/dbt -OUTPUTDIR="$(pwd)/results" -SRCDIR="$(pwd)" -DEBUG=1 -CHECK_LOCALE=1 - -printline() { echo "$INDENT$@" ; } - -die() { printline " ERROR $@" ; exit 1 ; } - -info() { printline " * $@"; } - -debug() { test $DEBUG -eq 1 && printline " ~ $@"; } - -admin_cmd() -{ - su - postgres -c "$@" || die "can not execute '$@'" -} - -cached_download() -{ - local link=$1 - local bn="$(basename "$1")" - local file="$CACHEDIR/$bn" - - if test ! -d "$CACHEDIR"; then - mkdir -p "$CACHEDIR" || die "can't create cachedir" - fi - - test -e "$file" && cp "$file" ./ && return - - { wget "$link" && cp "$bn" "$CACHEDIR" ; } \ - || die "can't download" -} - -is_defined_f() -{ - declare -f "$1" >/dev/null -} - -run_if_defined() -{ - is_defined_f "$1" || return 0 - "$1" -} - -locale_prereq() -{ - local default_locale="LANG=en_US.UTF-8" - local current_locale="$(cat /etc/locale.conf)" - test "$current_locale" = "$default_locale" \ - || die "bad locale '$current_locale', should be '$default_locale'" -} - -single_task() -{ - local task="$1" - - info "running task $task" - - ( - INDENT=" " - . "$SRCDIR/databases/pagila.sh" || die "pagila incl fail" - . "$SRCDIR/$task" || die "include fail" - - run_if_defined "hook_start" - - test "$CHECK_LOCALE" -eq 1 && locale_prereq - - debug "initializing database" - postgresql-setup initdb &>/dev/null || die "can not initdb" - - debug "starting server" - service postgresql start &>/dev/null || die "can't start postgresql" - - tmpdir=$(mktemp -d /tmp/dbt-XXXXXX) || die "can not create temp directory" - - debug "working in $tmpdir" - pushd "$tmpdir" >/dev/null || die "can switch to $tmpdir" - - run || die "fail" - - popd >/dev/null || die "can not switch back" - - debug "stopping server" - service postgresql stop &>/dev/null || die "can't stop postgresql" - - tarball="$OUTPUTDIR/$task_name.tar.gz" - tar -czf "$tarball" -C /var/lib/pgsql/ data - info "result tarball $tarball" - rm -rf "$tmpdir" - - - debug "data removal" - rm -rf "$GEN_DATADIR" - - run_if_defined "hook_end" - ) -} - -generate_tasks() -{ - find ./tasks -name run.sh | while read line; do - single_task "$line" - done -} - -main() -{ - test "$UID" -ne 0 && die "run under 'root' user" - - test -d "$OUTPUTDIR" || die "$OUTPUTDIR does not seem to be directory" - - service postgresql status &>/dev/null - test $? -ne 3 && die "stop the postgresql server" - - local dbdir="$GEN_DATADIR" - test -e "$dbdir" && die "the '$dbdir' should not exist" - - { rpm -qa postgresql && rpm -qa postgresql-server ; } &>/dev/null \ - || die "PostgreSQL not installed" - - generate_tasks -} - -main diff --git a/gen-data/prep b/gen-data/prep deleted file mode 100755 index b5b19b5..0000000 --- a/gen-data/prep +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -yum install -y wget postgresql-server unzip -echo "LANG=en_US.UTF-8" > /etc/locale.conf -rm -rf /var/lib/pgsql/data diff --git a/gen-data/remote_generate b/gen-data/remote_generate deleted file mode 100755 index a2ec172..0000000 --- a/gen-data/remote_generate +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -x - -where="root@$1" - -./dist/dist -tar tf dist/dist.tar.gz - -ssh_opts="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" -ssh="ssh $ssh_opts" -scp="scp $ssh_opts" - -$scp dist/dist.tar.gz "$where:/root" - -$ssh "$where" "cd /root ; tar -xf dist.tar.gz ; ./prep && ./generate" diff --git a/gen-data/tasks/basic/run.sh b/gen-data/tasks/basic/run.sh deleted file mode 100644 index 0118ad3..0000000 --- a/gen-data/tasks/basic/run.sh +++ /dev/null @@ -1,6 +0,0 @@ -export task_name="basic" - -run() -{ - create_pagila -} diff --git a/gen-data/tasks/locale-cz/run.sh b/gen-data/tasks/locale-cz/run.sh deleted file mode 100644 index 1788557..0000000 --- a/gen-data/tasks/locale-cz/run.sh +++ /dev/null @@ -1,5 +0,0 @@ -export task_name="locale-cz" - -export ___new_locale="LANG=cs_CZ.utf8" - -. ./tasks/templates/locale-change.sh diff --git a/gen-data/tasks/locale-utf-typo/run.sh b/gen-data/tasks/locale-utf-typo/run.sh deleted file mode 100644 index 9004a88..0000000 --- a/gen-data/tasks/locale-utf-typo/run.sh +++ /dev/null @@ -1,5 +0,0 @@ -export task_name="locale-utf-typo" - -export ___new_locale="LANG=en_US.utf8" - -. ./tasks/templates/locale-change.sh diff --git a/gen-data/tasks/templates/locale-change.sh b/gen-data/tasks/templates/locale-change.sh deleted file mode 100644 index 8f7964f..0000000 --- a/gen-data/tasks/templates/locale-change.sh +++ /dev/null @@ -1,16 +0,0 @@ -hook_start() -{ - export CHECK_LOCALE=0 - ___old_locale="$(cat /etc/locale.conf)" - echo "$___new_locale" > /etc/locale.conf -} - -hook_end() -{ - echo "$___old_locale" > /etc/locale.conf -} - -run() -{ - create_pagila -} diff --git a/get_machine b/get_machine deleted file mode 100755 index 7d4e619..0000000 --- a/get_machine +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -die() { echo "$@" ; exit 1 ; } -info() { echo " * $@" ; } - -opt_openstack_instance=os1 -opt_distro=fedora -opt_distro_version=20 - -function show_help() -{ -cat <&2 -Usage: $0 OPTION - -Script is aimed to help sysadmin. - -Options: - --distro=NAME Distro name, like fedora - --distro-version=VERSION E.g. 20 for Fedora 20 - --openstack-instance=ID -EOHELP -test -n "$1" && exit "$1" -} - -boot() -( - set -o pipefail - nova boot "$1" --poll \ - --image "$2" \ - --flavor "$3" \ - --security-groups "$os_security_group" \ - --key-name "$os_keypair" \ - | grep "| id " | cut -d\| -f 3 | xargs -n 1 -) - -get_ip() -( - id="$1" - set -o pipefail - nova show "$id" | grep ' network ' \ - | cut -d\| -f 3 | cut -d, -f2 | xargs -n 1 -) - - -longopts="distro:,distro-version:,openstack-instance:" -ARGS=$(getopt -o "" -l "help,$longopts" -n "$0" -- "$@") \ - || exit 1 -eval set -- "$ARGS" - -while true; do - case "$1" in - --distro|--distro-version|--openstack-instance) - opt=$(sed -e 's/^--//' -e 's/[^[a-zA-Z0-9]/_/g'<<<"$1") - eval "opt_$opt=\"${2,,}\"" - shift 2 - ;; - - --help) - show_help 0 - ;; - - --) - shift - break; - esac -done - -. ./parse_credsfile "$opt_openstack_instance" || exit 1 -. ./config/os/"$opt_openstack_instance.sh" || exit 1 - -image_version=$opt_distro$opt_distro_version -image=${os_image_ids[$image_version]} -flavor=${os_flavor_ids[$image_version]} - -test -z "$image" && die "no image for '$image_version'" -test -z "$flavor" && die "no flavor for '$image_version'" - -info "booting machine $image_version from $image" - -machine=$(boot "testing-$image" "$image" "$flavor") - -info "machine id: $machine" - -ip=$(get_ip "$machine") -info "ip: $ip" diff --git a/lib.sh b/lib.sh deleted file mode 100644 index b8ef034..0000000 --- a/lib.sh +++ /dev/null @@ -1,49 +0,0 @@ -# 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() -{ - local dir="$(dirname "$1")" - local name="$(basename "$1")" - - local tarball=$dir/$name.tar.gz - - pushd "$dir" >/dev/null - - local oumask="$(umask)" - umask 0077 - tar -czf "$tarball" "$name" - umask "$oumask" - - export DTF_RESULT_TARBALL=$tarball -} - -dtf_resultxml_cache() -{ - ___dtf_resultxml_cache+="$@ -" -} - -dtf_resultxml_init() -{ - ___dtf_resultxml_cache="" - ___dtf_resultxml_file="$1" - dtf_resultxml_cache "$(date --rfc-3339=seconds)" - - if test ! -f "$___dtf_resultxml_file"; then - echo '' > "$___dtf_resultxml_file" \ - || dtf_die "can not create '$___dtf_resultxml_file'" - fi -} - -dtf_resultxml_finish() -{ - dtf_resultxml_cache "" - - echo "$___dtf_resultxml_cache" >> "$___dtf_resultxml_file" \ - || dtf_die "can not write to $___dtf_resultxml_file" -} diff --git a/lib_pgsql.sh b/lib_pgsql.sh deleted file mode 100644 index 13bfc82..0000000 --- a/lib_pgsql.sh +++ /dev/null @@ -1,157 +0,0 @@ -# PostgreSQL related helper functions. - -# PostgreSQL tests require beakerlib: -# https://fedorahosted.org/beakerlib/ - -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -dtf_postgresql_check_started() -{ - service postgresql status &>/dev/null - rlAssertEquals "service postgresql should be started" $? 0 -} - -dtf_postgresql_check_stopped() -{ - service postgresql status &>/dev/null - rlAssertEquals "service postgresql should be stopped" $? 3 -} - -dtf_postgresql_phase_cleanup() -{ - rlPhaseStartCleanup - rlServiceStop postgresql - dtf_postgresql_check_stopped - rlRun "rm -rf /var/lib/pgsql/data" - rlPhaseEnd -} - -dtf_postgresql_checkphase() -{ - rlPhaseStart FAIL "Check" - rlAssertRpm postgresql-server - - dtf_postgresql_check_stopped - - rlAssertNotExists "/var/lib/pgsql/data/PG_VERSION" - - rlAssert0 "run under root user" "$(id -u)" - - rlGetPhaseState - test $? -gt 0 \ - && echo >&2 "Check phase failed." && exit 1 - rlPhaseEnd -} - -dtf_postgresql_test_init() -{ - rlJournalStart - dtf_postgresql_checkphase - rlPhaseStartTest -} - -dtf_postgresql_test_finish() -{ - rlPhaseEnd - dtf_generate_results_tarball "$BEAKERLIB_DIR" - dtf_postgresql_phase_cleanup - rlJournalEnd - rlGetTestState || return 1 -} - -dtf_postgresql_unpack_remote_data() -( - local tarball="$1" - cd /var/lib/pgsql || return 1 - set -o pipefail - echo "downloading '$tarball'" - curl "$tarball" | tar -xzf - -) - -# Detect current distribution and print set of "distro version action" lines -# where DISTRO may be rhel/fedora, VERSION may be e.g. 6.6 for rhel or 20 for -# Fedora. ACTION is either run or upgrade and it means whether currently -# installed PostgreSQL server is able to RUN the older data from DISTRO-VERSION -# or it should be first UPGRADEd. -# -# What versions are currently in Fedoras: -# f17(9.1.9); f18(9.2.5); f19(9.2.9); f20(9.3.5); f21(9.3.5); -# rawhide(9.3.5) - -dtf_postgresql_upgrade_matrix() -{ - if rlIsFedora 19; then - # echo fedora 17 upgrade - # echo fedora 18 run - echo fedora 19 run - elif rlIsFedora 20; then - # echo fedora 18 upgrade - echo fedora 19 upgrade - echo fedora 20 run - elif rlIsFedora 21; then - echo fedora 19 upgrade - echo fedora 20 run - echo fedora 21 run - elif rlIsFedora 22; then - echo fedora 19 upgrade - echo fedora 20 run - echo fedora 21 run - echo fedora 22 run - fi -} - -dtf_postgresql_cb_upgrade() -{ - local dashdash="" - if rlIsFedora 22; then - dashdash="--" - fi - rlRun "postgresql-setup $dashdash""upgrade" -} - -dtf_postgresql_cb_upgrade_select() -{ - cat -} - -dtf_postgresql_upgrade_tour() -{ - local arch=$(uname -i) - local rv=0 - - items="$(dtf_postgresql_upgrade_matrix | dtf_postgresql_cb_upgrade_select)" - test "$items" = "$(:)" && return 0 - - while read distro version action; do - echo "--> Performing upgrade: $distro-$version - $action" - - url="$1/$distro/$version/$arch/$2" - - dtf_postgresql_unpack_remote_data "$url" || return 1 - - case "$action" in - upgrade) - dtf_postgresql_cb_upgrade - if test $? -ne 0; then - rv=1 - find /var/lib/pgsql -maxdepth 1 -name '*.log' | \ - while read line; do - echo "====== reading log $line ======" - cat "$line" - done - fi - ;; - *) - ;; - esac - - rlServiceStart postgresql - dtf_postgresql_check_started - rlServiceStop postgresql - dtf_postgresql_check_stopped - - rm -rf /var/lib/pgsql/data - done <<<"$items" - - return $rv -} diff --git a/parse_credsfile b/parse_credsfile deleted file mode 100644 index df2a6bf..0000000 --- a/parse_credsfile +++ /dev/null @@ -1,14 +0,0 @@ -credsfile="private/os/$1.yml" - -while read line; do - if [[ "$line" =~ ^([a-zA-Z0-9_]*):\ ?(.*)$ ]]; then - key="${BASH_REMATCH[1]}" - if test "$key" = os_nova_password; then - key=os_password - fi - eval set ${BASH_REMATCH[2]} - eval export "${key^^}"="\"$@\"" - fi -done < "$credsfile" - -# vi: syntax=sh 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/postgresql-tests/gen-data/databases/pagila.sh b/postgresql-tests/gen-data/databases/pagila.sh new file mode 100644 index 0000000..a01d818 --- /dev/null +++ b/postgresql-tests/gen-data/databases/pagila.sh @@ -0,0 +1,39 @@ +create_pagila() +( + testit() + { + debug "testing database" + + local cmd="psql -tA -d pagila -c \"select city from city where city = 'Banjul';\"" + + out="$(admin_cmd "$cmd")" + test "$out" = Banjul || return 1 + test "$(wc -l < pagila_init.log)" -gt 335 || return 1 + + test "$({ grep ERROR | wc -l ; } < pagila_init.log)" -lt 2 + } + + debug "creating DB pagilla" + INDENT="$INDENT " + + pagila="pagila-0.10.1" + pagila_tarball="$pagila.zip" + pagila_link="http://pgfoundry.org/frs/download.php/1719/$pagila_tarball" + + cached_download $pagila_link + + debug "unzipping tarball" + unzip $pagila_tarball &>/dev/null || die "can not unzip pagila" + + pushd $pagila >/dev/null || die "can not switch directory" + admin_cmd "createdb pagila --owner postgres" || die "can't create db" + { su - postgres -c 'psql -d pagila' < pagila-schema.sql \ + && su - postgres -c 'psql -d pagila' < pagila-data.sql + } &>pagila_init.log || die "can not initialize pagila" + + cp pagila_init.log /tmp + + testit || die "can not test" + + popd >/dev/null || die "can't go back" +) diff --git a/postgresql-tests/gen-data/dist/dist b/postgresql-tests/gen-data/dist/dist new file mode 100755 index 0000000..c9aea1b --- /dev/null +++ b/postgresql-tests/gen-data/dist/dist @@ -0,0 +1,4 @@ +#!/bin/bash + +# !!!! creating tar-BOMB !!!! +tar -cf dist/dist.tar.gz -T dist/dist.list -X dist/dist.exclude diff --git a/postgresql-tests/gen-data/dist/dist.exclude b/postgresql-tests/gen-data/dist/dist.exclude new file mode 100644 index 0000000..484ab7e --- /dev/null +++ b/postgresql-tests/gen-data/dist/dist.exclude @@ -0,0 +1 @@ +results/* diff --git a/postgresql-tests/gen-data/dist/dist.list b/postgresql-tests/gen-data/dist/dist.list new file mode 100644 index 0000000..832aca4 --- /dev/null +++ b/postgresql-tests/gen-data/dist/dist.list @@ -0,0 +1,5 @@ +prep +generate +databases +tasks +results diff --git a/postgresql-tests/gen-data/generate b/postgresql-tests/gen-data/generate new file mode 100755 index 0000000..d8ead6b --- /dev/null +++ b/postgresql-tests/gen-data/generate @@ -0,0 +1,129 @@ +#!/bin/bash + +GEN_DATADIR=/var/lib/pgsql/data +CACHEDIR=/var/cache/dbt +OUTPUTDIR="$(pwd)/results" +SRCDIR="$(pwd)" +DEBUG=1 +CHECK_LOCALE=1 + +printline() { echo "$INDENT$@" ; } + +die() { printline " ERROR $@" ; exit 1 ; } + +info() { printline " * $@"; } + +debug() { test $DEBUG -eq 1 && printline " ~ $@"; } + +admin_cmd() +{ + su - postgres -c "$@" || die "can not execute '$@'" +} + +cached_download() +{ + local link=$1 + local bn="$(basename "$1")" + local file="$CACHEDIR/$bn" + + if test ! -d "$CACHEDIR"; then + mkdir -p "$CACHEDIR" || die "can't create cachedir" + fi + + test -e "$file" && cp "$file" ./ && return + + { wget "$link" && cp "$bn" "$CACHEDIR" ; } \ + || die "can't download" +} + +is_defined_f() +{ + declare -f "$1" >/dev/null +} + +run_if_defined() +{ + is_defined_f "$1" || return 0 + "$1" +} + +locale_prereq() +{ + local default_locale="LANG=en_US.UTF-8" + local current_locale="$(cat /etc/locale.conf)" + test "$current_locale" = "$default_locale" \ + || die "bad locale '$current_locale', should be '$default_locale'" +} + +single_task() +{ + local task="$1" + + info "running task $task" + + ( + INDENT=" " + . "$SRCDIR/databases/pagila.sh" || die "pagila incl fail" + . "$SRCDIR/$task" || die "include fail" + + run_if_defined "hook_start" + + test "$CHECK_LOCALE" -eq 1 && locale_prereq + + debug "initializing database" + postgresql-setup initdb &>/dev/null || die "can not initdb" + + debug "starting server" + service postgresql start &>/dev/null || die "can't start postgresql" + + tmpdir=$(mktemp -d /tmp/dbt-XXXXXX) || die "can not create temp directory" + + debug "working in $tmpdir" + pushd "$tmpdir" >/dev/null || die "can switch to $tmpdir" + + run || die "fail" + + popd >/dev/null || die "can not switch back" + + debug "stopping server" + service postgresql stop &>/dev/null || die "can't stop postgresql" + + tarball="$OUTPUTDIR/$task_name.tar.gz" + tar -czf "$tarball" -C /var/lib/pgsql/ data + info "result tarball $tarball" + rm -rf "$tmpdir" + + + debug "data removal" + rm -rf "$GEN_DATADIR" + + run_if_defined "hook_end" + ) +} + +generate_tasks() +{ + find ./tasks -name run.sh | while read line; do + single_task "$line" + done +} + +main() +{ + test "$UID" -ne 0 && die "run under 'root' user" + + test -d "$OUTPUTDIR" || die "$OUTPUTDIR does not seem to be directory" + + service postgresql status &>/dev/null + test $? -ne 3 && die "stop the postgresql server" + + local dbdir="$GEN_DATADIR" + test -e "$dbdir" && die "the '$dbdir' should not exist" + + { rpm -qa postgresql && rpm -qa postgresql-server ; } &>/dev/null \ + || die "PostgreSQL not installed" + + generate_tasks +} + +main diff --git a/postgresql-tests/gen-data/prep b/postgresql-tests/gen-data/prep new file mode 100755 index 0000000..b5b19b5 --- /dev/null +++ b/postgresql-tests/gen-data/prep @@ -0,0 +1,5 @@ +#!/bin/bash + +yum install -y wget postgresql-server unzip +echo "LANG=en_US.UTF-8" > /etc/locale.conf +rm -rf /var/lib/pgsql/data diff --git a/postgresql-tests/gen-data/remote_generate b/postgresql-tests/gen-data/remote_generate new file mode 100755 index 0000000..eee11f6 --- /dev/null +++ b/postgresql-tests/gen-data/remote_generate @@ -0,0 +1,18 @@ +#!/bin/bash -x + +where="root@$1" + +./dist/dist +tar tf dist/dist.tar.gz + +ssh_opts="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" +ssh="ssh $ssh_opts" +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/postgresql-tests/gen-data/tasks/basic/run.sh b/postgresql-tests/gen-data/tasks/basic/run.sh new file mode 100644 index 0000000..0118ad3 --- /dev/null +++ b/postgresql-tests/gen-data/tasks/basic/run.sh @@ -0,0 +1,6 @@ +export task_name="basic" + +run() +{ + create_pagila +} diff --git a/postgresql-tests/gen-data/tasks/locale-cz/run.sh b/postgresql-tests/gen-data/tasks/locale-cz/run.sh new file mode 100644 index 0000000..1788557 --- /dev/null +++ b/postgresql-tests/gen-data/tasks/locale-cz/run.sh @@ -0,0 +1,5 @@ +export task_name="locale-cz" + +export ___new_locale="LANG=cs_CZ.utf8" + +. ./tasks/templates/locale-change.sh diff --git a/postgresql-tests/gen-data/tasks/locale-utf-typo/run.sh b/postgresql-tests/gen-data/tasks/locale-utf-typo/run.sh new file mode 100644 index 0000000..9004a88 --- /dev/null +++ b/postgresql-tests/gen-data/tasks/locale-utf-typo/run.sh @@ -0,0 +1,5 @@ +export task_name="locale-utf-typo" + +export ___new_locale="LANG=en_US.utf8" + +. ./tasks/templates/locale-change.sh diff --git a/postgresql-tests/gen-data/tasks/templates/locale-change.sh b/postgresql-tests/gen-data/tasks/templates/locale-change.sh new file mode 100644 index 0000000..8f7964f --- /dev/null +++ b/postgresql-tests/gen-data/tasks/templates/locale-change.sh @@ -0,0 +1,16 @@ +hook_start() +{ + export CHECK_LOCALE=0 + ___old_locale="$(cat /etc/locale.conf)" + echo "$___new_locale" > /etc/locale.conf +} + +hook_end() +{ + echo "$___old_locale" > /etc/locale.conf +} + +run() +{ + create_pagila +} diff --git a/postgresql-tests/lib_pgsql.sh b/postgresql-tests/lib_pgsql.sh new file mode 100644 index 0000000..13bfc82 --- /dev/null +++ b/postgresql-tests/lib_pgsql.sh @@ -0,0 +1,157 @@ +# PostgreSQL related helper functions. + +# PostgreSQL tests require beakerlib: +# https://fedorahosted.org/beakerlib/ + +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +dtf_postgresql_check_started() +{ + service postgresql status &>/dev/null + rlAssertEquals "service postgresql should be started" $? 0 +} + +dtf_postgresql_check_stopped() +{ + service postgresql status &>/dev/null + rlAssertEquals "service postgresql should be stopped" $? 3 +} + +dtf_postgresql_phase_cleanup() +{ + rlPhaseStartCleanup + rlServiceStop postgresql + dtf_postgresql_check_stopped + rlRun "rm -rf /var/lib/pgsql/data" + rlPhaseEnd +} + +dtf_postgresql_checkphase() +{ + rlPhaseStart FAIL "Check" + rlAssertRpm postgresql-server + + dtf_postgresql_check_stopped + + rlAssertNotExists "/var/lib/pgsql/data/PG_VERSION" + + rlAssert0 "run under root user" "$(id -u)" + + rlGetPhaseState + test $? -gt 0 \ + && echo >&2 "Check phase failed." && exit 1 + rlPhaseEnd +} + +dtf_postgresql_test_init() +{ + rlJournalStart + dtf_postgresql_checkphase + rlPhaseStartTest +} + +dtf_postgresql_test_finish() +{ + rlPhaseEnd + dtf_generate_results_tarball "$BEAKERLIB_DIR" + dtf_postgresql_phase_cleanup + rlJournalEnd + rlGetTestState || return 1 +} + +dtf_postgresql_unpack_remote_data() +( + local tarball="$1" + cd /var/lib/pgsql || return 1 + set -o pipefail + echo "downloading '$tarball'" + curl "$tarball" | tar -xzf - +) + +# Detect current distribution and print set of "distro version action" lines +# where DISTRO may be rhel/fedora, VERSION may be e.g. 6.6 for rhel or 20 for +# Fedora. ACTION is either run or upgrade and it means whether currently +# installed PostgreSQL server is able to RUN the older data from DISTRO-VERSION +# or it should be first UPGRADEd. +# +# What versions are currently in Fedoras: +# f17(9.1.9); f18(9.2.5); f19(9.2.9); f20(9.3.5); f21(9.3.5); +# rawhide(9.3.5) + +dtf_postgresql_upgrade_matrix() +{ + if rlIsFedora 19; then + # echo fedora 17 upgrade + # echo fedora 18 run + echo fedora 19 run + elif rlIsFedora 20; then + # echo fedora 18 upgrade + echo fedora 19 upgrade + echo fedora 20 run + elif rlIsFedora 21; then + echo fedora 19 upgrade + echo fedora 20 run + echo fedora 21 run + elif rlIsFedora 22; then + echo fedora 19 upgrade + echo fedora 20 run + echo fedora 21 run + echo fedora 22 run + fi +} + +dtf_postgresql_cb_upgrade() +{ + local dashdash="" + if rlIsFedora 22; then + dashdash="--" + fi + rlRun "postgresql-setup $dashdash""upgrade" +} + +dtf_postgresql_cb_upgrade_select() +{ + cat +} + +dtf_postgresql_upgrade_tour() +{ + local arch=$(uname -i) + local rv=0 + + items="$(dtf_postgresql_upgrade_matrix | dtf_postgresql_cb_upgrade_select)" + test "$items" = "$(:)" && return 0 + + while read distro version action; do + echo "--> Performing upgrade: $distro-$version - $action" + + url="$1/$distro/$version/$arch/$2" + + dtf_postgresql_unpack_remote_data "$url" || return 1 + + case "$action" in + upgrade) + dtf_postgresql_cb_upgrade + if test $? -ne 0; then + rv=1 + find /var/lib/pgsql -maxdepth 1 -name '*.log' | \ + while read line; do + echo "====== reading log $line ======" + cat "$line" + done + fi + ;; + *) + ;; + esac + + rlServiceStart postgresql + dtf_postgresql_check_started + rlServiceStop postgresql + dtf_postgresql_check_stopped + + rm -rf /var/lib/pgsql/data + done <<<"$items" + + return $rv +} 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/postgresql-tests/tasks/initdb/config.sh b/postgresql-tests/tasks/initdb/config.sh new file mode 100644 index 0000000..c7f6619 --- /dev/null +++ b/postgresql-tests/tasks/initdb/config.sh @@ -0,0 +1,4 @@ +DTF_TEST_ID="initdb-basic" +DTF_TEST_DESCRIPTION="\ +Check that the syntax 'postgresql-setup --initdb' works together with following +'service start postgresql'." diff --git a/postgresql-tests/tasks/initdb/runtest.sh b/postgresql-tests/tasks/initdb/runtest.sh new file mode 100755 index 0000000..ee520d6 --- /dev/null +++ b/postgresql-tests/tasks/initdb/runtest.sh @@ -0,0 +1,11 @@ +dtf_postgresql_test_init +if rlIsFedora 18 19 20 21 || rlIsRHEL 5 6 7; then + # This syntaxe is not supported on oler systems. + : +else + rlRun "postgresql-setup --initdb" + rlServiceStart postgresql + dtf_postgresql_check_started +fi + +dtf_postgresql_test_finish diff --git a/postgresql-tests/tasks/initdb_old/config.sh b/postgresql-tests/tasks/initdb_old/config.sh new file mode 100644 index 0000000..2386677 --- /dev/null +++ b/postgresql-tests/tasks/initdb_old/config.sh @@ -0,0 +1,4 @@ +DTF_TEST_ID="initdb-old-syntax" +DTF_TEST_DESCRIPTION="\ +Check that the old syntax 'postgresql-setup initdb' works together with +following 'service start postgresql'." diff --git a/postgresql-tests/tasks/initdb_old/runtest.sh b/postgresql-tests/tasks/initdb_old/runtest.sh new file mode 100755 index 0000000..6a8d63c --- /dev/null +++ b/postgresql-tests/tasks/initdb_old/runtest.sh @@ -0,0 +1,5 @@ +dtf_postgresql_test_init +rlRun "postgresql-setup initdb" +rlServiceStart postgresql +dtf_postgresql_check_started +dtf_postgresql_test_finish diff --git a/postgresql-tests/tasks/upgrade-basic/config.sh b/postgresql-tests/tasks/upgrade-basic/config.sh new file mode 100644 index 0000000..a1d4a2f --- /dev/null +++ b/postgresql-tests/tasks/upgrade-basic/config.sh @@ -0,0 +1,2 @@ +export DTF_TEST_ID="basic-upgrade" +export DTF_TEST_DESCRIPTION="Check postgresql-setup [--]upgrade" diff --git a/postgresql-tests/tasks/upgrade-basic/runtest.sh b/postgresql-tests/tasks/upgrade-basic/runtest.sh new file mode 100644 index 0000000..5dd85bb --- /dev/null +++ b/postgresql-tests/tasks/upgrade-basic/runtest.sh @@ -0,0 +1,6 @@ +dtf_postgresql_test_init + +dtf_postgresql_upgrade_tour "$dtf_dataurl" basic.tar.gz +rlAssert0 "test wrapper should finish successfully" $? + +dtf_postgresql_test_finish diff --git a/postgresql-tests/tasks/upgrade-utf8-syntax/config.sh b/postgresql-tests/tasks/upgrade-utf8-syntax/config.sh new file mode 100644 index 0000000..bed95ad --- /dev/null +++ b/postgresql-tests/tasks/upgrade-utf8-syntax/config.sh @@ -0,0 +1,3 @@ +export DTF_TEST_ID="basic-locale-utf8-syntax" +export DTF_TEST_DESCRIPTION="Check postgresql-setup --upgrade works even when \ +the system locale changed from xx_XX.utf8 to xx_XX.UTF-8" diff --git a/postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh b/postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh new file mode 100644 index 0000000..9e7d9cf --- /dev/null +++ b/postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh @@ -0,0 +1,15 @@ +dtf_postgresql_test_init + +dtf_postgresql_cb_upgrade_select() +{ + if rlIsFedora 20 21 22; then + cat + else + cat >/dev/null + fi +} + +dtf_postgresql_upgrade_tour "$dtf_dataurl" locale-utf-typo.tar.gz +rlAssert0 "test wrapper should finish successfully" $? + +dtf_postgresql_test_finish diff --git a/private/os/EXAMPLE.yml b/private/os/EXAMPLE.yml deleted file mode 100644 index d44cbac..0000000 --- a/private/os/EXAMPLE.yml +++ /dev/null @@ -1,7 +0,0 @@ -## THIS IS EXAMPLE OPENSTACK CREDENTIALS FILE ## ---- -os_auth_url: http://openstack-controller.example.com:5000/v2.0 -os_tenant_id: 8289c1553643c7adf3476fb6234562c0 -os_tenant_name: Example Develpoment Group -os_username: jdoe -os_nova_password: plainPasswordKeepSecrete diff --git a/run b/run deleted file mode 100755 index 8f1b69f..0000000 --- a/run +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/bash - -## 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/ - -export dtf_resultxml_file=/var/tmp/dtf.xml - -export dtf_option_verbose=0 -export dtf_option_force=0 -export dtf_option_testids="" -export dtf_option_listonly=0 - -. "$dtf_srcdir/lib.sh" - -## F.DEFS ## - -info() -{ - echo " * $@" -} - -die() -{ - echo "$@" >&2 - exit 1 -} - -# run TESTDIR -# ----------- -# source the $TESTDIR/runtest.sh -run() -{ - export dtf_workdir=$1 - export dtf_test_id=$(basename "$dtf_workdir") - - dtf_resultxml_cache "$( cd "$dtf_workdir" - . ./config.sh - echo "" - echo "$DTF_TEST_ID" - echo "" - echo "$DTF_TEST_DESCRIPTION" - echo "" - )" - - ( cd "$dtf_workdir" - - outlog="$dtf_resultdir/$dtf_test_id.log" - output_wrapper="cat > $outlog" - - test $dtf_option_verbose = 1 \ - && output_wrapper="tee $outlog" - - test ! -e ./config.sh -o ! -e ./config.sh \ - && echo "can not find one of {config,runtest}.sh" \ - && exit 1 - - . ./config.sh - - if test "$dtf_option_listonly" -eq 1; then - echo "$DTF_TEST_ID" - exit 0 - fi - - if test -n "$dtf_option_testids"; then - [[ "$dtf_option_testids" = *\ $DTF_TEST_ID\ * ]] || exit 0 - fi - - printf "%-40s" "RUN $DTF_TEST_ID ..." - - set -o pipefail - - ( . "$dtf_srcdir/lib.sh" || exit 1 - - . ./config.sh - . ./runtest.sh - rv=$? - - test -n "$DTF_RESULT_TARBALL" \ - && 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" - - exit $rv - ) 2>&1 | eval "$output_wrapper" - rv=$? - - test $rv -eq 0 && echo "[ OK ]" || echo "[ FAIL ]" - exit $rv - ) -} - -prepare_resultdir() -{ - 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" - fi - - mkdir -p "$dtf_resultdir" || die "can not create $dtf_resultdir" -} - -show_help() -{ -cat <&2 -Usage: $0 [OPTIONS] - -Script is aimed to perform set of tests in subdirectories. - -Options: - --force Overwrite result dir if exists - --listonly List the available test ids - --testid=TESTID Perform this test only - --verbose Show complete output from each test - --help Show this help -EOHELP -test -n "$1" && exit "$1" -} - -longopts="verbose,help,force,testid:,listonly" -ARGS=$(getopt -o "v" -l "$longopts" -n "getopt" -- "$@") -if [ $? -ne 0 ]; then - echo "getopt error" - exit 1 -fi -eval set -- "$ARGS" - -while true; do - case "$1" in - --verbose) - dtf_option_verbose=1 - shift - ;; - --force) - dtf_option_force=1 - shift - ;; - --listonly) - dtf_option_listonly=1 - shift - ;; - --testid) - dtf_option_testids="$dtf_option_testids $2 " - shift 2 - ;; - --help) - show_help 0 - ;; - --) - shift - break - ;; - esac -done - -test $dtf_option_listonly -ne 1 && prepare_resultdir - -dtf_resultxml_init "$dtf_resultxml_file" -result=0 -while read i; do - testdir=$(dirname "$i") - run "$testdir" || result=1 - - if test $result -eq 0; then - dtf_resultxml_cache "Success" - else - dtf_resultxml_cache "Fail" - fi -done <<<"$(find "$dtf_testdir" -name runtest.sh)" -dtf_resultxml_finish - -exit $result diff --git a/run_remote b/run_remote deleted file mode 100755 index 39e45dd..0000000 --- a/run_remote +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash - -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_distro_ver=20 -opt_extra_rpms= - -die() { echo >&2 "$@" ; exit 1 ; } - -longopts="distro:,distro-version:,workdir:,openstack-instance:,extra-rpms-file:" -ARGS=$(getopt -o "v" -l "$longopts" -n "getopt" -- "$@") \ - || exit 1 -eval set -- "$ARGS" - -while true; do - case "$1" in - --distro) - opt_distro="$2" - shift 2 - ;; - - --distro-version) - opt_distro_ver="$2" - shift 2 - ;; - - --openstack-instance) - opt_openstack_instance="$2" - shift 2 - ;; - - --workdir) - opt_workdir="$2" - shift 2 - ;; - - --extra-rpms-file) - opt_extra_rpms="$(readlink -f "$2")" - shift 2 - ;; - - --) - shift - break - ;; - esac -done - -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" - -config_os_file="$(readlink -f "./config/os/$opt_openstack_instance.sh")" -test ! -r "$config_os_file" && die "file $config_os_file not found" -. "$config_os_file" - -config_os_id="$opt_distro$opt_distro_ver" - -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_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_extra_rpms:+dtf_rpm_files_list=$opt_extra_rpms}" diff --git a/runner/result_stats b/runner/result_stats deleted file mode 100755 index a92d6d6..0000000 --- a/runner/result_stats +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/perl - -use strict; -use warnings; -use utf8; - -use Data::Dumper; -use File::Basename; -use Cwd; -use Encode 'encode_utf8'; - -# teplates -use Text::Xslate; - -# yaml (quick) parser -use YAML::Syck; - -our $srcdir = dirname(__FILE__); - -sub html_printer -{ - my $results = $_[0]; - my $task_ids = $_[1]; - - my $xslate = Text::Xslate->new(path => ["$srcdir/result_templates"]); - - my $content = $xslate->render("html.tmpl", { - results => $results, - task_ids => $task_ids, - }); - print encode_utf8($content); -} - -my $workdir = $ARGV[0]; - -my $data = []; - -my $task_ids = {}; - -# go through *each* result directory -my $olddir = getcwd; -for (`find "$workdir" -maxdepth 1 -type d -name 'result_*'`) { - chomp; - chdir $_; - - my $run_results = {}; - $run_results->{dirname} = basename($_); - $run_results->{tasks} = {}; - $run_results->{exit_status} = 0; - - # go through each task - for (`find -maxdepth 1 -type f -name '*.result'`) { - chomp; - - (my $task_id = $_) =~ s/\.result$//; - $task_id =~ s/.*\///; - $task_ids->{$task_id} = 1; - - my $yaml_file = $_; - open my $fd, '<', $yaml_file - or die "can't open yaml file '$yaml_file'"; - - my $config = YAML::Syck::LoadFile($fd); - if ($config->{exit_status} != 0) { - $run_results->{exit_status} = 1; - } - $run_results->{tasks}->{$task_id} = $config; - } - - push @{$data}, $run_results; -} -chdir $olddir; - -html_printer $data, $task_ids; diff --git a/runner/result_templates/html.tmpl b/runner/result_templates/html.tmpl deleted file mode 100644 index 8a09ad7..0000000 --- a/runner/result_templates/html.tmpl +++ /dev/null @@ -1,42 +0,0 @@ - - - - - -Results - - - -
- - - - -: for $task_ids.keys() -> $task_id { - -: } - - -: for $results -> $result { - : if ($result.exit_status) { - - : } else { - - : } - - : for $task_ids.keys() -> $task_id { - : if (not defined($result.tasks[$task_id].exit_status)) { - - : } elsif ($result.tasks[$task_id].exit_status == 0) { - - : } else { - - : } - : } - -:} - -
Run time<: $task_id :>
<: $result.dirname :>NOT AVAILABLEOKFAIL
-
- - diff --git a/tasks/initdb/config.sh b/tasks/initdb/config.sh deleted file mode 100644 index c7f6619..0000000 --- a/tasks/initdb/config.sh +++ /dev/null @@ -1,4 +0,0 @@ -DTF_TEST_ID="initdb-basic" -DTF_TEST_DESCRIPTION="\ -Check that the syntax 'postgresql-setup --initdb' works together with following -'service start postgresql'." diff --git a/tasks/initdb/runtest.sh b/tasks/initdb/runtest.sh deleted file mode 100755 index ee520d6..0000000 --- a/tasks/initdb/runtest.sh +++ /dev/null @@ -1,11 +0,0 @@ -dtf_postgresql_test_init -if rlIsFedora 18 19 20 21 || rlIsRHEL 5 6 7; then - # This syntaxe is not supported on oler systems. - : -else - rlRun "postgresql-setup --initdb" - rlServiceStart postgresql - dtf_postgresql_check_started -fi - -dtf_postgresql_test_finish diff --git a/tasks/initdb_old/config.sh b/tasks/initdb_old/config.sh deleted file mode 100644 index 2386677..0000000 --- a/tasks/initdb_old/config.sh +++ /dev/null @@ -1,4 +0,0 @@ -DTF_TEST_ID="initdb-old-syntax" -DTF_TEST_DESCRIPTION="\ -Check that the old syntax 'postgresql-setup initdb' works together with -following 'service start postgresql'." diff --git a/tasks/initdb_old/runtest.sh b/tasks/initdb_old/runtest.sh deleted file mode 100755 index 6a8d63c..0000000 --- a/tasks/initdb_old/runtest.sh +++ /dev/null @@ -1,5 +0,0 @@ -dtf_postgresql_test_init -rlRun "postgresql-setup initdb" -rlServiceStart postgresql -dtf_postgresql_check_started -dtf_postgresql_test_finish diff --git a/tasks/upgrade-basic/config.sh b/tasks/upgrade-basic/config.sh deleted file mode 100644 index a1d4a2f..0000000 --- a/tasks/upgrade-basic/config.sh +++ /dev/null @@ -1,2 +0,0 @@ -export DTF_TEST_ID="basic-upgrade" -export DTF_TEST_DESCRIPTION="Check postgresql-setup [--]upgrade" diff --git a/tasks/upgrade-basic/runtest.sh b/tasks/upgrade-basic/runtest.sh deleted file mode 100644 index 5dd85bb..0000000 --- a/tasks/upgrade-basic/runtest.sh +++ /dev/null @@ -1,6 +0,0 @@ -dtf_postgresql_test_init - -dtf_postgresql_upgrade_tour "$dtf_dataurl" basic.tar.gz -rlAssert0 "test wrapper should finish successfully" $? - -dtf_postgresql_test_finish diff --git a/tasks/upgrade-utf8-syntax/config.sh b/tasks/upgrade-utf8-syntax/config.sh deleted file mode 100644 index bed95ad..0000000 --- a/tasks/upgrade-utf8-syntax/config.sh +++ /dev/null @@ -1,3 +0,0 @@ -export DTF_TEST_ID="basic-locale-utf8-syntax" -export DTF_TEST_DESCRIPTION="Check postgresql-setup --upgrade works even when \ -the system locale changed from xx_XX.utf8 to xx_XX.UTF-8" diff --git a/tasks/upgrade-utf8-syntax/runtest.sh b/tasks/upgrade-utf8-syntax/runtest.sh deleted file mode 100644 index 9e7d9cf..0000000 --- a/tasks/upgrade-utf8-syntax/runtest.sh +++ /dev/null @@ -1,15 +0,0 @@ -dtf_postgresql_test_init - -dtf_postgresql_cb_upgrade_select() -{ - if rlIsFedora 20 21 22; then - cat - else - cat >/dev/null - fi -} - -dtf_postgresql_upgrade_tour "$dtf_dataurl" locale-utf-typo.tar.gz -rlAssert0 "test wrapper should finish successfully" $? - -dtf_postgresql_test_finish 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/tester/libdtf/libdtf.sh b/tester/libdtf/libdtf.sh new file mode 100644 index 0000000..5724404 --- /dev/null +++ b/tester/libdtf/libdtf.sh @@ -0,0 +1,47 @@ +# package-agnostic function library. The "dtf_" prefix stands for +# "destructive test framework". + +dtf_die() { echo >&2 "$@"; exit 1; } + +dtf_generate_results_tarball() +{ + local dir="$(dirname "$1")" + local name="$(basename "$1")" + + local tarball=$dir/$name.tar.gz + + pushd "$dir" >/dev/null + + local oumask="$(umask)" + umask 0077 + tar -czf "$tarball" "$name" + umask "$oumask" + + export DTF_RESULT_TARBALL=$tarball +} + +dtf_resultxml_cache() +{ + ___dtf_resultxml_cache+="$@ +" +} + +dtf_resultxml_init() +{ + ___dtf_resultxml_cache="" + ___dtf_resultxml_file="$1" + dtf_resultxml_cache "$(date --rfc-3339=seconds)" + + if test ! -f "$___dtf_resultxml_file"; then + echo '' > "$___dtf_resultxml_file" \ + || dtf_die "can not create '$___dtf_resultxml_file'" + fi +} + +dtf_resultxml_finish() +{ + dtf_resultxml_cache "" + + echo "$___dtf_resultxml_cache" >> "$___dtf_resultxml_file" \ + || dtf_die "can not write to $___dtf_resultxml_file" +} diff --git a/tester/run b/tester/run new file mode 100755 index 0000000..55b87b8 --- /dev/null +++ b/tester/run @@ -0,0 +1,205 @@ +#!/bin/bash + +## CONFIG ## + +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 + +export dtf_option_verbose=0 +export dtf_option_force=0 +export dtf_option_testids="" +export dtf_option_listonly=0 + +. "$DTF_LIBDIR/libdtf.sh" || exit 1 + +## F.DEFS ## + +info() +{ + echo " * $@" +} + +die() +{ + echo "$@" >&2 + 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 +run() +{ + export dtf_workdir=$1 + export dtf_test_id=$(basename "$dtf_workdir") + + dtf_resultxml_cache "$( cd "$dtf_workdir" + . ./config.sh + echo "" + echo "$DTF_TEST_ID" + echo "" + echo "$DTF_TEST_DESCRIPTION" + echo "" + )" + + ( cd "$dtf_workdir" + + outlog="$DTF_RESULTDIR/$dtf_test_id.log" + output_wrapper="cat > $outlog" + + test $dtf_option_verbose = 1 \ + && output_wrapper="tee $outlog" + + test ! -e ./config.sh -o ! -e ./config.sh \ + && echo "can not find one of {config,runtest}.sh" \ + && exit 1 + + . ./config.sh + + if test "$dtf_option_listonly" -eq 1; then + echo "$DTF_TEST_ID" + exit 0 + fi + + if test -n "$dtf_option_testids"; then + [[ "$dtf_option_testids" = *\ $DTF_TEST_ID\ * ]] || exit 0 + fi + + printf "%-40s" "RUN $DTF_TEST_ID ..." + + set -o pipefail + + ( . ./config.sh + . ./runtest.sh + rv=$? + + test -n "$DTF_RESULT_TARBALL" \ + && 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" + + exit $rv + ) 2>&1 | eval "$output_wrapper" + rv=$? + + test $rv -eq 0 && echo "[ OK ]" || echo "[ FAIL ]" + exit $rv + ) +} + +prepare_resultdir() +{ + 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" + fi + + mkdir -p "$DTF_RESULTDIR" || die "can not create $DTF_RESULTDIR" +} + +show_help() +{ +cat <&2 +Usage: $0 [OPTIONS] + +Script is aimed to perform set of tests in subdirectories. + +Options: + --force Overwrite result dir if exists + --listonly List the available test ids + --testid=TESTID Perform this test only + --verbose Show complete output from each test + --help Show this help +EOHELP +test -n "$1" && exit "$1" +} + +longopts="verbose,help,force,testid:,listonly,dist" +ARGS=$(getopt -o "v" -l "$longopts" -n "getopt" -- "$@") +if [ $? -ne 0 ]; then + echo "getopt error" + exit 1 +fi +eval set -- "$ARGS" + +while true; do + case "$1" in + --verbose) + dtf_option_verbose=1 + shift + ;; + --force) + dtf_option_force=1 + shift + ;; + --listonly) + dtf_option_listonly=1 + shift + ;; + --testid) + dtf_option_testids="$dtf_option_testids $2 " + shift 2 + ;; + --help) + show_help 0 + ;; + --dist) + dist + exit $? + ;; + --) + shift + break + ;; + esac +done + +test $dtf_option_listonly -ne 1 && prepare_resultdir + +dtf_resultxml_init "$dtf_resultxml_file" +result=0 +while read i; do + testdir=$(dirname "$i") + run "$testdir" || result=1 + + if test $result -eq 0; then + dtf_resultxml_cache "Success" + else + dtf_resultxml_cache "Fail" + fi +done <<<"$(find "$DTF_TASKS" -name runtest.sh)" +dtf_resultxml_finish + +exit $result -- cgit