From 2a6faa0853239377f191cdd72efc60f1df684ebd Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Fri, 24 Oct 2014 14:29:35 +0200 Subject: tester/run: better define API Define test return values and its calling. Do not split the testcase into configuration and running script, rather use one file and wrap the script by run() method. This is still very easy to run without running whole testsuite. * tester/run (DTF_RESULT_*): Return values API. (run): Rename to run_test. Make the function more readable, don't generate xml results (not yet used anyway). * postgresql-tests/config.sh: Do not source the per-testsuite library directly as the configuration script config.h is sourced even by 'run' script itself for --dist option (for that action we actually do not need per-testsuite libraries). * postgresql-tests/tasks/initdb/runtest.sh: New API used. * postgresql-tests/tasks/initdb_old/runtest.sh: Likewise. * postgresql-tests/tasks/upgrade-basic/runtest.sh: Likewise. * postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh: Likewise. * postgresql-tests/tasks/upgrade-basic/config.sh: Remove. * postgresql-tests/tasks/initdb/config.sh: Remove. * postgresql-tests/tasks/initdb_old/config.sh: Remove. * postgresql-tests/tasks/upgrade-utf8-syntax/config.sh: Remove. --- postgresql-tests/config.sh | 8 +++--- postgresql-tests/tasks/initdb/config.sh | 4 --- postgresql-tests/tasks/initdb/runtest.sh | 29 ++++++++++++++-------- postgresql-tests/tasks/initdb_old/config.sh | 4 --- postgresql-tests/tasks/initdb_old/runtest.sh | 18 ++++++++++---- postgresql-tests/tasks/upgrade-basic/config.sh | 2 -- postgresql-tests/tasks/upgrade-basic/runtest.sh | 14 ++++++++--- .../tasks/upgrade-utf8-syntax/config.sh | 3 --- .../tasks/upgrade-utf8-syntax/runtest.sh | 29 ++++++++++++++-------- 9 files changed, 64 insertions(+), 47 deletions(-) delete mode 100644 postgresql-tests/tasks/initdb/config.sh mode change 100755 => 100644 postgresql-tests/tasks/initdb/runtest.sh delete mode 100644 postgresql-tests/tasks/initdb_old/config.sh mode change 100755 => 100644 postgresql-tests/tasks/initdb_old/runtest.sh delete mode 100644 postgresql-tests/tasks/upgrade-basic/config.sh delete mode 100644 postgresql-tests/tasks/upgrade-utf8-syntax/config.sh (limited to 'postgresql-tests') diff --git a/postgresql-tests/config.sh b/postgresql-tests/config.sh index 6650ed2..6dc859a 100644 --- a/postgresql-tests/config.sh +++ b/postgresql-tests/config.sh @@ -1,7 +1,4 @@ -# include PostgreSQL specific test-library -. "$srcdir/lib_pgsql.sh" || exit 1 - -export dtf_dataurls +export dtf_dataurls dtf_libfiles # this is needed for some tests dtf_dataurls[0]=http://172.16.125.10/root-tests/data/postgresql/ @@ -11,3 +8,6 @@ dtf_cb_dist_tasks() { tar -ch "$dir" --exclude gen-data } + +# include PostgreSQL specific test-library +dtf_libfiles[0]="$srcdir/lib_pgsql.sh" diff --git a/postgresql-tests/tasks/initdb/config.sh b/postgresql-tests/tasks/initdb/config.sh deleted file mode 100644 index c7f6619..0000000 --- a/postgresql-tests/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/postgresql-tests/tasks/initdb/runtest.sh b/postgresql-tests/tasks/initdb/runtest.sh old mode 100755 new mode 100644 index ee520d6..f8cf3a5 --- a/postgresql-tests/tasks/initdb/runtest.sh +++ b/postgresql-tests/tasks/initdb/runtest.sh @@ -1,11 +1,20 @@ -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 +export DTF_TEST_ID="initdb-basic" +export DTF_TEST_DESCRIPTION="\ +Check that the syntax 'postgresql-setup --initdb' works together with following +'service start postgresql'." + +run() +{ + 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 +} -dtf_postgresql_test_finish diff --git a/postgresql-tests/tasks/initdb_old/config.sh b/postgresql-tests/tasks/initdb_old/config.sh deleted file mode 100644 index 2386677..0000000 --- a/postgresql-tests/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/postgresql-tests/tasks/initdb_old/runtest.sh b/postgresql-tests/tasks/initdb_old/runtest.sh old mode 100755 new mode 100644 index 6a8d63c..1cd77f4 --- a/postgresql-tests/tasks/initdb_old/runtest.sh +++ b/postgresql-tests/tasks/initdb_old/runtest.sh @@ -1,5 +1,13 @@ -dtf_postgresql_test_init -rlRun "postgresql-setup initdb" -rlServiceStart postgresql -dtf_postgresql_check_started -dtf_postgresql_test_finish +export DTF_TEST_ID="initdb-old-syntax" +export DTF_TEST_DESCRIPTION="\ +Check that the old syntax 'postgresql-setup initdb' works together with +following 'service start postgresql'." + +run() +{ + 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 deleted file mode 100644 index a1d4a2f..0000000 --- a/postgresql-tests/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/postgresql-tests/tasks/upgrade-basic/runtest.sh b/postgresql-tests/tasks/upgrade-basic/runtest.sh index 37af60e..7952fe0 100644 --- a/postgresql-tests/tasks/upgrade-basic/runtest.sh +++ b/postgresql-tests/tasks/upgrade-basic/runtest.sh @@ -1,6 +1,12 @@ -dtf_postgresql_test_init +export DTF_TEST_ID="basic-upgrade" +export DTF_TEST_DESCRIPTION="Check postgresql-setup [--]upgrade" -dtf_postgresql_upgrade_tour "$(dtf_postgresql_data_mirror)" basic.tar.gz -rlAssert0 "test wrapper should finish successfully" $? +run() +{ + dtf_postgresql_test_init -dtf_postgresql_test_finish + dtf_postgresql_upgrade_tour "$(dtf_postgresql_data_mirror)" 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 deleted file mode 100644 index bed95ad..0000000 --- a/postgresql-tests/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/postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh b/postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh index cc8f8c4..c14a34e 100644 --- a/postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh +++ b/postgresql-tests/tasks/upgrade-utf8-syntax/runtest.sh @@ -1,15 +1,22 @@ -dtf_postgresql_test_init +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" -dtf_postgresql_cb_upgrade_select() +run() { - if rlIsFedora 20 21 22; then - cat - else - cat >/dev/null - fi -} + 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_postgresql_data_mirror)" locale-utf-typo.tar.gz -rlAssert0 "test wrapper should finish successfully" $? + dtf_postgresql_upgrade_tour "$(dtf_postgresql_data_mirror)" locale-utf-typo.tar.gz + rlAssert0 "test wrapper should finish successfully" $? -dtf_postgresql_test_finish + dtf_postgresql_test_finish +} -- cgit