This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch 
108-integration-tests-not-idempotent-and-self-contained
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit f075c1c492302ad0004e973f66a8b288b72aa77e
Author: Tristan Maat <[email protected]>
AuthorDate: Mon Oct 16 14:28:20 2017 +0100

    Make tests run in tmp directory
---
 integration-tests/autotools-test/run-autotools-test.sh   |  2 +-
 integration-tests/bzr-test/run-bzr-test.sh               |  2 +-
 integration-tests/cmake-test/run-cmake-test.sh           |  2 +-
 integration-tests/compose-test/run-compose-test.sh       |  2 +-
 integration-tests/dpkg-build-test/run-dpkg-build-test.sh |  2 +-
 integration-tests/import-test/run-import-test.sh         |  2 +-
 integration-tests/local-test/run-local-test.sh           |  2 +-
 integration-tests/manual-test/run-manual-test.sh         |  2 +-
 integration-tests/pip-test/run-pip-test.sh               |  2 +-
 integration-tests/run-test.sh                            | 13 +++++++++----
 integration-tests/script-test/run-script-test.sh         |  2 +-
 integration-tests/shell-test/run-shell-test.sh           |  2 +-
 integration-tests/stack-test/run-stack-test.sh           |  2 +-
 13 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/integration-tests/autotools-test/run-autotools-test.sh 
