From 81203b63e0cdbe3ed0b0696168a79764816b047f Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Mon, 20 Nov 2017 21:00:00 +0900 Subject: integration-tests: Adding a compose test ensuring removed files in integration are removed --- .../elements/compose-integration-remove.bst | 5 ++++ .../elements/dependencies/amhello-full.bst | 11 +++++++ .../elements/dependencies/integrate-remove-doc.bst | 10 +++++++ integration-tests/compose-test/run-compose-test.sh | 35 ++++++++++++++++++---- 4 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 integration-tests/compose-test/elements/compose-integration-remove.bst create mode 100644 integration-tests/compose-test/elements/dependencies/amhello-full.bst create mode 100644 integration-tests/compose-test/elements/dependencies/integrate-remove-doc.bst diff --git a/integration-tests/compose-test/elements/compose-integration-remove.bst b/integration-tests/compose-test/elements/compose-integration-remove.bst new file mode 100644 index 000000000..5e2b1645c --- /dev/null +++ b/integration-tests/compose-test/elements/compose-integration-remove.bst @@ -0,0 +1,5 @@ +kind: compose + +depends: +- filename: dependencies/integrate-remove-doc.bst + type: build diff --git a/integration-tests/compose-test/elements/dependencies/amhello-full.bst b/integration-tests/compose-test/elements/dependencies/amhello-full.bst new file mode 100644 index 000000000..29e94bffb --- /dev/null +++ b/integration-tests/compose-test/elements/dependencies/amhello-full.bst @@ -0,0 +1,11 @@ +kind: autotools +description: Autotools test + +depends: +- dependencies/base-platform.bst +- dependencies/base-sdk.bst + +sources: +- kind: tar + url: file:///home/tristanmaat/Documents/Projects/buildstream/buildstream-tests/compose-test/src/amhello.tar.gz + ref: 3aa3c2bf7a488fea24303c4d98d1b5c0a72734f61615b935cf62e4e126b127d2 diff --git a/integration-tests/compose-test/elements/dependencies/integrate-remove-doc.bst b/integration-tests/compose-test/elements/dependencies/integrate-remove-doc.bst new file mode 100644 index 000000000..382e2e5c4 --- /dev/null +++ b/integration-tests/compose-test/elements/dependencies/integrate-remove-doc.bst @@ -0,0 +1,10 @@ +kind: stack +description: remove the docs with an integration command + +depends: +- dependencies/amhello-full.bst + +public: + bst: + integration-commands: + - rm -rf /usr/share/doc/amhello diff --git a/integration-tests/compose-test/run-compose-test.sh b/integration-tests/compose-test/run-compose-test.sh index 7dfe19404..5a6aa6298 100644 --- a/integration-tests/compose-test/run-compose-test.sh +++ b/integration-tests/compose-test/run-compose-test.sh @@ -22,7 +22,8 @@ run_test () { local elements local element_name local test_dir - local bst_file + local bst_file1 + local bst_file2 local tar_file local successes=0 @@ -32,9 +33,11 @@ run_test () { source ../lib.sh tar_file="$(dirname "$(readlink -f "$0")")/src/amhello.tar.gz" - bst_file="$(dirname "$(readlink -f "$0")")/elements/dependencies/amhello.bst" + bst_file1="$(dirname "$(readlink -f "$0")")/elements/dependencies/amhello.bst" + bst_file2="$(dirname "$(readlink -f "$0")")/elements/dependencies/amhello-full.bst" - patch_file_location "$bst_file" "$tar_file" + patch_file_location "$bst_file1" "$tar_file" + patch_file_location "$bst_file2" "$tar_file" # Get rid of .gitkeep files find . -name ".gitkeep" -exec rm {} \; @@ -56,8 +59,30 @@ run_test () { bst_with_flags build "$element_name".bst bst_with_flags checkout "$element_name".bst "$test_dir" - exit=0 - compare_results "$element_name" "$RESULTS" "$EXPECTED" || exit=$? + # XXX Special case for compose-integration-remove, dont + # use the automated compare_results for this because + # we dont want to commit a huge result set to compare + # + # Instead just check for the presence of some files + # and assert that the result has properly removed some + # files due to integration commands removing them. + # + if [ "${element_name}" == "compose-integration-remove" ]; then + if [ -e "${test_dir}/usr/share/doc/amhello" ]; then + # This is a failure if the directory which was removed + # by the integration commands still exists + exit=1 + else + exit=0 + fi + report_results "${element_name}" $exit + else + # The rest of the tests here use the weird comparison + # of exactness in the checkout results + exit=0 + compare_results "$element_name" "$RESULTS" "$EXPECTED" || exit=$? + fi + if [ $exit == 0 ] then successes=$((successes + 1)) -- cgit v1.2.1