b/integration-tests/autotools-test/run-autotools-test.sh
old mode 100644
new mode 100755
index d2d247c..ab10b73
--- a/integration-tests/autotools-test/run-autotools-test.sh
+++ b/integration-tests/autotools-test/run-autotools-test.sh
@@ -29,7 +29,7 @@ run_test () {
        local total=0
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        tar_file="$(dirname "$(readlink -f "$0")")/src/amhello.tar.gz"
        bst_file="$(dirname "$(readlink -f "$0")")/elements/amhello.bst"
diff --git a/integration-tests/bzr-test/run-bzr-test.sh 
b/integration-tests/bzr-test/run-bzr-test.sh
old mode 100644
new mode 100755
index 1a4a21e..4d4284b
--- a/integration-tests/bzr-test/run-bzr-test.sh
+++ b/integration-tests/bzr-test/run-bzr-test.sh
@@ -29,7 +29,7 @@ run_test () {
        local total=0
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        tar_file="$(dirname "$(readlink -f "$0")")/src"
        bst_file="$(dirname "$(readlink -f "$0")")/elements/bzr-test.bst"
diff --git a/integration-tests/cmake-test/run-cmake-test.sh 
b/integration-tests/cmake-test/run-cmake-test.sh
old mode 100644
new mode 100755
index cf3c3db..b0f0244
--- a/integration-tests/cmake-test/run-cmake-test.sh
+++ b/integration-tests/cmake-test/run-cmake-test.sh
@@ -24,7 +24,7 @@ run_test () {
        local total=2
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        ###############################################################
        ### Setup
diff --git a/integration-tests/compose-test/run-compose-test.sh 
b/integration-tests/compose-test/run-compose-test.sh
old mode 100644
new mode 100755
index 7dfe194..b72352d
--- a/integration-tests/compose-test/run-compose-test.sh
+++ b/integration-tests/compose-test/run-compose-test.sh
@@ -29,7 +29,7 @@ run_test () {
        local total=0
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        tar_file="$(dirname "$(readlink -f "$0")")/src/amhello.tar.gz"
        bst_file="$(dirname "$(readlink -f 
"$0")")/elements/dependencies/amhello.bst"
diff --git a/integration-tests/dpkg-build-test/run-dpkg-build-test.sh 
b/integration-tests/dpkg-build-test/run-dpkg-build-test.sh
index eb78c3f..f8f1561 100755
--- a/integration-tests/dpkg-build-test/run-dpkg-build-test.sh
+++ b/integration-tests/dpkg-build-test/run-dpkg-build-test.sh
@@ -69,7 +69,7 @@ run_test () {
        local total=0
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        mkdir -p "$TEST_DIR"
        elements="$(find "$TEST_DIR" -maxdepth 1 -type f)"
diff --git a/integration-tests/import-test/run-import-test.sh 
b/integration-tests/import-test/run-import-test.sh
old mode 100644
new mode 100755
index 3b4472f..4dd4939
--- a/integration-tests/import-test/run-import-test.sh
+++ b/integration-tests/import-test/run-import-test.sh
@@ -27,7 +27,7 @@ run_test () {
        local total=0
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        mkdir -p "$TEST_DIR"
        elements="$(find "$TEST_DIR" -maxdepth 1 -type f)"
diff --git a/integration-tests/local-test/run-local-test.sh 
b/integration-tests/local-test/run-local-test.sh
old mode 100644
new mode 100755
index 4169a4a..d89d5c2
--- a/integration-tests/local-test/run-local-test.sh
+++ b/integration-tests/local-test/run-local-test.sh
@@ -29,7 +29,7 @@ run_test () {
        local total=0
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        mkdir -p "$TEST_DIR"
        elements="$(find "$TEST_DIR" -maxdepth 1 -type f)"
diff --git a/integration-tests/manual-test/run-manual-test.sh 
b/integration-tests/manual-test/run-manual-test.sh
old mode 100644
new mode 100755
index 3b4472f..4dd4939
--- a/integration-tests/manual-test/run-manual-test.sh
+++ b/integration-tests/manual-test/run-manual-test.sh
@@ -27,7 +27,7 @@ run_test () {
        local total=0
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        mkdir -p "$TEST_DIR"
        elements="$(find "$TEST_DIR" -maxdepth 1 -type f)"
diff --git a/integration-tests/pip-test/run-pip-test.sh 
b/integration-tests/pip-test/run-pip-test.sh
old mode 100644
new mode 100755
index 42f408b..ffbd7c8
--- a/integration-tests/pip-test/run-pip-test.sh
+++ b/integration-tests/pip-test/run-pip-test.sh
@@ -29,7 +29,7 @@ run_test () {
        local total=0
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        tar_file="$(dirname "$(readlink -f "$0")")/src/hello.tar.xz"
        bst_file="$(dirname "$(readlink -f "$0")")/elements/hello.bst"
diff --git a/integration-tests/run-test.sh b/integration-tests/run-test.sh
index c9556eb..72612db 100755
--- a/integration-tests/run-test.sh
+++ b/integration-tests/run-test.sh
@@ -42,8 +42,8 @@ main () {
                case "${1:-}" in
                        "test")
                                shift
-                               configure
                                clean "$@"
+                               configure
                                run "$@"
                                break ;;
                        "run")
@@ -94,6 +94,7 @@ artifactdir: "$(pwd)/tmp/artifacts"
 logdir: "$(pwd)/tmp/logs"
 EOF
         CONFIG_LOCATION="$(pwd)/buildstream.conf"
+
         export CONFIG_LOCATION
 }
 
@@ -157,14 +158,16 @@ run () {
 clean () {
        local dir
 
+       rm -f "buildstream.conf"
+       rm -rf "tmp"
+
        for dir in *;
        do
                if [ -d "$dir" ]
                then
                        (cd "$dir" || exit 1
                         rm -rf "results/"*
-                        rm -rf ".bst/"
-                        rm -rf "$(pwd)/tmp/")
+                        rm -rf ".bst/")
                fi
        done
 }
@@ -178,12 +181,14 @@ clean () {
 #
 run-test () {
        local test="$1"
+       mkdir -p "$(pwd)/tmp/tests/"
+       cp -r "$test" "$(pwd)/tmp/tests/"
 
        echo "============================================================"
        echo "Running tests for test case '$test'"
        echo "============================================================"
 
-       (cd "$test" || exit 1
+       (cd "$(pwd)/tmp/tests/$test" || exit 1
         bash "run-$(basename "$test").sh")
 
        if [ ! "$?" -eq 0 ]
diff --git a/integration-tests/script-test/run-script-test.sh 
b/integration-tests/script-test/run-script-test.sh
old mode 100644
new mode 100755
index 3b4472f..4dd4939
--- a/integration-tests/script-test/run-script-test.sh
+++ b/integration-tests/script-test/run-script-test.sh
@@ -27,7 +27,7 @@ run_test () {
        local total=0
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        mkdir -p "$TEST_DIR"
        elements="$(find "$TEST_DIR" -maxdepth 1 -type f)"
diff --git a/integration-tests/shell-test/run-shell-test.sh 
b/integration-tests/shell-test/run-shell-test.sh
old mode 100644
new mode 100755
index 4de4b4a..cfc5e8e
--- a/integration-tests/shell-test/run-shell-test.sh
+++ b/integration-tests/shell-test/run-shell-test.sh
@@ -5,7 +5,7 @@
 ECHO_TEST_KEY="1234567890abcdefghijklmnopqrstuvwzyz"
 
 set -eu
-source ../lib.sh
+source ../../../lib.sh
 
 assert_expected_key () {
 
diff --git a/integration-tests/stack-test/run-stack-test.sh 
b/integration-tests/stack-test/run-stack-test.sh
old mode 100644
new mode 100755
index 3b4472f..4dd4939
--- a/integration-tests/stack-test/run-stack-test.sh
+++ b/integration-tests/stack-test/run-stack-test.sh
@@ -27,7 +27,7 @@ run_test () {
        local total=0
        local exit
 
-       source ../lib.sh
+       source ../../../lib.sh
 
        mkdir -p "$TEST_DIR"
        elements="$(find "$TEST_DIR" -maxdepth 1 -type f)"

Reply via email to