From 183a9125fdfe7892d1c9bda59c3680537e928829 Mon Sep 17 00:00:00 2001 From: Tristan Van Berkom Date: Sat, 14 Oct 2017 19:05:12 +0900 Subject: Merging integration tests into buildstream proper. This fixes #96 --- .gitignore | 3 + .gitlab-ci.yml | 18 +- integration-tests/.omit | 3 + .../autotools-test/elements/amhello-run.bst | 12 + .../autotools-test/elements/amhello.bst | 13 + .../elements/dependencies/base-platform.bst | 23 ++ .../elements/dependencies/base-sdk.bst | 20 ++ .../autotools-test/expected/amhello-run/test | 2 + .../autotools-test/expected/amhello/usr/bin/hello | Bin 0 -> 4400 bytes .../expected/amhello/usr/lib/debug/hello | Bin 0 -> 11112 bytes .../expected/amhello/usr/share/doc/amhello/README | 2 + .../autotools-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/autotools-test/project.conf | 14 ++ .../autotools-test/run-autotools-test.sh | 70 ++++++ .../autotools-test/src/amhello.tar.gz | Bin 0 -> 30507 bytes integration-tests/bzr-test/elements/bzr-test.bst | 19 ++ .../elements/dependencies/base-platform.bst | 23 ++ .../bzr-test/elements/dependencies/base-sdk.bst | 20 ++ integration-tests/bzr-test/expected/bzr-test/test | 1 + integration-tests/bzr-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/bzr-test/project.conf | 14 ++ integration-tests/bzr-test/run-bzr-test.sh | 70 ++++++ integration-tests/bzr-test/src/.bzr/README | 3 + integration-tests/bzr-test/src/.bzr/branch-format | 1 + .../bzr-test/src/.bzr/repository/format | 1 + .../indices/6fad9644bfab38c89a8c6dbd6bdcaec1.cix | Bin 0 -> 148 bytes .../indices/6fad9644bfab38c89a8c6dbd6bdcaec1.iix | Bin 0 -> 185 bytes .../indices/6fad9644bfab38c89a8c6dbd6bdcaec1.rix | Bin 0 -> 186 bytes .../indices/6fad9644bfab38c89a8c6dbd6bdcaec1.six | 5 + .../indices/6fad9644bfab38c89a8c6dbd6bdcaec1.tix | Bin 0 -> 207 bytes .../indices/e8975cb14db47e36ae3f979cfea23219.cix | 9 + .../indices/e8975cb14db47e36ae3f979cfea23219.iix | Bin 0 -> 164 bytes .../indices/e8975cb14db47e36ae3f979cfea23219.rix | Bin 0 -> 165 bytes .../indices/e8975cb14db47e36ae3f979cfea23219.six | 5 + .../indices/e8975cb14db47e36ae3f979cfea23219.tix | Bin 0 -> 218 bytes .../bzr-test/src/.bzr/repository/pack-names | Bin 0 -> 171 bytes .../packs/6fad9644bfab38c89a8c6dbd6bdcaec1.pack | Bin 0 -> 920 bytes .../packs/e8975cb14db47e36ae3f979cfea23219.pack | Bin 0 -> 1025 bytes .../bzr-test/src/.bzr/repository/shared-storage | 0 integration-tests/bzr-test/src/trunk/.bzr/README | 3 + .../bzr-test/src/trunk/.bzr/branch-format | 1 + .../bzr-test/src/trunk/.bzr/branch/branch.conf | 0 .../bzr-test/src/trunk/.bzr/branch/format | 1 + .../bzr-test/src/trunk/.bzr/branch/last-revision | 1 + .../bzr-test/src/trunk/.bzr/branch/tags | 0 .../bzr-test/src/trunk/.bzr/checkout/conflicts | 1 + .../bzr-test/src/trunk/.bzr/checkout/dirstate | Bin 0 -> 526 bytes .../bzr-test/src/trunk/.bzr/checkout/format | 1 + .../bzr-test/src/trunk/.bzr/checkout/views | 0 integration-tests/bzr-test/src/trunk/test | 3 + .../elements/dependencies/base-platform.bst | 23 ++ .../cmake-test/elements/dependencies/base-sdk.bst | 20 ++ .../cmake-test/elements/step7-run.bst | 12 + integration-tests/cmake-test/elements/step7.bst | 13 + .../cmake-test/expected/step7-run/test | 11 + .../cmake-test/expected/step7/usr/bin/Tutorial | Bin 0 -> 6080 bytes .../expected/step7/usr/include/MathFunctions.h | 1 + .../expected/step7/usr/include/TutorialConfig.h | 9 + .../expected/step7/usr/lib/debug/Tutorial | Bin 0 -> 9568 bytes integration-tests/cmake-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/cmake-test/project.conf | 14 ++ integration-tests/cmake-test/run-cmake-test.sh | 89 +++++++ integration-tests/cmake-test/src/step7.tar.gz | Bin 0 -> 2742 bytes .../compose-test/elements/compose-all-test.bst | 16 ++ .../elements/compose-exclude-debug.bst | 11 + .../compose-test/elements/compose-no-debug.bst | 14 ++ .../compose-test/elements/compose-no-devel.bst | 14 ++ .../compose-test/elements/compose-no-doc.bst | 14 ++ .../compose-test/elements/compose-no-locale.bst | 14 ++ .../compose-test/elements/compose-no-test.bst | 15 ++ .../compose-test/elements/compose-only-runtime.bst | 9 + .../elements/dependencies/amhello-run.bst | 14 ++ .../compose-test/elements/dependencies/amhello.bst | 13 + .../elements/dependencies/base-platform.bst | 23 ++ .../elements/dependencies/base-sdk.bst | 20 ++ .../elements/dependencies/devel-run.bst | 11 + .../elements/dependencies/locale-run.bst | 11 + .../expected/compose-all-test/tests/test | 3 + .../expected/compose-all-test/usr/bin/hello | Bin 0 -> 4400 bytes .../expected/compose-all-test/usr/lib/debug/hello | Bin 0 -> 11112 bytes .../compose-all-test/usr/share/doc/amhello/README | 2 + .../expected/compose-exclude-debug/tests/test | 3 + .../expected/compose-exclude-debug/usr/bin/hello | Bin 0 -> 4400 bytes .../compose-exclude-debug/usr/lib/.gitkeep | 0 .../usr/share/doc/amhello/README | 2 + .../expected/compose-no-debug/usr/bin/hello | Bin 0 -> 4400 bytes .../expected/compose-no-debug/usr/lib/.gitkeep | 0 .../compose-no-debug/usr/share/doc/amhello/README | 2 + .../expected/compose-no-devel/usr/bin/hello | Bin 0 -> 4400 bytes .../expected/compose-no-devel/usr/lib/debug/hello | Bin 0 -> 11112 bytes .../compose-no-devel/usr/share/doc/amhello/README | 2 + .../expected/compose-no-doc/usr/bin/hello | Bin 0 -> 4400 bytes .../expected/compose-no-doc/usr/lib/debug/hello | Bin 0 -> 11112 bytes .../expected/compose-no-doc/usr/share/.gitkeep | 0 .../expected/compose-no-locale/usr/bin/hello | Bin 0 -> 4400 bytes .../expected/compose-no-locale/usr/lib/debug/hello | Bin 0 -> 11112 bytes .../compose-no-locale/usr/share/doc/amhello/README | 2 + .../expected/compose-no-test/usr/bin/hello | Bin 0 -> 4400 bytes .../expected/compose-no-test/usr/lib/debug/hello | Bin 0 -> 11112 bytes .../compose-no-test/usr/share/doc/amhello/README | 2 + .../expected/compose-only-runtime/usr/bin/hello | Bin 0 -> 4400 bytes .../expected/compose-only-runtime/usr/lib/.gitkeep | 0 .../compose-only-runtime/usr/share/.gitkeep | 0 integration-tests/compose-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/compose-test/project.conf | 19 ++ integration-tests/compose-test/run-compose-test.sh | 73 ++++++ integration-tests/compose-test/src/amhello.tar.gz | Bin 0 -> 30507 bytes .../dpkg-build-test/.bst/workspaces.yml | 0 .../elements/dependencies/base-configure.bst | 28 +++ .../elements/dependencies/base-platform.bst | 23 ++ .../elements/dependencies/base-system.bst | 13 + .../dpkg-build-test/elements/dpkg-build-test.bst | 10 + .../dpkg-build-test/elements/dpkg-deploy-test.bst | 12 + .../usr/share/doc/test/changelog.gz | Bin 0 -> 132 bytes .../expected/dpkg-build-test/usr/share/foo | 0 .../expected/dpkg-deploy-test/test_0.1_amd64.deb | Bin 0 -> 912 bytes .../dpkg-build-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/dpkg-build-test/project.conf | 14 ++ .../dpkg-build-test/run-dpkg-build-test.sh | 110 +++++++++ integration-tests/dpkg-build-test/src/Makefile | 9 + .../dpkg-build-test/src/debian/changelog | 5 + .../dpkg-build-test/src/debian/compat | 1 + .../dpkg-build-test/src/debian/control | 5 + integration-tests/dpkg-build-test/src/debian/rules | 3 + .../dpkg-build-test/src/debian/test.install | 1 + .../elements/dependencies/base-platform.bst | 23 ++ .../git-test/elements/dependencies/base-sdk.bst | 20 ++ integration-tests/git-test/elements/git-test.bst | 19 ++ .../git-test/expected/out-git-test/test | 1 + integration-tests/git-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/git-test/project.conf | 14 ++ integration-tests/git-test/run-git-test.sh | 70 ++++++ .../import-test/elements/import-src-test.bst | 9 + .../import-test/elements/import-sub-test.bst | 9 + .../import-test/elements/import-test.bst | 9 + .../import-test/elements/import-tgt-test.bst | 9 + .../expected/import-src-test/sub-test.txt | 1 + .../expected/import-sub-test/sub-test.txt | 1 + .../expected/import-test/sub-test/sub-test.txt | 1 + .../import-test/expected/import-test/test.txt | 1 + .../import-tgt-test/output/sub-test/sub-test.txt | 1 + .../expected/import-tgt-test/output/test.txt | 1 + integration-tests/import-test/project.conf | 11 + integration-tests/import-test/run-import-test.sh | 63 +++++ .../import-test/source/sub-test/sub-test.txt | 1 + integration-tests/import-test/source/test.txt | 1 + integration-tests/lib.sh | 185 ++++++++++++++ .../elements/dependencies/base-platform.bst | 23 ++ .../local-test/elements/dependencies/base-sdk.bst | 20 ++ .../local-test/elements/local-test.bst | 18 ++ .../local-test/expected/local-test/test | 1 + integration-tests/local-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/local-test/project.conf | 14 ++ integration-tests/local-test/run-local-test.sh | 65 +++++ integration-tests/local-test/src/test | 2 + .../elements/dependencies/base-platform.bst | 23 ++ .../elements/manual-environment-test.bst | 21 ++ .../elements/manual-noparallel-test.bst | 20 ++ .../manual-test/elements/manual-test.bst | 20 ++ .../expected/manual-environment-test/test | 2 + .../expected/manual-noparallel-test/test | 2 + .../manual-test/expected/manual-test/test | 4 + integration-tests/manual-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/manual-test/project.conf | 14 ++ integration-tests/manual-test/run-manual-test.sh | 63 +++++ .../elements/dependencies/base-platform.bst | 23 ++ .../ostree-test/elements/dependencies/base-sdk.bst | 20 ++ .../ostree-test/elements/ostree-test.bst | 20 ++ .../ostree-test/expected/ostree-test/test | 1 + integration-tests/ostree-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/ostree-test/project.conf | 14 ++ integration-tests/ostree-test/run-ostree-test.sh | 71 ++++++ integration-tests/ostree-test/src/config | 3 + ...2580fe71b3b43e63ee91ed8be6082a035f7b4b4.dirmeta | Bin 0 -> 12 bytes ...d48124c2e69ed88a39f02753009d6575583e95d052.file | 2 + ...bb0877ae17e12abc77734c5253dcd1317b3cbc2.dirtree | Bin 0 -> 40 bytes ...671512e71897eacc2fc198c98d3af69fcdf59f11.commit | Bin 0 -> 102 bytes integration-tests/ostree-test/src/refs/heads/test | 1 + integration-tests/ostree-test/tree/test | 2 + .../elements/dependencies/base-platform.bst | 22 ++ .../pip-test/elements/dependencies/base-sdk.bst | 19 ++ integration-tests/pip-test/elements/hello-run.bst | 14 ++ integration-tests/pip-test/elements/hello.bst | 16 ++ integration-tests/pip-test/expected/hello-run/test | 1 + .../pip-test/expected/hello/usr/bin/hello | 10 + .../hello-0.1-py3.5.egg-info/PKG-INFO | 10 + .../hello-0.1-py3.5.egg-info/SOURCES.txt | 6 + .../hello-0.1-py3.5.egg-info/dependency_links.txt | 1 + .../hello-0.1-py3.5.egg-info/entry_points.txt | 3 + .../hello-0.1-py3.5.egg-info/installed-files.txt | 8 + .../hello-0.1-py3.5.egg-info/top_level.txt | 1 + .../lib/python3.5/site-packages/hello/__init__.py | 12 + .../hello/__pycache__/__init__.cpython-35.pyc | Bin 0 -> 582 bytes integration-tests/pip-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/pip-test/project.conf | 14 ++ integration-tests/pip-test/run-pip-test.sh | 78 ++++++ integration-tests/pip-test/src/hello.tar.xz | Bin 0 -> 628 bytes integration-tests/run-test.sh | 273 +++++++++++++++++++++ .../elements/dependencies/base-platform.bst | 23 ++ .../script-test/elements/script-cwd-test.bst | 14 ++ .../script-test/elements/script-layout-test.bst | 23 ++ .../script-test/elements/script-no-root-test.bst | 12 + .../script-test/elements/script-root-test.bst | 14 ++ .../script-test/elements/script-test.bst | 11 + .../script-test/expected/script-cwd-test/test | 1 + .../script-test/expected/script-layout-test/test | 1 + .../script-test/expected/script-no-root-test/test | 1 + .../script-test/expected/script-root-test/test | 1 + .../script-test/expected/script-test/test | 1 + integration-tests/script-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/script-test/project.conf | 14 ++ integration-tests/script-test/run-script-test.sh | 63 +++++ integration-tests/shell-test/.bst/workspaces.yml | 0 .../elements/dependencies/base-platform.bst | 23 ++ integration-tests/shell-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/shell-test/project.conf | 14 ++ integration-tests/shell-test/run-shell-test.sh | 58 +++++ .../elements/dependencies/another-hi.bst | 11 + .../elements/dependencies/base-platform.bst | 23 ++ .../stack-test/elements/dependencies/hi.bst | 11 + .../stack-test/elements/stack-test.bst | 6 + .../stack-test/expected/stack-test/another-hi | 1 + .../stack-test/expected/stack-test/hi | 1 + integration-tests/stack-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/stack-test/project.conf | 11 + integration-tests/stack-test/run-stack-test.sh | 63 +++++ .../elements/dependencies/base-platform.bst | 23 ++ .../tar-test/elements/dependencies/base-sdk.bst | 20 ++ integration-tests/tar-test/elements/tar-test.bst | 18 ++ integration-tests/tar-test/expected/tar-test/test | 1 + integration-tests/tar-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/tar-test/project.conf | 14 ++ integration-tests/tar-test/run-tar-test.sh | 70 ++++++ integration-tests/tar-test/src.tar.gz | Bin 0 -> 196 bytes .../elements/dependencies/base-platform.bst | 23 ++ .../x86image-test/elements/x86-test.bst | 10 + integration-tests/x86image-test/keys/gnome-sdk.gpg | Bin 0 -> 629 bytes integration-tests/x86image-test/project.conf | 11 + .../x86image-test/run-x86image-test.sh | 63 +++++ 239 files changed, 3148 insertions(+), 10 deletions(-) create mode 100644 integration-tests/.omit create mode 100644 integration-tests/autotools-test/elements/amhello-run.bst create mode 100644 integration-tests/autotools-test/elements/amhello.bst create mode 100644 integration-tests/autotools-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/autotools-test/elements/dependencies/base-sdk.bst create mode 100644 integration-tests/autotools-test/expected/amhello-run/test create mode 100755 integration-tests/autotools-test/expected/amhello/usr/bin/hello create mode 100644 integration-tests/autotools-test/expected/amhello/usr/lib/debug/hello create mode 100644 integration-tests/autotools-test/expected/amhello/usr/share/doc/amhello/README create mode 100644 integration-tests/autotools-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/autotools-test/project.conf create mode 100644 integration-tests/autotools-test/run-autotools-test.sh create mode 100644 integration-tests/autotools-test/src/amhello.tar.gz create mode 100644 integration-tests/bzr-test/elements/bzr-test.bst create mode 100644 integration-tests/bzr-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/bzr-test/elements/dependencies/base-sdk.bst create mode 100644 integration-tests/bzr-test/expected/bzr-test/test create mode 100644 integration-tests/bzr-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/bzr-test/project.conf create mode 100644 integration-tests/bzr-test/run-bzr-test.sh create mode 100644 integration-tests/bzr-test/src/.bzr/README create mode 100644 integration-tests/bzr-test/src/.bzr/branch-format create mode 100644 integration-tests/bzr-test/src/.bzr/repository/format create mode 100644 integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.cix create mode 100644 integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.iix create mode 100644 integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.rix create mode 100644 integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.six create mode 100644 integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.tix create mode 100644 integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.cix create mode 100644 integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.iix create mode 100644 integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.rix create mode 100644 integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.six create mode 100644 integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.tix create mode 100644 integration-tests/bzr-test/src/.bzr/repository/pack-names create mode 100644 integration-tests/bzr-test/src/.bzr/repository/packs/6fad9644bfab38c89a8c6dbd6bdcaec1.pack create mode 100644 integration-tests/bzr-test/src/.bzr/repository/packs/e8975cb14db47e36ae3f979cfea23219.pack create mode 100644 integration-tests/bzr-test/src/.bzr/repository/shared-storage create mode 100644 integration-tests/bzr-test/src/trunk/.bzr/README create mode 100644 integration-tests/bzr-test/src/trunk/.bzr/branch-format create mode 100644 integration-tests/bzr-test/src/trunk/.bzr/branch/branch.conf create mode 100644 integration-tests/bzr-test/src/trunk/.bzr/branch/format create mode 100644 integration-tests/bzr-test/src/trunk/.bzr/branch/last-revision create mode 100644 integration-tests/bzr-test/src/trunk/.bzr/branch/tags create mode 100644 integration-tests/bzr-test/src/trunk/.bzr/checkout/conflicts create mode 100644 integration-tests/bzr-test/src/trunk/.bzr/checkout/dirstate create mode 100644 integration-tests/bzr-test/src/trunk/.bzr/checkout/format create mode 100644 integration-tests/bzr-test/src/trunk/.bzr/checkout/views create mode 100644 integration-tests/bzr-test/src/trunk/test create mode 100644 integration-tests/cmake-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/cmake-test/elements/dependencies/base-sdk.bst create mode 100644 integration-tests/cmake-test/elements/step7-run.bst create mode 100644 integration-tests/cmake-test/elements/step7.bst create mode 100644 integration-tests/cmake-test/expected/step7-run/test create mode 100644 integration-tests/cmake-test/expected/step7/usr/bin/Tutorial create mode 100644 integration-tests/cmake-test/expected/step7/usr/include/MathFunctions.h create mode 100644 integration-tests/cmake-test/expected/step7/usr/include/TutorialConfig.h create mode 100644 integration-tests/cmake-test/expected/step7/usr/lib/debug/Tutorial create mode 100644 integration-tests/cmake-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/cmake-test/project.conf create mode 100644 integration-tests/cmake-test/run-cmake-test.sh create mode 100644 integration-tests/cmake-test/src/step7.tar.gz create mode 100644 integration-tests/compose-test/elements/compose-all-test.bst create mode 100644 integration-tests/compose-test/elements/compose-exclude-debug.bst create mode 100644 integration-tests/compose-test/elements/compose-no-debug.bst create mode 100644 integration-tests/compose-test/elements/compose-no-devel.bst create mode 100644 integration-tests/compose-test/elements/compose-no-doc.bst create mode 100644 integration-tests/compose-test/elements/compose-no-locale.bst create mode 100644 integration-tests/compose-test/elements/compose-no-test.bst create mode 100644 integration-tests/compose-test/elements/compose-only-runtime.bst create mode 100644 integration-tests/compose-test/elements/dependencies/amhello-run.bst create mode 100644 integration-tests/compose-test/elements/dependencies/amhello.bst create mode 100644 integration-tests/compose-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/compose-test/elements/dependencies/base-sdk.bst create mode 100644 integration-tests/compose-test/elements/dependencies/devel-run.bst create mode 100644 integration-tests/compose-test/elements/dependencies/locale-run.bst create mode 100644 integration-tests/compose-test/expected/compose-all-test/tests/test create mode 100755 integration-tests/compose-test/expected/compose-all-test/usr/bin/hello create mode 100644 integration-tests/compose-test/expected/compose-all-test/usr/lib/debug/hello create mode 100644 integration-tests/compose-test/expected/compose-all-test/usr/share/doc/amhello/README create mode 100644 integration-tests/compose-test/expected/compose-exclude-debug/tests/test create mode 100755 integration-tests/compose-test/expected/compose-exclude-debug/usr/bin/hello create mode 100644 integration-tests/compose-test/expected/compose-exclude-debug/usr/lib/.gitkeep create mode 100644 integration-tests/compose-test/expected/compose-exclude-debug/usr/share/doc/amhello/README create mode 100755 integration-tests/compose-test/expected/compose-no-debug/usr/bin/hello create mode 100644 integration-tests/compose-test/expected/compose-no-debug/usr/lib/.gitkeep create mode 100644 integration-tests/compose-test/expected/compose-no-debug/usr/share/doc/amhello/README create mode 100755 integration-tests/compose-test/expected/compose-no-devel/usr/bin/hello create mode 100644 integration-tests/compose-test/expected/compose-no-devel/usr/lib/debug/hello create mode 100644 integration-tests/compose-test/expected/compose-no-devel/usr/share/doc/amhello/README create mode 100755 integration-tests/compose-test/expected/compose-no-doc/usr/bin/hello create mode 100644 integration-tests/compose-test/expected/compose-no-doc/usr/lib/debug/hello create mode 100644 integration-tests/compose-test/expected/compose-no-doc/usr/share/.gitkeep create mode 100755 integration-tests/compose-test/expected/compose-no-locale/usr/bin/hello create mode 100644 integration-tests/compose-test/expected/compose-no-locale/usr/lib/debug/hello create mode 100644 integration-tests/compose-test/expected/compose-no-locale/usr/share/doc/amhello/README create mode 100755 integration-tests/compose-test/expected/compose-no-test/usr/bin/hello create mode 100644 integration-tests/compose-test/expected/compose-no-test/usr/lib/debug/hello create mode 100644 integration-tests/compose-test/expected/compose-no-test/usr/share/doc/amhello/README create mode 100755 integration-tests/compose-test/expected/compose-only-runtime/usr/bin/hello create mode 100644 integration-tests/compose-test/expected/compose-only-runtime/usr/lib/.gitkeep create mode 100644 integration-tests/compose-test/expected/compose-only-runtime/usr/share/.gitkeep create mode 100644 integration-tests/compose-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/compose-test/project.conf create mode 100644 integration-tests/compose-test/run-compose-test.sh create mode 100644 integration-tests/compose-test/src/amhello.tar.gz create mode 100644 integration-tests/dpkg-build-test/.bst/workspaces.yml create mode 100644 integration-tests/dpkg-build-test/elements/dependencies/base-configure.bst create mode 100644 integration-tests/dpkg-build-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/dpkg-build-test/elements/dependencies/base-system.bst create mode 100644 integration-tests/dpkg-build-test/elements/dpkg-build-test.bst create mode 100644 integration-tests/dpkg-build-test/elements/dpkg-deploy-test.bst create mode 100644 integration-tests/dpkg-build-test/expected/dpkg-build-test/usr/share/doc/test/changelog.gz create mode 100644 integration-tests/dpkg-build-test/expected/dpkg-build-test/usr/share/foo create mode 100755 integration-tests/dpkg-build-test/expected/dpkg-deploy-test/test_0.1_amd64.deb create mode 100644 integration-tests/dpkg-build-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/dpkg-build-test/project.conf create mode 100755 integration-tests/dpkg-build-test/run-dpkg-build-test.sh create mode 100644 integration-tests/dpkg-build-test/src/Makefile create mode 100644 integration-tests/dpkg-build-test/src/debian/changelog create mode 100644 integration-tests/dpkg-build-test/src/debian/compat create mode 100644 integration-tests/dpkg-build-test/src/debian/control create mode 100755 integration-tests/dpkg-build-test/src/debian/rules create mode 100644 integration-tests/dpkg-build-test/src/debian/test.install create mode 100644 integration-tests/git-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/git-test/elements/dependencies/base-sdk.bst create mode 100644 integration-tests/git-test/elements/git-test.bst create mode 100644 integration-tests/git-test/expected/out-git-test/test create mode 100644 integration-tests/git-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/git-test/project.conf create mode 100644 integration-tests/git-test/run-git-test.sh create mode 100644 integration-tests/import-test/elements/import-src-test.bst create mode 100644 integration-tests/import-test/elements/import-sub-test.bst create mode 100644 integration-tests/import-test/elements/import-test.bst create mode 100644 integration-tests/import-test/elements/import-tgt-test.bst create mode 100644 integration-tests/import-test/expected/import-src-test/sub-test.txt create mode 100644 integration-tests/import-test/expected/import-sub-test/sub-test.txt create mode 100644 integration-tests/import-test/expected/import-test/sub-test/sub-test.txt create mode 100644 integration-tests/import-test/expected/import-test/test.txt create mode 100644 integration-tests/import-test/expected/import-tgt-test/output/sub-test/sub-test.txt create mode 100644 integration-tests/import-test/expected/import-tgt-test/output/test.txt create mode 100644 integration-tests/import-test/project.conf create mode 100644 integration-tests/import-test/run-import-test.sh create mode 100644 integration-tests/import-test/source/sub-test/sub-test.txt create mode 100644 integration-tests/import-test/source/test.txt create mode 100644 integration-tests/lib.sh create mode 100644 integration-tests/local-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/local-test/elements/dependencies/base-sdk.bst create mode 100644 integration-tests/local-test/elements/local-test.bst create mode 100644 integration-tests/local-test/expected/local-test/test create mode 100644 integration-tests/local-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/local-test/project.conf create mode 100644 integration-tests/local-test/run-local-test.sh create mode 100755 integration-tests/local-test/src/test create mode 100644 integration-tests/manual-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/manual-test/elements/manual-environment-test.bst create mode 100644 integration-tests/manual-test/elements/manual-noparallel-test.bst create mode 100644 integration-tests/manual-test/elements/manual-test.bst create mode 100644 integration-tests/manual-test/expected/manual-environment-test/test create mode 100644 integration-tests/manual-test/expected/manual-noparallel-test/test create mode 100644 integration-tests/manual-test/expected/manual-test/test create mode 100644 integration-tests/manual-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/manual-test/project.conf create mode 100644 integration-tests/manual-test/run-manual-test.sh create mode 100644 integration-tests/ostree-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/ostree-test/elements/dependencies/base-sdk.bst create mode 100644 integration-tests/ostree-test/elements/ostree-test.bst create mode 100644 integration-tests/ostree-test/expected/ostree-test/test create mode 100644 integration-tests/ostree-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/ostree-test/project.conf create mode 100644 integration-tests/ostree-test/run-ostree-test.sh create mode 100644 integration-tests/ostree-test/src/config create mode 100644 integration-tests/ostree-test/src/objects/16/f79cc2a8fa211af59ae76342580fe71b3b43e63ee91ed8be6082a035f7b4b4.dirmeta create mode 100644 integration-tests/ostree-test/src/objects/4d/0530fd08875e2e64dab3d48124c2e69ed88a39f02753009d6575583e95d052.file create mode 100644 integration-tests/ostree-test/src/objects/6d/ed2d0c1f4799e7e1b3e2eeabb0877ae17e12abc77734c5253dcd1317b3cbc2.dirtree create mode 100644 integration-tests/ostree-test/src/objects/bd/5cc009f076d4fb696447bb671512e71897eacc2fc198c98d3af69fcdf59f11.commit create mode 100644 integration-tests/ostree-test/src/refs/heads/test create mode 100644 integration-tests/ostree-test/tree/test create mode 100644 integration-tests/pip-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/pip-test/elements/dependencies/base-sdk.bst create mode 100644 integration-tests/pip-test/elements/hello-run.bst create mode 100644 integration-tests/pip-test/elements/hello.bst create mode 100644 integration-tests/pip-test/expected/hello-run/test create mode 100755 integration-tests/pip-test/expected/hello/usr/bin/hello create mode 100644 integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/PKG-INFO create mode 100644 integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/SOURCES.txt create mode 100644 integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/dependency_links.txt create mode 100644 integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/entry_points.txt create mode 100644 integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/installed-files.txt create mode 100644 integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/top_level.txt create mode 100644 integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello/__init__.py create mode 100644 integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello/__pycache__/__init__.cpython-35.pyc create mode 100644 integration-tests/pip-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/pip-test/project.conf create mode 100644 integration-tests/pip-test/run-pip-test.sh create mode 100644 integration-tests/pip-test/src/hello.tar.xz create mode 100755 integration-tests/run-test.sh create mode 100644 integration-tests/script-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/script-test/elements/script-cwd-test.bst create mode 100644 integration-tests/script-test/elements/script-layout-test.bst create mode 100644 integration-tests/script-test/elements/script-no-root-test.bst create mode 100644 integration-tests/script-test/elements/script-root-test.bst create mode 100644 integration-tests/script-test/elements/script-test.bst create mode 100644 integration-tests/script-test/expected/script-cwd-test/test create mode 100644 integration-tests/script-test/expected/script-layout-test/test create mode 100644 integration-tests/script-test/expected/script-no-root-test/test create mode 100644 integration-tests/script-test/expected/script-root-test/test create mode 100644 integration-tests/script-test/expected/script-test/test create mode 100644 integration-tests/script-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/script-test/project.conf create mode 100644 integration-tests/script-test/run-script-test.sh create mode 100644 integration-tests/shell-test/.bst/workspaces.yml create mode 100644 integration-tests/shell-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/shell-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/shell-test/project.conf create mode 100644 integration-tests/shell-test/run-shell-test.sh create mode 100644 integration-tests/stack-test/elements/dependencies/another-hi.bst create mode 100644 integration-tests/stack-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/stack-test/elements/dependencies/hi.bst create mode 100644 integration-tests/stack-test/elements/stack-test.bst create mode 100644 integration-tests/stack-test/expected/stack-test/another-hi create mode 100644 integration-tests/stack-test/expected/stack-test/hi create mode 100644 integration-tests/stack-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/stack-test/project.conf create mode 100644 integration-tests/stack-test/run-stack-test.sh create mode 100644 integration-tests/tar-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/tar-test/elements/dependencies/base-sdk.bst create mode 100644 integration-tests/tar-test/elements/tar-test.bst create mode 100644 integration-tests/tar-test/expected/tar-test/test create mode 100644 integration-tests/tar-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/tar-test/project.conf create mode 100644 integration-tests/tar-test/run-tar-test.sh create mode 100644 integration-tests/tar-test/src.tar.gz create mode 100644 integration-tests/x86image-test/elements/dependencies/base-platform.bst create mode 100644 integration-tests/x86image-test/elements/x86-test.bst create mode 100644 integration-tests/x86image-test/keys/gnome-sdk.gpg create mode 100644 integration-tests/x86image-test/project.conf create mode 100644 integration-tests/x86image-test/run-x86image-test.sh diff --git a/.gitignore b/.gitignore index 2505f1e61..b99e24897 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,6 @@ tests/**/*.pyc tmp .coverage .cache + +# Integration test results +/integration-tests/*results/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4b21c7551..3d2fa7fdf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -37,13 +37,12 @@ integration_linux: script: - pip3 install . - - git clone https://gitlab.com/BuildStream/buildstream-tests.git - - cd buildstream-tests - - ./run-test.sh --arg --colors --cov ../.coveragerc test + - cd integration-tests + - ./run-test.sh --arg --colors --cov ../.coveragerc --sources ${XDG_CACHE_HOME}/buildstream/sources test - cd .. - mkdir -p coverage-linux/ - - cp buildstream-tests/.coverage coverage-linux/coverage.linux - - cp -a cache/buildstream/logs logs-linux + - cp integration-tests/.coverage coverage-linux/coverage.linux + - cp -a integration-tests/tmp/logs logs-linux artifacts: paths: @@ -73,13 +72,12 @@ integration_unix: BST_FORCE_BACKEND: "unix" script: - pip3 install . - - git clone https://gitlab.com/BuildStream/buildstream-tests.git - - cd buildstream-tests - - ./run-test.sh --arg --colors --cov ../.coveragerc test + - cd integration-tests + - ./run-test.sh --arg --colors --cov ../.coveragerc --sources ${XDG_CACHE_HOME}/buildstream/sources test - cd .. - mkdir -p coverage-unix/ - - cp buildstream-tests/.coverage coverage-unix/coverage.unix - - cp -a cache/buildstream/logs logs-unix + - cp integration-tests/.coverage coverage-unix/coverage.unix + - cp -a integration-tests/tmp/logs logs-unix artifacts: paths: diff --git a/integration-tests/.omit b/integration-tests/.omit new file mode 100644 index 000000000..ff31a1e25 --- /dev/null +++ b/integration-tests/.omit @@ -0,0 +1,3 @@ +x86image-test/ +git-test +ostree-test/ diff --git a/integration-tests/autotools-test/elements/amhello-run.bst b/integration-tests/autotools-test/elements/amhello-run.bst new file mode 100644 index 000000000..bd6c903b0 --- /dev/null +++ b/integration-tests/autotools-test/elements/amhello-run.bst @@ -0,0 +1,12 @@ +kind: script +description: Run autotools-built binary + +depends: + - filename: dependencies/base-platform.bst + type: build + - filename: amhello.bst + type: build + +config: + commands: + - "/usr/bin/hello > /buildstream/install/test" diff --git a/integration-tests/autotools-test/elements/amhello.bst b/integration-tests/autotools-test/elements/amhello.bst new file mode 100644 index 000000000..5dc13b4ac --- /dev/null +++ b/integration-tests/autotools-test/elements/amhello.bst @@ -0,0 +1,13 @@ +kind: autotools +description: Autotools test + +depends: +- filename: dependencies/base-platform.bst + type: build +- filename: dependencies/base-sdk.bst + type: build + +sources: +- kind: tar + url: file:///amhello.tar.gz + ref: 3aa3c2bf7a488fea24303c4d98d1b5c0a72734f61615b935cf62e4e126b127d2 diff --git a/integration-tests/autotools-test/elements/dependencies/base-platform.bst b/integration-tests/autotools-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/autotools-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/autotools-test/elements/dependencies/base-sdk.bst b/integration-tests/autotools-test/elements/dependencies/base-sdk.bst new file mode 100644 index 000000000..cd191fd1b --- /dev/null +++ b/integration-tests/autotools-test/elements/dependencies/base-sdk.bst @@ -0,0 +1,20 @@ +kind: import +description: Import the base freedesktop SDK +config: + source: files + target: usr +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981 diff --git a/integration-tests/autotools-test/expected/amhello-run/test b/integration-tests/autotools-test/expected/amhello-run/test new file mode 100644 index 000000000..cb3ea7cb8 --- /dev/null +++ b/integration-tests/autotools-test/expected/amhello-run/test @@ -0,0 +1,2 @@ +Hello World! +This is amhello 1.0. diff --git a/integration-tests/autotools-test/expected/amhello/usr/bin/hello b/integration-tests/autotools-test/expected/amhello/usr/bin/hello new file mode 100755 index 000000000..16a0c7cb6 Binary files /dev/null and b/integration-tests/autotools-test/expected/amhello/usr/bin/hello differ diff --git a/integration-tests/autotools-test/expected/amhello/usr/lib/debug/hello b/integration-tests/autotools-test/expected/amhello/usr/lib/debug/hello new file mode 100644 index 000000000..b3720a2b1 Binary files /dev/null and b/integration-tests/autotools-test/expected/amhello/usr/lib/debug/hello differ diff --git a/integration-tests/autotools-test/expected/amhello/usr/share/doc/amhello/README b/integration-tests/autotools-test/expected/amhello/usr/share/doc/amhello/README new file mode 100644 index 000000000..d24723a81 --- /dev/null +++ b/integration-tests/autotools-test/expected/amhello/usr/share/doc/amhello/README @@ -0,0 +1,2 @@ +This is a demonstration package for GNU Automake. +Type `info Automake' to read the Automake manual. diff --git a/integration-tests/autotools-test/keys/gnome-sdk.gpg b/integration-tests/autotools-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/autotools-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/autotools-test/project.conf b/integration-tests/autotools-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/autotools-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/autotools-test/run-autotools-test.sh b/integration-tests/autotools-test/run-autotools-test.sh new file mode 100644 index 000000000..d2d247cee --- /dev/null +++ b/integration-tests/autotools-test/run-autotools-test.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + local bst_file + local tar_file + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + tar_file="$(dirname "$(readlink -f "$0")")/src/amhello.tar.gz" + bst_file="$(dirname "$(readlink -f "$0")")/elements/amhello.bst" + + patch_file_location "$bst_file" "$tar_file" + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/autotools-test/src/amhello.tar.gz b/integration-tests/autotools-test/src/amhello.tar.gz new file mode 100644 index 000000000..2850f31aa Binary files /dev/null and b/integration-tests/autotools-test/src/amhello.tar.gz differ diff --git a/integration-tests/bzr-test/elements/bzr-test.bst b/integration-tests/bzr-test/elements/bzr-test.bst new file mode 100644 index 000000000..25349ca0c --- /dev/null +++ b/integration-tests/bzr-test/elements/bzr-test.bst @@ -0,0 +1,19 @@ +kind: manual +description: bzr test + +depends: +- filename: dependencies/base-platform.bst + type: build +- filename: dependencies/base-sdk.bst + type: build + +sources: +- kind: bzr + url: file:///src + track: trunk + + ref: '2' +config: + install-commands: + - "mkdir -p %{install-root}" + - "./test" diff --git a/integration-tests/bzr-test/elements/dependencies/base-platform.bst b/integration-tests/bzr-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/bzr-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/bzr-test/elements/dependencies/base-sdk.bst b/integration-tests/bzr-test/elements/dependencies/base-sdk.bst new file mode 100644 index 000000000..cd191fd1b --- /dev/null +++ b/integration-tests/bzr-test/elements/dependencies/base-sdk.bst @@ -0,0 +1,20 @@ +kind: import +description: Import the base freedesktop SDK +config: + source: files + target: usr +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981 diff --git a/integration-tests/bzr-test/expected/bzr-test/test b/integration-tests/bzr-test/expected/bzr-test/test new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/integration-tests/bzr-test/expected/bzr-test/test @@ -0,0 +1 @@ +test diff --git a/integration-tests/bzr-test/keys/gnome-sdk.gpg b/integration-tests/bzr-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/bzr-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/bzr-test/project.conf b/integration-tests/bzr-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/bzr-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/bzr-test/run-bzr-test.sh b/integration-tests/bzr-test/run-bzr-test.sh new file mode 100644 index 000000000..1a4a21e10 --- /dev/null +++ b/integration-tests/bzr-test/run-bzr-test.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + local bst_file + local tar_file + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + tar_file="$(dirname "$(readlink -f "$0")")/src" + bst_file="$(dirname "$(readlink -f "$0")")/elements/bzr-test.bst" + + patch_file_location "$bst_file" "$tar_file" + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/bzr-test/src/.bzr/README b/integration-tests/bzr-test/src/.bzr/README new file mode 100644 index 000000000..f82dc1c3c --- /dev/null +++ b/integration-tests/bzr-test/src/.bzr/README @@ -0,0 +1,3 @@ +This is a Bazaar control directory. +Do not change any files in this directory. +See http://bazaar.canonical.com/ for more information about Bazaar. diff --git a/integration-tests/bzr-test/src/.bzr/branch-format b/integration-tests/bzr-test/src/.bzr/branch-format new file mode 100644 index 000000000..9eb09b735 --- /dev/null +++ b/integration-tests/bzr-test/src/.bzr/branch-format @@ -0,0 +1 @@ +Bazaar-NG meta directory, format 1 diff --git a/integration-tests/bzr-test/src/.bzr/repository/format b/integration-tests/bzr-test/src/.bzr/repository/format new file mode 100644 index 000000000..b200528b2 --- /dev/null +++ b/integration-tests/bzr-test/src/.bzr/repository/format @@ -0,0 +1 @@ +Bazaar repository format 2a (needs bzr 1.16 or later) diff --git a/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.cix b/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.cix new file mode 100644 index 000000000..1c028a9e4 Binary files /dev/null and b/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.cix differ diff --git a/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.iix b/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.iix new file mode 100644 index 000000000..1196e82cc Binary files /dev/null and b/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.iix differ diff --git a/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.rix b/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.rix new file mode 100644 index 000000000..6fbcddcea Binary files /dev/null and b/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.rix differ diff --git a/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.six b/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.six new file mode 100644 index 000000000..a2afde6b9 --- /dev/null +++ b/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.six @@ -0,0 +1,5 @@ +B+Tree Graph Index 2 +node_ref_lists=0 +key_elements=1 +len=0 +row_lengths= diff --git a/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.tix b/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.tix new file mode 100644 index 000000000..a900ac4f2 Binary files /dev/null and b/integration-tests/bzr-test/src/.bzr/repository/indices/6fad9644bfab38c89a8c6dbd6bdcaec1.tix differ diff --git a/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.cix b/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.cix new file mode 100644 index 000000000..55a4e1bfd --- /dev/null +++ b/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.cix @@ -0,0 +1,9 @@ +B+Tree Graph Index 2 +node_ref_lists=0 +key_elements=1 +len=2 +row_lengths=1 +x%˱ 1 7EF0 + +$h$^ޟ?uML[GxWzPXu"J&w;– (<#%Y +Uf||"# \ No newline at end of file diff --git a/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.iix b/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.iix new file mode 100644 index 000000000..a040c5d93 Binary files /dev/null and b/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.iix differ diff --git a/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.rix b/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.rix new file mode 100644 index 000000000..c9ab6138a Binary files /dev/null and b/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.rix differ diff --git a/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.six b/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.six new file mode 100644 index 000000000..a2afde6b9 --- /dev/null +++ b/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.six @@ -0,0 +1,5 @@ +B+Tree Graph Index 2 +node_ref_lists=0 +key_elements=1 +len=0 +row_lengths= diff --git a/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.tix b/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.tix new file mode 100644 index 000000000..8a6c6e832 Binary files /dev/null and b/integration-tests/bzr-test/src/.bzr/repository/indices/e8975cb14db47e36ae3f979cfea23219.tix differ diff --git a/integration-tests/bzr-test/src/.bzr/repository/pack-names b/integration-tests/bzr-test/src/.bzr/repository/pack-names new file mode 100644 index 000000000..250af6115 Binary files /dev/null and b/integration-tests/bzr-test/src/.bzr/repository/pack-names differ diff --git a/integration-tests/bzr-test/src/.bzr/repository/packs/6fad9644bfab38c89a8c6dbd6bdcaec1.pack b/integration-tests/bzr-test/src/.bzr/repository/packs/6fad9644bfab38c89a8c6dbd6bdcaec1.pack new file mode 100644 index 000000000..58dd575d1 Binary files /dev/null and b/integration-tests/bzr-test/src/.bzr/repository/packs/6fad9644bfab38c89a8c6dbd6bdcaec1.pack differ diff --git a/integration-tests/bzr-test/src/.bzr/repository/packs/e8975cb14db47e36ae3f979cfea23219.pack b/integration-tests/bzr-test/src/.bzr/repository/packs/e8975cb14db47e36ae3f979cfea23219.pack new file mode 100644 index 000000000..29b1cbfff Binary files /dev/null and b/integration-tests/bzr-test/src/.bzr/repository/packs/e8975cb14db47e36ae3f979cfea23219.pack differ diff --git a/integration-tests/bzr-test/src/.bzr/repository/shared-storage b/integration-tests/bzr-test/src/.bzr/repository/shared-storage new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/bzr-test/src/trunk/.bzr/README b/integration-tests/bzr-test/src/trunk/.bzr/README new file mode 100644 index 000000000..f82dc1c3c --- /dev/null +++ b/integration-tests/bzr-test/src/trunk/.bzr/README @@ -0,0 +1,3 @@ +This is a Bazaar control directory. +Do not change any files in this directory. +See http://bazaar.canonical.com/ for more information about Bazaar. diff --git a/integration-tests/bzr-test/src/trunk/.bzr/branch-format b/integration-tests/bzr-test/src/trunk/.bzr/branch-format new file mode 100644 index 000000000..9eb09b735 --- /dev/null +++ b/integration-tests/bzr-test/src/trunk/.bzr/branch-format @@ -0,0 +1 @@ +Bazaar-NG meta directory, format 1 diff --git a/integration-tests/bzr-test/src/trunk/.bzr/branch/branch.conf b/integration-tests/bzr-test/src/trunk/.bzr/branch/branch.conf new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/bzr-test/src/trunk/.bzr/branch/format b/integration-tests/bzr-test/src/trunk/.bzr/branch/format new file mode 100644 index 000000000..dc392f449 --- /dev/null +++ b/integration-tests/bzr-test/src/trunk/.bzr/branch/format @@ -0,0 +1 @@ +Bazaar Branch Format 7 (needs bzr 1.6) diff --git a/integration-tests/bzr-test/src/trunk/.bzr/branch/last-revision b/integration-tests/bzr-test/src/trunk/.bzr/branch/last-revision new file mode 100644 index 000000000..067624909 --- /dev/null +++ b/integration-tests/bzr-test/src/trunk/.bzr/branch/last-revision @@ -0,0 +1 @@ +2 tristan.maat@codethink.co.uk-20170629145450-002fmq5jowd85hfz diff --git a/integration-tests/bzr-test/src/trunk/.bzr/branch/tags b/integration-tests/bzr-test/src/trunk/.bzr/branch/tags new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/bzr-test/src/trunk/.bzr/checkout/conflicts b/integration-tests/bzr-test/src/trunk/.bzr/checkout/conflicts new file mode 100644 index 000000000..0dc2d3a0f --- /dev/null +++ b/integration-tests/bzr-test/src/trunk/.bzr/checkout/conflicts @@ -0,0 +1 @@ +BZR conflict list format 1 diff --git a/integration-tests/bzr-test/src/trunk/.bzr/checkout/dirstate b/integration-tests/bzr-test/src/trunk/.bzr/checkout/dirstate new file mode 100644 index 000000000..78c7774e1 Binary files /dev/null and b/integration-tests/bzr-test/src/trunk/.bzr/checkout/dirstate differ diff --git a/integration-tests/bzr-test/src/trunk/.bzr/checkout/format b/integration-tests/bzr-test/src/trunk/.bzr/checkout/format new file mode 100644 index 000000000..e0261c797 --- /dev/null +++ b/integration-tests/bzr-test/src/trunk/.bzr/checkout/format @@ -0,0 +1 @@ +Bazaar Working Tree Format 6 (bzr 1.14) diff --git a/integration-tests/bzr-test/src/trunk/.bzr/checkout/views b/integration-tests/bzr-test/src/trunk/.bzr/checkout/views new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/bzr-test/src/trunk/test b/integration-tests/bzr-test/src/trunk/test new file mode 100644 index 000000000..b2c5fe44a --- /dev/null +++ b/integration-tests/bzr-test/src/trunk/test @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +echo "test" > /buildstream/install/test diff --git a/integration-tests/cmake-test/elements/dependencies/base-platform.bst b/integration-tests/cmake-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/cmake-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/cmake-test/elements/dependencies/base-sdk.bst b/integration-tests/cmake-test/elements/dependencies/base-sdk.bst new file mode 100644 index 000000000..cd191fd1b --- /dev/null +++ b/integration-tests/cmake-test/elements/dependencies/base-sdk.bst @@ -0,0 +1,20 @@ +kind: import +description: Import the base freedesktop SDK +config: + source: files + target: usr +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981 diff --git a/integration-tests/cmake-test/elements/step7-run.bst b/integration-tests/cmake-test/elements/step7-run.bst new file mode 100644 index 000000000..0a51c485e --- /dev/null +++ b/integration-tests/cmake-test/elements/step7-run.bst @@ -0,0 +1,12 @@ +kind: script +description: Cmake binary run test + +depends: + - filename: dependencies/base-platform.bst + type: build + - filename: step7.bst + type: build + +config: + commands: + - "/usr/bin/Tutorial 9 > /buildstream/install/test" diff --git a/integration-tests/cmake-test/elements/step7.bst b/integration-tests/cmake-test/elements/step7.bst new file mode 100644 index 000000000..bd4d1f3cd --- /dev/null +++ b/integration-tests/cmake-test/elements/step7.bst @@ -0,0 +1,13 @@ +kind: cmake +description: Cmake test + +depends: + - filename: dependencies/base-platform.bst + type: build + - filename: dependencies/base-sdk.bst + type: build + +sources: + - kind: tar + url: file:///home/tristanmaat/Documents/Projects/buildstream/buildstream-tests/cmake-test/src/step7.tar.gz + ref: 9591707afbae77751730b4af4c52a18b1cdc4378237bc64055f099bc95c330db diff --git a/integration-tests/cmake-test/expected/step7-run/test b/integration-tests/cmake-test/expected/step7-run/test new file mode 100644 index 000000000..8a2ba1b74 --- /dev/null +++ b/integration-tests/cmake-test/expected/step7-run/test @@ -0,0 +1,11 @@ +Computing sqrt of 9 to be 3 +Computing sqrt of 9 to be 3 +Computing sqrt of 9 to be 3 +Computing sqrt of 9 to be 3 +Computing sqrt of 9 to be 3 +Computing sqrt of 9 to be 3 +Computing sqrt of 9 to be 3 +Computing sqrt of 9 to be 3 +Computing sqrt of 9 to be 3 +Computing sqrt of 9 to be 3 +The square root of 9 is 3 diff --git a/integration-tests/cmake-test/expected/step7/usr/bin/Tutorial b/integration-tests/cmake-test/expected/step7/usr/bin/Tutorial new file mode 100644 index 000000000..d0db8aefb Binary files /dev/null and b/integration-tests/cmake-test/expected/step7/usr/bin/Tutorial differ diff --git a/integration-tests/cmake-test/expected/step7/usr/include/MathFunctions.h b/integration-tests/cmake-test/expected/step7/usr/include/MathFunctions.h new file mode 100644 index 000000000..cd36bccff --- /dev/null +++ b/integration-tests/cmake-test/expected/step7/usr/include/MathFunctions.h @@ -0,0 +1 @@ +double mysqrt(double x); diff --git a/integration-tests/cmake-test/expected/step7/usr/include/TutorialConfig.h b/integration-tests/cmake-test/expected/step7/usr/include/TutorialConfig.h new file mode 100644 index 000000000..e38a218af --- /dev/null +++ b/integration-tests/cmake-test/expected/step7/usr/include/TutorialConfig.h @@ -0,0 +1,9 @@ +// the configured options and settings for Tutorial +#define Tutorial_VERSION_MAJOR 1 +#define Tutorial_VERSION_MINOR 0 +#define USE_MYMATH + +// does the platform provide exp and log functions? +/* #undef HAVE_LOG */ +/* #undef HAVE_EXP */ + diff --git a/integration-tests/cmake-test/expected/step7/usr/lib/debug/Tutorial b/integration-tests/cmake-test/expected/step7/usr/lib/debug/Tutorial new file mode 100644 index 000000000..20aef7581 Binary files /dev/null and b/integration-tests/cmake-test/expected/step7/usr/lib/debug/Tutorial differ diff --git a/integration-tests/cmake-test/keys/gnome-sdk.gpg b/integration-tests/cmake-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/cmake-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/cmake-test/project.conf b/integration-tests/cmake-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/cmake-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/cmake-test/run-cmake-test.sh b/integration-tests/cmake-test/run-cmake-test.sh new file mode 100644 index 000000000..cf3c3db1c --- /dev/null +++ b/integration-tests/cmake-test/run-cmake-test.sh @@ -0,0 +1,89 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This test has more manual intervention since it creates binary files +# which may change. +# +run_test () { + local bst_file + local tar_file + + local successes=0 + local total=2 + local exit + + source ../lib.sh + + ############################################################### + ### Setup + ############################################################### + + tar_file="$(dirname "$(readlink -f "$0")")/src/step7.tar.gz" + bst_file="$(dirname "$(readlink -f "$0")")/elements/step7.bst" + + patch_file_location "$bst_file" "$tar_file" + + mkdir -p "$TEST_DIR" + + ############################################################### + ### Run tests + ############################################################### + + ## Test step7 + echo "Running test 'step7'" + + bst_with_flags build "step7.bst" + bst_with_flags checkout "step7.bst" "results/step7" + + # Remove changing binary file + rm results/step7/usr/bin/libMathFunctions.a + + exit=0 + diff -r "$RESULTS/step7" "$EXPECTED/step7" || exit=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + printf "%-34s ${GREEN}%9s${END}\n" "step7" "succeeded" + else + echo "Error: Unexpected or missing file in 'results/step7'" + printf "%-34s ${RED}%9s${END}\n" "step7" "failed" + fi + + ## Test step7-run + echo "Running test 'step7-run'" + + bst_with_flags build "step7-run.bst" + bst_with_flags checkout "step7-run.bst" "results/step7-run" + + exit=0 + compare_results "step7-run" "results" "expected" || exit=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + else + echo "Error: Unexpected or missing file in 'results/step7'" + fi + + ############################################################### + ### Check results + ############################################################### + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/cmake-test/src/step7.tar.gz b/integration-tests/cmake-test/src/step7.tar.gz new file mode 100644 index 000000000..f9643afce Binary files /dev/null and b/integration-tests/cmake-test/src/step7.tar.gz differ diff --git a/integration-tests/compose-test/elements/compose-all-test.bst b/integration-tests/compose-test/elements/compose-all-test.bst new file mode 100644 index 000000000..78ce497c5 --- /dev/null +++ b/integration-tests/compose-test/elements/compose-all-test.bst @@ -0,0 +1,16 @@ +kind: compose + +depends: + - filename: dependencies/amhello.bst + type: build + - filename: dependencies/amhello-run.bst + type: build + +config: + include: + - runtime + - devel + - debug + - doc + - locale + - test diff --git a/integration-tests/compose-test/elements/compose-exclude-debug.bst b/integration-tests/compose-test/elements/compose-exclude-debug.bst new file mode 100644 index 000000000..6291b349e --- /dev/null +++ b/integration-tests/compose-test/elements/compose-exclude-debug.bst @@ -0,0 +1,11 @@ +kind: compose + +depends: + - filename: dependencies/amhello.bst + type: build + - filename: dependencies/amhello-run.bst + type: build + +config: + exclude: + - debug diff --git a/integration-tests/compose-test/elements/compose-no-debug.bst b/integration-tests/compose-test/elements/compose-no-debug.bst new file mode 100644 index 000000000..5a6517d09 --- /dev/null +++ b/integration-tests/compose-test/elements/compose-no-debug.bst @@ -0,0 +1,14 @@ +kind: compose + +depends: + - filename: dependencies/amhello.bst + type: build + - filename: dependencies/amhello-run.bst + type: build + +config: + include: + - runtime + - devel + - doc + - locale diff --git a/integration-tests/compose-test/elements/compose-no-devel.bst b/integration-tests/compose-test/elements/compose-no-devel.bst new file mode 100644 index 000000000..f13f01b88 --- /dev/null +++ b/integration-tests/compose-test/elements/compose-no-devel.bst @@ -0,0 +1,14 @@ +kind: compose + +depends: + - filename: dependencies/amhello.bst + type: build + - filename: dependencies/devel-run.bst + type: build + +config: + include: + - runtime + - debug + - doc + - locale diff --git a/integration-tests/compose-test/elements/compose-no-doc.bst b/integration-tests/compose-test/elements/compose-no-doc.bst new file mode 100644 index 000000000..6c47b851b --- /dev/null +++ b/integration-tests/compose-test/elements/compose-no-doc.bst @@ -0,0 +1,14 @@ +kind: compose + +depends: + - filename: dependencies/amhello.bst + type: build + - filename: dependencies/amhello-run.bst + type: build + +config: + include: + - runtime + - devel + - debug + - locale diff --git a/integration-tests/compose-test/elements/compose-no-locale.bst b/integration-tests/compose-test/elements/compose-no-locale.bst new file mode 100644 index 000000000..9e3d62e05 --- /dev/null +++ b/integration-tests/compose-test/elements/compose-no-locale.bst @@ -0,0 +1,14 @@ +kind: compose + +depends: + - filename: dependencies/amhello.bst + type: build + - filename: dependencies/locale-run.bst + type: build + +config: + include: + - runtime + - devel + - debug + - doc diff --git a/integration-tests/compose-test/elements/compose-no-test.bst b/integration-tests/compose-test/elements/compose-no-test.bst new file mode 100644 index 000000000..418c2d475 --- /dev/null +++ b/integration-tests/compose-test/elements/compose-no-test.bst @@ -0,0 +1,15 @@ +kind: compose + +depends: + - filename: dependencies/amhello.bst + type: build + - filename: dependencies/amhello-run.bst + type: build + +config: + include: + - runtime + - devel + - debug + - doc + - locale diff --git a/integration-tests/compose-test/elements/compose-only-runtime.bst b/integration-tests/compose-test/elements/compose-only-runtime.bst new file mode 100644 index 000000000..401c16dc8 --- /dev/null +++ b/integration-tests/compose-test/elements/compose-only-runtime.bst @@ -0,0 +1,9 @@ +kind: compose + +depends: + - filename: dependencies/amhello.bst + type: build + +config: + include: + - runtime diff --git a/integration-tests/compose-test/elements/dependencies/amhello-run.bst b/integration-tests/compose-test/elements/dependencies/amhello-run.bst new file mode 100644 index 000000000..a6162155b --- /dev/null +++ b/integration-tests/compose-test/elements/dependencies/amhello-run.bst @@ -0,0 +1,14 @@ +kind: script +description: Run autotools-built binary + +depends: + - filename: dependencies/base-platform.bst + type: build + - filename: dependencies/amhello.bst + type: build + +config: + commands: + - "mkdir -p /buildstream/install/tests" + - "/usr/bin/hello > /buildstream/install/tests/test" + - "echo BLABLABLA %{debugdir} >> /buildstream/install/tests/test" diff --git a/integration-tests/compose-test/elements/dependencies/amhello.bst b/integration-tests/compose-test/elements/dependencies/amhello.bst new file mode 100644 index 000000000..2e0915803 --- /dev/null +++ b/integration-tests/compose-test/elements/dependencies/amhello.bst @@ -0,0 +1,13 @@ +kind: autotools +description: Autotools test + +depends: +- filename: dependencies/base-platform.bst + type: build +- filename: dependencies/base-sdk.bst + type: build + +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/base-platform.bst b/integration-tests/compose-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/compose-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/compose-test/elements/dependencies/base-sdk.bst b/integration-tests/compose-test/elements/dependencies/base-sdk.bst new file mode 100644 index 000000000..cd191fd1b --- /dev/null +++ b/integration-tests/compose-test/elements/dependencies/base-sdk.bst @@ -0,0 +1,20 @@ +kind: import +description: Import the base freedesktop SDK +config: + source: files + target: usr +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981 diff --git a/integration-tests/compose-test/elements/dependencies/devel-run.bst b/integration-tests/compose-test/elements/dependencies/devel-run.bst new file mode 100644 index 000000000..4134fec81 --- /dev/null +++ b/integration-tests/compose-test/elements/dependencies/devel-run.bst @@ -0,0 +1,11 @@ +kind: script +description: Run autotools-built binary + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + commands: + - "mkdir -p /buildstream/install%{includedir}" + - "echo 'You should never see this file!' > /buildstream/install%{includedir}/broken" diff --git a/integration-tests/compose-test/elements/dependencies/locale-run.bst b/integration-tests/compose-test/elements/dependencies/locale-run.bst new file mode 100644 index 000000000..52aed047d --- /dev/null +++ b/integration-tests/compose-test/elements/dependencies/locale-run.bst @@ -0,0 +1,11 @@ +kind: script +description: Run autotools-built binary + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + commands: + - "mkdir -p /buildstream/install%{datadir}/locale" + - "echo 'You should never see this file!' > /buildstream/install%{datadir}/locale/broken" diff --git a/integration-tests/compose-test/expected/compose-all-test/tests/test b/integration-tests/compose-test/expected/compose-all-test/tests/test new file mode 100644 index 000000000..5eb4bd2cd --- /dev/null +++ b/integration-tests/compose-test/expected/compose-all-test/tests/test @@ -0,0 +1,3 @@ +Hello World! +This is amhello 1.0. +BLABLABLA /usr/lib/debug diff --git a/integration-tests/compose-test/expected/compose-all-test/usr/bin/hello b/integration-tests/compose-test/expected/compose-all-test/usr/bin/hello new file mode 100755 index 000000000..16a0c7cb6 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-all-test/usr/bin/hello differ diff --git a/integration-tests/compose-test/expected/compose-all-test/usr/lib/debug/hello b/integration-tests/compose-test/expected/compose-all-test/usr/lib/debug/hello new file mode 100644 index 000000000..b3720a2b1 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-all-test/usr/lib/debug/hello differ diff --git a/integration-tests/compose-test/expected/compose-all-test/usr/share/doc/amhello/README b/integration-tests/compose-test/expected/compose-all-test/usr/share/doc/amhello/README new file mode 100644 index 000000000..d24723a81 --- /dev/null +++ b/integration-tests/compose-test/expected/compose-all-test/usr/share/doc/amhello/README @@ -0,0 +1,2 @@ +This is a demonstration package for GNU Automake. +Type `info Automake' to read the Automake manual. diff --git a/integration-tests/compose-test/expected/compose-exclude-debug/tests/test b/integration-tests/compose-test/expected/compose-exclude-debug/tests/test new file mode 100644 index 000000000..5eb4bd2cd --- /dev/null +++ b/integration-tests/compose-test/expected/compose-exclude-debug/tests/test @@ -0,0 +1,3 @@ +Hello World! +This is amhello 1.0. +BLABLABLA /usr/lib/debug diff --git a/integration-tests/compose-test/expected/compose-exclude-debug/usr/bin/hello b/integration-tests/compose-test/expected/compose-exclude-debug/usr/bin/hello new file mode 100755 index 000000000..16a0c7cb6 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-exclude-debug/usr/bin/hello differ diff --git a/integration-tests/compose-test/expected/compose-exclude-debug/usr/lib/.gitkeep b/integration-tests/compose-test/expected/compose-exclude-debug/usr/lib/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/compose-test/expected/compose-exclude-debug/usr/share/doc/amhello/README b/integration-tests/compose-test/expected/compose-exclude-debug/usr/share/doc/amhello/README new file mode 100644 index 000000000..d24723a81 --- /dev/null +++ b/integration-tests/compose-test/expected/compose-exclude-debug/usr/share/doc/amhello/README @@ -0,0 +1,2 @@ +This is a demonstration package for GNU Automake. +Type `info Automake' to read the Automake manual. diff --git a/integration-tests/compose-test/expected/compose-no-debug/usr/bin/hello b/integration-tests/compose-test/expected/compose-no-debug/usr/bin/hello new file mode 100755 index 000000000..16a0c7cb6 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-no-debug/usr/bin/hello differ diff --git a/integration-tests/compose-test/expected/compose-no-debug/usr/lib/.gitkeep b/integration-tests/compose-test/expected/compose-no-debug/usr/lib/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/compose-test/expected/compose-no-debug/usr/share/doc/amhello/README b/integration-tests/compose-test/expected/compose-no-debug/usr/share/doc/amhello/README new file mode 100644 index 000000000..d24723a81 --- /dev/null +++ b/integration-tests/compose-test/expected/compose-no-debug/usr/share/doc/amhello/README @@ -0,0 +1,2 @@ +This is a demonstration package for GNU Automake. +Type `info Automake' to read the Automake manual. diff --git a/integration-tests/compose-test/expected/compose-no-devel/usr/bin/hello b/integration-tests/compose-test/expected/compose-no-devel/usr/bin/hello new file mode 100755 index 000000000..16a0c7cb6 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-no-devel/usr/bin/hello differ diff --git a/integration-tests/compose-test/expected/compose-no-devel/usr/lib/debug/hello b/integration-tests/compose-test/expected/compose-no-devel/usr/lib/debug/hello new file mode 100644 index 000000000..b3720a2b1 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-no-devel/usr/lib/debug/hello differ diff --git a/integration-tests/compose-test/expected/compose-no-devel/usr/share/doc/amhello/README b/integration-tests/compose-test/expected/compose-no-devel/usr/share/doc/amhello/README new file mode 100644 index 000000000..d24723a81 --- /dev/null +++ b/integration-tests/compose-test/expected/compose-no-devel/usr/share/doc/amhello/README @@ -0,0 +1,2 @@ +This is a demonstration package for GNU Automake. +Type `info Automake' to read the Automake manual. diff --git a/integration-tests/compose-test/expected/compose-no-doc/usr/bin/hello b/integration-tests/compose-test/expected/compose-no-doc/usr/bin/hello new file mode 100755 index 000000000..16a0c7cb6 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-no-doc/usr/bin/hello differ diff --git a/integration-tests/compose-test/expected/compose-no-doc/usr/lib/debug/hello b/integration-tests/compose-test/expected/compose-no-doc/usr/lib/debug/hello new file mode 100644 index 000000000..b3720a2b1 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-no-doc/usr/lib/debug/hello differ diff --git a/integration-tests/compose-test/expected/compose-no-doc/usr/share/.gitkeep b/integration-tests/compose-test/expected/compose-no-doc/usr/share/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/compose-test/expected/compose-no-locale/usr/bin/hello b/integration-tests/compose-test/expected/compose-no-locale/usr/bin/hello new file mode 100755 index 000000000..16a0c7cb6 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-no-locale/usr/bin/hello differ diff --git a/integration-tests/compose-test/expected/compose-no-locale/usr/lib/debug/hello b/integration-tests/compose-test/expected/compose-no-locale/usr/lib/debug/hello new file mode 100644 index 000000000..b3720a2b1 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-no-locale/usr/lib/debug/hello differ diff --git a/integration-tests/compose-test/expected/compose-no-locale/usr/share/doc/amhello/README b/integration-tests/compose-test/expected/compose-no-locale/usr/share/doc/amhello/README new file mode 100644 index 000000000..d24723a81 --- /dev/null +++ b/integration-tests/compose-test/expected/compose-no-locale/usr/share/doc/amhello/README @@ -0,0 +1,2 @@ +This is a demonstration package for GNU Automake. +Type `info Automake' to read the Automake manual. diff --git a/integration-tests/compose-test/expected/compose-no-test/usr/bin/hello b/integration-tests/compose-test/expected/compose-no-test/usr/bin/hello new file mode 100755 index 000000000..16a0c7cb6 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-no-test/usr/bin/hello differ diff --git a/integration-tests/compose-test/expected/compose-no-test/usr/lib/debug/hello b/integration-tests/compose-test/expected/compose-no-test/usr/lib/debug/hello new file mode 100644 index 000000000..b3720a2b1 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-no-test/usr/lib/debug/hello differ diff --git a/integration-tests/compose-test/expected/compose-no-test/usr/share/doc/amhello/README b/integration-tests/compose-test/expected/compose-no-test/usr/share/doc/amhello/README new file mode 100644 index 000000000..d24723a81 --- /dev/null +++ b/integration-tests/compose-test/expected/compose-no-test/usr/share/doc/amhello/README @@ -0,0 +1,2 @@ +This is a demonstration package for GNU Automake. +Type `info Automake' to read the Automake manual. diff --git a/integration-tests/compose-test/expected/compose-only-runtime/usr/bin/hello b/integration-tests/compose-test/expected/compose-only-runtime/usr/bin/hello new file mode 100755 index 000000000..16a0c7cb6 Binary files /dev/null and b/integration-tests/compose-test/expected/compose-only-runtime/usr/bin/hello differ diff --git a/integration-tests/compose-test/expected/compose-only-runtime/usr/lib/.gitkeep b/integration-tests/compose-test/expected/compose-only-runtime/usr/lib/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/compose-test/expected/compose-only-runtime/usr/share/.gitkeep b/integration-tests/compose-test/expected/compose-only-runtime/usr/share/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/compose-test/keys/gnome-sdk.gpg b/integration-tests/compose-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/compose-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/compose-test/project.conf b/integration-tests/compose-test/project.conf new file mode 100644 index 000000000..a5680225b --- /dev/null +++ b/integration-tests/compose-test/project.conf @@ -0,0 +1,19 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +split-rules: + test: + - | + /tests/* + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/compose-test/run-compose-test.sh b/integration-tests/compose-test/run-compose-test.sh new file mode 100644 index 000000000..7dfe19404 --- /dev/null +++ b/integration-tests/compose-test/run-compose-test.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + local bst_file + local tar_file + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + tar_file="$(dirname "$(readlink -f "$0")")/src/amhello.tar.gz" + bst_file="$(dirname "$(readlink -f "$0")")/elements/dependencies/amhello.bst" + + patch_file_location "$bst_file" "$tar_file" + + # Get rid of .gitkeep files + find . -name ".gitkeep" -exec rm {} \; + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/compose-test/src/amhello.tar.gz b/integration-tests/compose-test/src/amhello.tar.gz new file mode 100644 index 000000000..2850f31aa Binary files /dev/null and b/integration-tests/compose-test/src/amhello.tar.gz differ diff --git a/integration-tests/dpkg-build-test/.bst/workspaces.yml b/integration-tests/dpkg-build-test/.bst/workspaces.yml new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/dpkg-build-test/elements/dependencies/base-configure.bst b/integration-tests/dpkg-build-test/elements/dependencies/base-configure.bst new file mode 100644 index 000000000..deff782de --- /dev/null +++ b/integration-tests/dpkg-build-test/elements/dependencies/base-configure.bst @@ -0,0 +1,28 @@ +kind: script +depends: +- filename: dependencies/base-system.bst + type: build + +variables: + install-root: / + +config: + + commands: + - | + # Avoid some chowns which fail at dpkg configure time + # + mv /bin/chown /bin/chown.real + ln -s true /bin/chown + + - | + # This is expected to fail, but will configure everything we need + # at least for the purpose of building, other dpkg scripts which + # require real root privileges will always fail here. + DEBIAN_FRONTEND=noninteractive dpkg --configure -a --abort-after=100000 || exit 0 + + - | + # Restore chown + # + rm -f /bin/chown + mv /bin/chown.real /bin/chown diff --git a/integration-tests/dpkg-build-test/elements/dependencies/base-platform.bst b/integration-tests/dpkg-build-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/dpkg-build-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/dpkg-build-test/elements/dependencies/base-system.bst b/integration-tests/dpkg-build-test/elements/dependencies/base-system.bst new file mode 100644 index 000000000..d19a2b3b2 --- /dev/null +++ b/integration-tests/dpkg-build-test/elements/dependencies/base-system.bst @@ -0,0 +1,13 @@ +kind: manual +depends: +- filename: dependencies/base-platform.bst + type: build +sources: +- kind: git + url: https://gitlab.com/BuildStream/buildstream-sysroots.git + track: dpkg-build + ref: ecf14954e4298ce5495f701464339162fad73f30 +config: + install-commands: + - xz -d dpkg-build-sysroot.tar.xz + - tar xf dpkg-build-sysroot.tar -C %{install-root} --no-same-owner diff --git a/integration-tests/dpkg-build-test/elements/dpkg-build-test.bst b/integration-tests/dpkg-build-test/elements/dpkg-build-test.bst new file mode 100644 index 000000000..76b1104b8 --- /dev/null +++ b/integration-tests/dpkg-build-test/elements/dpkg-build-test.bst @@ -0,0 +1,10 @@ +kind: dpkg_build +description: dpkg-build test + +depends: +- filename: dependencies/base-configure.bst + type: build + +sources: +- kind: local + path: src diff --git a/integration-tests/dpkg-build-test/elements/dpkg-deploy-test.bst b/integration-tests/dpkg-build-test/elements/dpkg-deploy-test.bst new file mode 100644 index 000000000..ce277e4d6 --- /dev/null +++ b/integration-tests/dpkg-build-test/elements/dpkg-deploy-test.bst @@ -0,0 +1,12 @@ +kind: dpkg_deploy +description: dpkg-deploy test + +depends: +- filename: dependencies/base-configure.bst + type: build +- filename: dpkg-build-test.bst + type: build + +config: + base: dependencies/base-configure.bst + input: dpkg-build-test.bst diff --git a/integration-tests/dpkg-build-test/expected/dpkg-build-test/usr/share/doc/test/changelog.gz b/integration-tests/dpkg-build-test/expected/dpkg-build-test/usr/share/doc/test/changelog.gz new file mode 100644 index 000000000..bf2252c3c Binary files /dev/null and b/integration-tests/dpkg-build-test/expected/dpkg-build-test/usr/share/doc/test/changelog.gz differ diff --git a/integration-tests/dpkg-build-test/expected/dpkg-build-test/usr/share/foo b/integration-tests/dpkg-build-test/expected/dpkg-build-test/usr/share/foo new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/dpkg-build-test/expected/dpkg-deploy-test/test_0.1_amd64.deb b/integration-tests/dpkg-build-test/expected/dpkg-deploy-test/test_0.1_amd64.deb new file mode 100755 index 000000000..a10c4e673 Binary files /dev/null and b/integration-tests/dpkg-build-test/expected/dpkg-deploy-test/test_0.1_amd64.deb differ diff --git a/integration-tests/dpkg-build-test/keys/gnome-sdk.gpg b/integration-tests/dpkg-build-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/dpkg-build-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/dpkg-build-test/project.conf b/integration-tests/dpkg-build-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/dpkg-build-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/dpkg-build-test/run-dpkg-build-test.sh b/integration-tests/dpkg-build-test/run-dpkg-build-test.sh new file mode 100755 index 000000000..eb78c3f28 --- /dev/null +++ b/integration-tests/dpkg-build-test/run-dpkg-build-test.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# compare_debs +# +# Compares results to expected files for every .deb file found +# +# Args: +# test_name ($1) - The name of the test, for error reporting +# result_dir ($2) - The directory containing result files +# expected_dir ($3) - The directory containing expected files +# +# Returns: +# 1 if the debs are all equivalent, 0 otherwise. +compare_debs () ( + set +e + + local test_name="$1" + local result_dir="$2" + local expected_dir="$3" + + # First, expected and result must have the same .deb file lists + diff <(cd $result_dir/$test_name && find . -name "*.deb" | sort) <(cd $expected_dir/$test_name && find . -name "*.deb" | sort) + if [ "$?" -ne 0 ] + then + printf "%-34s ${RED}%9s${END}\n" "$test_name" "failed" + return 1 + fi + + for deb in $(cd $result_dir/$test_name && find . -name "*.deb"); do + result_deb="$result_dir/$test_name/$deb" + expected_deb="$expected_dir/$test_name/$deb" + diff <(dpkg-deb -c $result_deb | tr -s ' ' | cut -d' ' -f6) <(dpkg-deb -c $expected_deb | tr -s ' ' | cut -d' ' -f6) + if [ "$?" -ne 0 ] + then + printf "%-34s ${RED}%9s${END}\n" "$test_name" "failed" + return 1 + fi + done + printf "%-34s ${GREEN}%9s${END}\n" "$test_name" "succeeded" + return 0 +) + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + local bst_file + local tar_file + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + bst_with_flags build "$element_name".bst + echo "Built $element_name" + bst_with_flags checkout "$element_name".bst "$test_dir" + + exit=0 + if [ "$element" == "dpkg-deploy-test.bst" ]; then + compare_debs "$element_name" "$RESULTS" "$EXPECTED" || exit=$? + else + compare_results_no_contents "$element_name" "$RESULTS" "$EXPECTED" || exit=$? + fi + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/dpkg-build-test/src/Makefile b/integration-tests/dpkg-build-test/src/Makefile new file mode 100644 index 000000000..a14e4a7a7 --- /dev/null +++ b/integration-tests/dpkg-build-test/src/Makefile @@ -0,0 +1,9 @@ + +build: + $(shell touch foo) + +install: build + install -d $(DESTDIR)/usr/share + install -m 0644 foo $(DESTDIR)/usr/share/foo + +all: build install diff --git a/integration-tests/dpkg-build-test/src/debian/changelog b/integration-tests/dpkg-build-test/src/debian/changelog new file mode 100644 index 000000000..944fa6662 --- /dev/null +++ b/integration-tests/dpkg-build-test/src/debian/changelog @@ -0,0 +1,5 @@ +test (0.1) unstable; urgency=medium + + * Test + + -- Testy McTesterson Mon 17 Jul 2017 14:14:01 +0100 diff --git a/integration-tests/dpkg-build-test/src/debian/compat b/integration-tests/dpkg-build-test/src/debian/compat new file mode 100644 index 000000000..f599e28b8 --- /dev/null +++ b/integration-tests/dpkg-build-test/src/debian/compat @@ -0,0 +1 @@ +10 diff --git a/integration-tests/dpkg-build-test/src/debian/control b/integration-tests/dpkg-build-test/src/debian/control new file mode 100644 index 000000000..095cd661c --- /dev/null +++ b/integration-tests/dpkg-build-test/src/debian/control @@ -0,0 +1,5 @@ +Source: test + +Package: test +Architecture: any +Description: A test diff --git a/integration-tests/dpkg-build-test/src/debian/rules b/integration-tests/dpkg-build-test/src/debian/rules new file mode 100755 index 000000000..cbe925d75 --- /dev/null +++ b/integration-tests/dpkg-build-test/src/debian/rules @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +%: + dh $@ diff --git a/integration-tests/dpkg-build-test/src/debian/test.install b/integration-tests/dpkg-build-test/src/debian/test.install new file mode 100644 index 000000000..da897999b --- /dev/null +++ b/integration-tests/dpkg-build-test/src/debian/test.install @@ -0,0 +1 @@ +foo usr/share diff --git a/integration-tests/git-test/elements/dependencies/base-platform.bst b/integration-tests/git-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/git-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/git-test/elements/dependencies/base-sdk.bst b/integration-tests/git-test/elements/dependencies/base-sdk.bst new file mode 100644 index 000000000..cd191fd1b --- /dev/null +++ b/integration-tests/git-test/elements/dependencies/base-sdk.bst @@ -0,0 +1,20 @@ +kind: import +description: Import the base freedesktop SDK +config: + source: files + target: usr +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981 diff --git a/integration-tests/git-test/elements/git-test.bst b/integration-tests/git-test/elements/git-test.bst new file mode 100644 index 000000000..d981a5e74 --- /dev/null +++ b/integration-tests/git-test/elements/git-test.bst @@ -0,0 +1,19 @@ +kind: manual +description: bzr test + +depends: +- filename: dependencies/base-platform.bst + type: build +- filename: dependencies/base-sdk.bst + type: build + +sources: +- kind: git + url: file:///home/tristanmaat/Documents/Projects/buildstream/buildstream-tests/git-test/src + track: master + + ref: 11084171004f9e83f90a3c17615e6a6055435717 +config: + install-commands: + - mkdir -p %{install-root} + - ./test diff --git a/integration-tests/git-test/expected/out-git-test/test b/integration-tests/git-test/expected/out-git-test/test new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/integration-tests/git-test/expected/out-git-test/test @@ -0,0 +1 @@ +test diff --git a/integration-tests/git-test/keys/gnome-sdk.gpg b/integration-tests/git-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/git-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/git-test/project.conf b/integration-tests/git-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/git-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/git-test/run-git-test.sh b/integration-tests/git-test/run-git-test.sh new file mode 100644 index 000000000..04a0cb204 --- /dev/null +++ b/integration-tests/git-test/run-git-test.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + local bst_file + local tar_file + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + tar_file="$(dirname "$(readlink -f "$0")")/src" + bst_file="$(dirname "$(readlink -f "$0")")/elements/git-test.bst" + + patch_file_location "$bst_file" "$tar_file" + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/import-test/elements/import-src-test.bst b/integration-tests/import-test/elements/import-src-test.bst new file mode 100644 index 000000000..555e8aaf5 --- /dev/null +++ b/integration-tests/import-test/elements/import-src-test.bst @@ -0,0 +1,9 @@ +kind: import +description: Import test +config: + source: /sub-test + target: / + +sources: +- kind: local + path: source diff --git a/integration-tests/import-test/elements/import-sub-test.bst b/integration-tests/import-test/elements/import-sub-test.bst new file mode 100644 index 000000000..90e894ecc --- /dev/null +++ b/integration-tests/import-test/elements/import-sub-test.bst @@ -0,0 +1,9 @@ +kind: import +description: Import test +config: + source: / + target: / + +sources: +- kind: local + path: source/sub-test diff --git a/integration-tests/import-test/elements/import-test.bst b/integration-tests/import-test/elements/import-test.bst new file mode 100644 index 000000000..adfbe502e --- /dev/null +++ b/integration-tests/import-test/elements/import-test.bst @@ -0,0 +1,9 @@ +kind: import +description: Import test +config: + source: / + target: / + +sources: +- kind: local + path: source diff --git a/integration-tests/import-test/elements/import-tgt-test.bst b/integration-tests/import-test/elements/import-tgt-test.bst new file mode 100644 index 000000000..6a102c24d --- /dev/null +++ b/integration-tests/import-test/elements/import-tgt-test.bst @@ -0,0 +1,9 @@ +kind: import +description: Import test +config: + source: / + target: /output + +sources: +- kind: local + path: source diff --git a/integration-tests/import-test/expected/import-src-test/sub-test.txt b/integration-tests/import-test/expected/import-src-test/sub-test.txt new file mode 100644 index 000000000..d73906c87 --- /dev/null +++ b/integration-tests/import-test/expected/import-src-test/sub-test.txt @@ -0,0 +1 @@ +This is another test diff --git a/integration-tests/import-test/expected/import-sub-test/sub-test.txt b/integration-tests/import-test/expected/import-sub-test/sub-test.txt new file mode 100644 index 000000000..d73906c87 --- /dev/null +++ b/integration-tests/import-test/expected/import-sub-test/sub-test.txt @@ -0,0 +1 @@ +This is another test diff --git a/integration-tests/import-test/expected/import-test/sub-test/sub-test.txt b/integration-tests/import-test/expected/import-test/sub-test/sub-test.txt new file mode 100644 index 000000000..d73906c87 --- /dev/null +++ b/integration-tests/import-test/expected/import-test/sub-test/sub-test.txt @@ -0,0 +1 @@ +This is another test diff --git a/integration-tests/import-test/expected/import-test/test.txt b/integration-tests/import-test/expected/import-test/test.txt new file mode 100644 index 000000000..0527e6bd2 --- /dev/null +++ b/integration-tests/import-test/expected/import-test/test.txt @@ -0,0 +1 @@ +This is a test diff --git a/integration-tests/import-test/expected/import-tgt-test/output/sub-test/sub-test.txt b/integration-tests/import-test/expected/import-tgt-test/output/sub-test/sub-test.txt new file mode 100644 index 000000000..d73906c87 --- /dev/null +++ b/integration-tests/import-test/expected/import-tgt-test/output/sub-test/sub-test.txt @@ -0,0 +1 @@ +This is another test diff --git a/integration-tests/import-test/expected/import-tgt-test/output/test.txt b/integration-tests/import-test/expected/import-tgt-test/output/test.txt new file mode 100644 index 000000000..0527e6bd2 --- /dev/null +++ b/integration-tests/import-test/expected/import-tgt-test/output/test.txt @@ -0,0 +1 @@ +This is a test diff --git a/integration-tests/import-test/project.conf b/integration-tests/import-test/project.conf new file mode 100644 index 000000000..7a062116d --- /dev/null +++ b/integration-tests/import-test/project.conf @@ -0,0 +1,11 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: import-name + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/import-test/run-import-test.sh b/integration-tests/import-test/run-import-test.sh new file mode 100644 index 000000000..3b4472ff5 --- /dev/null +++ b/integration-tests/import-test/run-import-test.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/import-test/source/sub-test/sub-test.txt b/integration-tests/import-test/source/sub-test/sub-test.txt new file mode 100644 index 000000000..d73906c87 --- /dev/null +++ b/integration-tests/import-test/source/sub-test/sub-test.txt @@ -0,0 +1 @@ +This is another test diff --git a/integration-tests/import-test/source/test.txt b/integration-tests/import-test/source/test.txt new file mode 100644 index 000000000..0527e6bd2 --- /dev/null +++ b/integration-tests/import-test/source/test.txt @@ -0,0 +1 @@ +This is a test diff --git a/integration-tests/lib.sh b/integration-tests/lib.sh new file mode 100644 index 000000000..1e4ce1c37 --- /dev/null +++ b/integration-tests/lib.sh @@ -0,0 +1,185 @@ +GREEN="\e[0;32m" +YELLOW="\e[0;33m" +RED="\e[0;31m" +END="\e[0m" + +# patch_file_location +# +# Patch the location of a file in a file:// path. +# +# Args: +# bst ($1) - The bst file to patch. +# file ($2) - The file path to change to. +# +patch_file_location() { + local bst="$1" + local file="$2" + + sed -i "s|file://.*$|file://$file|" "$bst" +} + +# check_permissions +# +# Compare the user execute permissions between two files. +# +# Args: +# source ($1) - The first file +# target ($2) - The second file +# +# Returns: +# 1 if the permissions mismatch +# +check_permissions () { + local source="$1" + local target="$2" + local file_perm1 + local file_perm2 + + # This only checks executable permissions since git will not + # persist local permissions. + file_perm1=$(stat -c '%A' "$source" | sed 's/...\(.\).\+/\1/') + file_perm2=$(stat -c '%A' "$target" | sed 's/...\(.\).\+/\1/') + + if [ "$file_perm1" != "$file_perm2" ] + then + printf "Error: File permissions differ for files %s (%s) and %s (%s)" \ + "$source" "$(stat -c '%A' "$source")" \ + "$target" "$(stat -c '%A' "$target")\n" + return 1 + fi + return 0 +} + +# ensure_equal +# +# Recursively test for differences in content or permissions between +# the given directories. +# +# Args: +# src ($1) - The first directory +# target ($2) - The second directory +# +# Returns: +# 0 (bash true) if the files in the directories match, otherwise 1 +# if they mismatch +# +ensure_equal () ( + set +e + + local src="$1" + local target="$2" + + local target_file + local target_files + local source_file + + # Check for file differences + diff -r "$src" "$target" + if [ $? -ne 0 ] + then + echo "Error: Unexpected or missing file in '$src'" + return 1 + fi + + # Check for permission differences + target_files=$(find "$target") + for target_file in $target_files + do + source_file="$src${target_file#$target}" + + check_permissions "$source_file" "$target_file" + if [ $? -ne 0 ] + then + echo "Error: File permissions differ for files '$source_file' and '$target_file'" + return 1 + fi + done + + return 0 +) + +# bst_with_flags +# +# Call bst with the flags defined by the main script. +# +bst_with_flags() { + if [ ! -z "${BST_COVERAGE}" ]; then + coverage run --parallel-mode \ + --rcfile=${BST_COVERAGE} \ + $(which bst) -c "${CONFIG_LOCATION}" ${BST_FLAGS:-} "$@" + else + bst -c "${CONFIG_LOCATION}" ${BST_FLAGS:-} "$@" + fi +} + +# report_results +# +# Args: +# test_name ($1) - The name of the test +# success ($2) - A bash truthy integer (0 is True, non 0 is False) +report_results() { + test_name=$1 + success=$2 + + if [ "$success" -eq 0 ]; then + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + printf "%-34s ${GREEN}%9s${END}\n" "$test_name" "succeeded" + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + else + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + printf "%-34s ${RED}%9s${END}\n" "$test_name" "failed" + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + fi +} + +# compare_results +# +# Compare results to expected files, reporting success/failure for +# each test. +# +# Args: +# test_name ($1) - The name of the test, for error reporting +# result_dir ($2) - The directory containing result files +# expected_dir ($3) - The directory containing expected files +# +# Returns: +# 0 if the files are equal, 1 otherwise. +# +compare_results() ( + set +e + + local test_name="$1" + local result_dir="$2" + local expected_dir="$3" + + ensure_equal "$result_dir/$test_name" "$expected_dir/$test_name" + + local success=$? + report_results $test_name $success + return $success +) + +# comare_results_no_contents +# +# Compare results to expected files, ignoring the contents of the files, +# reporting success/failure for each test. +# +# Args: +# test_name ($1) - The name of the test, for error reporting +# result_dir ($2) - The directory containing result files +# expected_dir ($3) - The directory containing expected files +# +# Returns: +# 1 if the dirs are equivalent, 0 otherwise. +compare_results_no_contents() ( + set +e + + local test_name="$1" + local result_dir="$2" + local expected_dir="$3" + + diff <(cd $result_dir/$test_name && find . | sort) <(cd $expected_dir/$test_name && find . | sort) + local success=$? + report_results $test_name $success + return $success +) diff --git a/integration-tests/local-test/elements/dependencies/base-platform.bst b/integration-tests/local-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/local-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/local-test/elements/dependencies/base-sdk.bst b/integration-tests/local-test/elements/dependencies/base-sdk.bst new file mode 100644 index 000000000..cd191fd1b --- /dev/null +++ b/integration-tests/local-test/elements/dependencies/base-sdk.bst @@ -0,0 +1,20 @@ +kind: import +description: Import the base freedesktop SDK +config: + source: files + target: usr +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981 diff --git a/integration-tests/local-test/elements/local-test.bst b/integration-tests/local-test/elements/local-test.bst new file mode 100644 index 000000000..8af8b7848 --- /dev/null +++ b/integration-tests/local-test/elements/local-test.bst @@ -0,0 +1,18 @@ +kind: manual +description: bzr test + +depends: +- filename: dependencies/base-platform.bst + type: build +- filename: dependencies/base-sdk.bst + type: build + +sources: +- kind: local + path: src + directory: somewhere + +config: + install-commands: + - "mkdir -p %{install-root}" + - "somewhere/test" diff --git a/integration-tests/local-test/expected/local-test/test b/integration-tests/local-test/expected/local-test/test new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/integration-tests/local-test/expected/local-test/test @@ -0,0 +1 @@ +test diff --git a/integration-tests/local-test/keys/gnome-sdk.gpg b/integration-tests/local-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/local-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/local-test/project.conf b/integration-tests/local-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/local-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/local-test/run-local-test.sh b/integration-tests/local-test/run-local-test.sh new file mode 100644 index 000000000..4169a4a44 --- /dev/null +++ b/integration-tests/local-test/run-local-test.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + local bst_file + local tar_file + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/local-test/src/test b/integration-tests/local-test/src/test new file mode 100755 index 000000000..6a834ea0a --- /dev/null +++ b/integration-tests/local-test/src/test @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo 'test' > /buildstream/install/test diff --git a/integration-tests/manual-test/elements/dependencies/base-platform.bst b/integration-tests/manual-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/manual-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/manual-test/elements/manual-environment-test.bst b/integration-tests/manual-test/elements/manual-environment-test.bst new file mode 100644 index 000000000..d57b5f7bc --- /dev/null +++ b/integration-tests/manual-test/elements/manual-environment-test.bst @@ -0,0 +1,21 @@ +kind: manual +description: Manual test + +variables: + max-jobs: 2 + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + install-commands: + - "echo $MAKEFLAGS >> test" + - "echo $V >> test" + - "cp test %{install-root}" + +environment: + MAKEFLAGS: -j%{max-jobs} -Wall + V: 2 + +# FIXME: Test environment-nocache diff --git a/integration-tests/manual-test/elements/manual-noparallel-test.bst b/integration-tests/manual-test/elements/manual-noparallel-test.bst new file mode 100644 index 000000000..3655d1fe8 --- /dev/null +++ b/integration-tests/manual-test/elements/manual-noparallel-test.bst @@ -0,0 +1,20 @@ +kind: manual +description: Manual test + +variables: + max-jobs: 2 + notparallel: True + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + install-commands: + - "echo $MAKEFLAGS >> test" + - "echo $V >> test" + - "cp test %{install-root}" + +environment: + MAKEFLAGS: -j%{max-jobs} -Wall + V: 2 diff --git a/integration-tests/manual-test/elements/manual-test.bst b/integration-tests/manual-test/elements/manual-test.bst new file mode 100644 index 000000000..f3fde3789 --- /dev/null +++ b/integration-tests/manual-test/elements/manual-test.bst @@ -0,0 +1,20 @@ +kind: manual +description: Manual test + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + configure-commands: + - "echo './configure' >> test" + + build-commands: + - "echo 'make' >> test" + + install-commands: + - "echo 'make install' >> test" + - "cp test %{install-root}" + + strip-commands: + - "echo 'strip' >> %{install-root}/test" diff --git a/integration-tests/manual-test/expected/manual-environment-test/test b/integration-tests/manual-test/expected/manual-environment-test/test new file mode 100644 index 000000000..9743f83af --- /dev/null +++ b/integration-tests/manual-test/expected/manual-environment-test/test @@ -0,0 +1,2 @@ +-j2 -Wall +2 diff --git a/integration-tests/manual-test/expected/manual-noparallel-test/test b/integration-tests/manual-test/expected/manual-noparallel-test/test new file mode 100644 index 000000000..19d9a0ba9 --- /dev/null +++ b/integration-tests/manual-test/expected/manual-noparallel-test/test @@ -0,0 +1,2 @@ +-j1 -Wall +2 diff --git a/integration-tests/manual-test/expected/manual-test/test b/integration-tests/manual-test/expected/manual-test/test new file mode 100644 index 000000000..236ca4dc7 --- /dev/null +++ b/integration-tests/manual-test/expected/manual-test/test @@ -0,0 +1,4 @@ +./configure +make +make install +strip diff --git a/integration-tests/manual-test/keys/gnome-sdk.gpg b/integration-tests/manual-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/manual-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/manual-test/project.conf b/integration-tests/manual-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/manual-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/manual-test/run-manual-test.sh b/integration-tests/manual-test/run-manual-test.sh new file mode 100644 index 000000000..3b4472ff5 --- /dev/null +++ b/integration-tests/manual-test/run-manual-test.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/ostree-test/elements/dependencies/base-platform.bst b/integration-tests/ostree-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/ostree-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/ostree-test/elements/dependencies/base-sdk.bst b/integration-tests/ostree-test/elements/dependencies/base-sdk.bst new file mode 100644 index 000000000..cd191fd1b --- /dev/null +++ b/integration-tests/ostree-test/elements/dependencies/base-sdk.bst @@ -0,0 +1,20 @@ +kind: import +description: Import the base freedesktop SDK +config: + source: files + target: usr +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981 diff --git a/integration-tests/ostree-test/elements/ostree-test.bst b/integration-tests/ostree-test/elements/ostree-test.bst new file mode 100644 index 000000000..41bc43f25 --- /dev/null +++ b/integration-tests/ostree-test/elements/ostree-test.bst @@ -0,0 +1,20 @@ +kind: manual +description: bzr test + +depends: +- filename: dependencies/base-platform.bst + type: build +- filename: dependencies/base-sdk.bst + type: build + +sources: +- kind: ostree + url: file:///home/tristanmaat/Documents/Projects/buildstream/buildstream-tests/ostree-test/src + directory: somewhere + track: test + ref: bd5cc009f076d4fb696447bb671512e71897eacc2fc198c98d3af69fcdf59f11 + +config: + install-commands: + - mkdir -p %{install-root} + - somewhere/test diff --git a/integration-tests/ostree-test/expected/ostree-test/test b/integration-tests/ostree-test/expected/ostree-test/test new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/integration-tests/ostree-test/expected/ostree-test/test @@ -0,0 +1 @@ +test diff --git a/integration-tests/ostree-test/keys/gnome-sdk.gpg b/integration-tests/ostree-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/ostree-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/ostree-test/project.conf b/integration-tests/ostree-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/ostree-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/ostree-test/run-ostree-test.sh b/integration-tests/ostree-test/run-ostree-test.sh new file mode 100644 index 000000000..fd78b86c2 --- /dev/null +++ b/integration-tests/ostree-test/run-ostree-test.sh @@ -0,0 +1,71 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + local bst_file + local tar_file + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + + tar_file="$(dirname "$(readlink -f "$0")")/src" + bst_file="$(dirname "$(readlink -f "$0")")/elements/ostree-test.bst" + + patch_file_location "$bst_file" "$tar_file" + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/ostree-test/src/config b/integration-tests/ostree-test/src/config new file mode 100644 index 000000000..83b6be119 --- /dev/null +++ b/integration-tests/ostree-test/src/config @@ -0,0 +1,3 @@ +[core] +repo_version=1 +mode=bare diff --git a/integration-tests/ostree-test/src/objects/16/f79cc2a8fa211af59ae76342580fe71b3b43e63ee91ed8be6082a035f7b4b4.dirmeta b/integration-tests/ostree-test/src/objects/16/f79cc2a8fa211af59ae76342580fe71b3b43e63ee91ed8be6082a035f7b4b4.dirmeta new file mode 100644 index 000000000..dd4d5e346 Binary files /dev/null and b/integration-tests/ostree-test/src/objects/16/f79cc2a8fa211af59ae76342580fe71b3b43e63ee91ed8be6082a035f7b4b4.dirmeta differ diff --git a/integration-tests/ostree-test/src/objects/4d/0530fd08875e2e64dab3d48124c2e69ed88a39f02753009d6575583e95d052.file b/integration-tests/ostree-test/src/objects/4d/0530fd08875e2e64dab3d48124c2e69ed88a39f02753009d6575583e95d052.file new file mode 100644 index 000000000..6a834ea0a --- /dev/null +++ b/integration-tests/ostree-test/src/objects/4d/0530fd08875e2e64dab3d48124c2e69ed88a39f02753009d6575583e95d052.file @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo 'test' > /buildstream/install/test diff --git a/integration-tests/ostree-test/src/objects/6d/ed2d0c1f4799e7e1b3e2eeabb0877ae17e12abc77734c5253dcd1317b3cbc2.dirtree b/integration-tests/ostree-test/src/objects/6d/ed2d0c1f4799e7e1b3e2eeabb0877ae17e12abc77734c5253dcd1317b3cbc2.dirtree new file mode 100644 index 000000000..015ececa7 Binary files /dev/null and b/integration-tests/ostree-test/src/objects/6d/ed2d0c1f4799e7e1b3e2eeabb0877ae17e12abc77734c5253dcd1317b3cbc2.dirtree differ diff --git a/integration-tests/ostree-test/src/objects/bd/5cc009f076d4fb696447bb671512e71897eacc2fc198c98d3af69fcdf59f11.commit b/integration-tests/ostree-test/src/objects/bd/5cc009f076d4fb696447bb671512e71897eacc2fc198c98d3af69fcdf59f11.commit new file mode 100644 index 000000000..3ffd63686 Binary files /dev/null and b/integration-tests/ostree-test/src/objects/bd/5cc009f076d4fb696447bb671512e71897eacc2fc198c98d3af69fcdf59f11.commit differ diff --git a/integration-tests/ostree-test/src/refs/heads/test b/integration-tests/ostree-test/src/refs/heads/test new file mode 100644 index 000000000..54c511fb1 --- /dev/null +++ b/integration-tests/ostree-test/src/refs/heads/test @@ -0,0 +1 @@ +bd5cc009f076d4fb696447bb671512e71897eacc2fc198c98d3af69fcdf59f11 diff --git a/integration-tests/ostree-test/tree/test b/integration-tests/ostree-test/tree/test new file mode 100644 index 000000000..6a834ea0a --- /dev/null +++ b/integration-tests/ostree-test/tree/test @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo 'test' > /buildstream/install/test diff --git a/integration-tests/pip-test/elements/dependencies/base-platform.bst b/integration-tests/pip-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..9cf033f46 --- /dev/null +++ b/integration-tests/pip-test/elements/dependencies/base-platform.bst @@ -0,0 +1,22 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.6 + gpg-key: keys/gnome-sdk.gpg + ref: 9a2d4d9b4a2cf4e1ddcfd1b696e5cefba35d62b70ef61435b15ea3cb905cc4cf + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.6 + gpg-key: keys/gnome-sdk.gpg diff --git a/integration-tests/pip-test/elements/dependencies/base-sdk.bst b/integration-tests/pip-test/elements/dependencies/base-sdk.bst new file mode 100644 index 000000000..72f28ce62 --- /dev/null +++ b/integration-tests/pip-test/elements/dependencies/base-sdk.bst @@ -0,0 +1,19 @@ +kind: import +description: Import the base freedesktop SDK +config: + source: files + target: usr +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/x86_64/1.6 + gpg-key: keys/gnome-sdk.gpg + ref: fa0dbd1b1eee9ec89518c1938c89803e0c54a12cd7ce892082433ad56b8a6f9b + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/i386/1.6 + gpg-key: keys/gnome-sdk.gpg diff --git a/integration-tests/pip-test/elements/hello-run.bst b/integration-tests/pip-test/elements/hello-run.bst new file mode 100644 index 000000000..be577be8a --- /dev/null +++ b/integration-tests/pip-test/elements/hello-run.bst @@ -0,0 +1,14 @@ +kind: script +description: Run pip-built binary + +depends: +- filename: dependencies/base-platform.bst + type: build +- filename: dependencies/base-sdk.bst + type: build +- filename: hello.bst + type: build + +config: + commands: + - "/usr/bin/hello > /buildstream/install/test" diff --git a/integration-tests/pip-test/elements/hello.bst b/integration-tests/pip-test/elements/hello.bst new file mode 100644 index 000000000..3d02428db --- /dev/null +++ b/integration-tests/pip-test/elements/hello.bst @@ -0,0 +1,16 @@ +kind: pip +description: Pip test + +variables: + pip: pip3 + +depends: +- filename: dependencies/base-platform.bst + type: build +- filename: dependencies/base-sdk.bst + type: build + +sources: +- kind: tar + url: file:///hello.tar.xz + ref: ad96570b552498807abec33c06210bf68378d854ced6753b77916c5ed517610d diff --git a/integration-tests/pip-test/expected/hello-run/test b/integration-tests/pip-test/expected/hello-run/test new file mode 100644 index 000000000..af5626b4a --- /dev/null +++ b/integration-tests/pip-test/expected/hello-run/test @@ -0,0 +1 @@ +Hello, world! diff --git a/integration-tests/pip-test/expected/hello/usr/bin/hello b/integration-tests/pip-test/expected/hello/usr/bin/hello new file mode 100755 index 000000000..c1cd3ca66 --- /dev/null +++ b/integration-tests/pip-test/expected/hello/usr/bin/hello @@ -0,0 +1,10 @@ +#!/usr/bin/python3 +# EASY-INSTALL-ENTRY-SCRIPT: 'hello==0.1','console_scripts','hello' +__requires__ = 'hello==0.1' +import sys +from pkg_resources import load_entry_point + +if __name__ == '__main__': + sys.exit( + load_entry_point('hello==0.1', 'console_scripts', 'hello')() + ) diff --git a/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/PKG-INFO b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/PKG-INFO new file mode 100644 index 000000000..9e9aa2fe6 --- /dev/null +++ b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/PKG-INFO @@ -0,0 +1,10 @@ +Metadata-Version: 1.0 +Name: hello +Version: 0.1 +Summary: Hello, world! +Home-page: UNKNOWN +Author: Mathieu Bridon +Author-email: bochecha@daitauha.fr +License: MIT +Description: A dummy project to test the pip element in BuildStream +Platform: UNKNOWN diff --git a/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/SOURCES.txt b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/SOURCES.txt new file mode 100644 index 000000000..613c32f69 --- /dev/null +++ b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/SOURCES.txt @@ -0,0 +1,6 @@ +hello/__init__.py +hello.egg-info/PKG-INFO +hello.egg-info/SOURCES.txt +hello.egg-info/dependency_links.txt +hello.egg-info/entry_points.txt +hello.egg-info/top_level.txt \ No newline at end of file diff --git a/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/dependency_links.txt b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/dependency_links.txt new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/entry_points.txt b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/entry_points.txt new file mode 100644 index 000000000..f65ce1f13 --- /dev/null +++ b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/entry_points.txt @@ -0,0 +1,3 @@ +[console_scripts] +hello = hello:main + diff --git a/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/installed-files.txt b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/installed-files.txt new file mode 100644 index 000000000..a6a125251 --- /dev/null +++ b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/installed-files.txt @@ -0,0 +1,8 @@ +../../../../bin/hello +../hello/__init__.py +../hello/__pycache__/__init__.cpython-35.pyc +PKG-INFO +SOURCES.txt +dependency_links.txt +entry_points.txt +top_level.txt diff --git a/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/top_level.txt b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/top_level.txt new file mode 100644 index 000000000..ce0136250 --- /dev/null +++ b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello-0.1-py3.5.egg-info/top_level.txt @@ -0,0 +1 @@ +hello diff --git a/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello/__init__.py b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello/__init__.py new file mode 100644 index 000000000..4e00169b0 --- /dev/null +++ b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello/__init__.py @@ -0,0 +1,12 @@ +def hello(name='world'): + return 'Hello, {name}!'.format(name=name) + + +def main(): + import argparse + + parser = argparse.ArgumentParser() + parser.add_argument('name', nargs='?', default='world') + args = parser.parse_args() + + print(hello(args.name)) diff --git a/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello/__pycache__/__init__.cpython-35.pyc b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello/__pycache__/__init__.cpython-35.pyc new file mode 100644 index 000000000..19f41ac78 Binary files /dev/null and b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello/__pycache__/__init__.cpython-35.pyc differ diff --git a/integration-tests/pip-test/keys/gnome-sdk.gpg b/integration-tests/pip-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/pip-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/pip-test/project.conf b/integration-tests/pip-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/pip-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/pip-test/run-pip-test.sh b/integration-tests/pip-test/run-pip-test.sh new file mode 100644 index 000000000..42f408b47 --- /dev/null +++ b/integration-tests/pip-test/run-pip-test.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + local bst_file + local tar_file + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + tar_file="$(dirname "$(readlink -f "$0")")/src/hello.tar.xz" + bst_file="$(dirname "$(readlink -f "$0")")/elements/hello.bst" + + patch_file_location "$bst_file" "$tar_file" + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + bst_with_flags build "$element_name".bst + bst_with_flags checkout "$element_name".bst "$test_dir" + + exit=0 + + # Unfortunately the order written by Pip is not deterministic + # https://github.com/pypa/pip/pull/4667 + for FILE in $(find "$RESULTS" -name 'installed-files.txt'); do + LC_ALL=C sort "$FILE" > "$FILE.tmp" + mv "$FILE.tmp" "$FILE" + done + + compare_results "$element_name" "$RESULTS" "$EXPECTED" || exit=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/pip-test/src/hello.tar.xz b/integration-tests/pip-test/src/hello.tar.xz new file mode 100644 index 000000000..72ec9b399 Binary files /dev/null and b/integration-tests/pip-test/src/hello.tar.xz differ diff --git a/integration-tests/run-test.sh b/integration-tests/run-test.sh new file mode 100755 index 000000000..f166d2f89 --- /dev/null +++ b/integration-tests/run-test.sh @@ -0,0 +1,273 @@ +#!/bin/bash + +set -u + +GREEN="\e[0;32m" +YELLOW="\e[0;33m" +RED="\e[0;31m" +END="\e[0m" + +usage () { + cat <|--arg ] [] + +Run various commands to test bst. + +Commands: + + test Run the test suite. If no arguments are given, the full + suite is run, otherwise the given arguments will be run + run Run the test suite. (Does not clean) + clean Clean temporary test files + omit Omit the given test from test runs + include Include the given test in test runs + +Options: + --help Display this help message and exit + --arg Specify an argument for bst, such as --colors + --cov Specify a coverage rcfile + --sources Specify a location for the source cache +EOF +} + +BST_COVERAGE= +BST_FLAGS= +BST_SOURCE_CACHE= +export BST_COVERAGE +export BST_FLAGS +export BST_SOURCE_CACHE + +main () { + while : ; + do + case "${1:-}" in + "test") + shift + configure + clean "$@" + run "$@" + break ;; + "run") + shift + configure + run "$@" + break ;; + "clean") + shift + clean "$@" + break ;; + "omit") + shift + omit "$@" + break ;; + "include") + shift + include "$@" + break ;; + --sources) + export BST_SOURCE_CACHE=$(realpath "${2}") + shift 2 ;; + -c|--cov) + export BST_COVERAGE=$(realpath "${2}") + shift 2 ;; + -a|--arg) + export BST_FLAGS="${BST_FLAGS:-} $2" + shift 2 ;; + -h|--help) + usage + break ;; + *) + echo "Error: Unrecognized argument '${1:-}'" 1>&2 + usage + break ;; + esac + done +} + + +# configure +# +# Creates the buildstream.conf configuration +configure () { + # Treat source cache specially, we want to reuse it when + # running automated CI + if [ -z "${BST_SOURCE_CACHE}" ]; then + BST_SOURCE_CACHE="$(pwd)/tmp/sources" + fi + + # Create buildstream.conf + cat > "$(pwd)/buildstream.conf" <&1 + return 1 + fi +} + +# omit +# +# Ignore the given test during future test runs +# +# Args: +# test ($1) - The test to ignore +# +omit() { + local test="$1" + + # Tell the user if we don't need to omit the file + touch .omit + if grep -q "$test" .omit + then + echo "Test $test is already omitted." 2>&1 + exit 1 + fi + + if [ -d "$test" ] + then + echo "$test" >> .omit + else + echo "No such test." 2>&1 + exit 1 + fi +} + +# include +# +# After a test has been omitted, re-include it +# +# Args: +# test ($1) - The test to include +# +include() { + local test="$1" + + local temp + + touch .omit + + # Make a temporary file to inverse grep to + temp=$(mktemp) + + # Tell the user if we don't need to include the file + if ! grep -q "$test" .omit + then + echo "Test $test is already included." 2>&1 + exit 1 + fi + + # Remove the line containing the test string + grep -v "$test" .omit > "$temp"; mv "$temp" .omit +} + +main "$@" diff --git a/integration-tests/script-test/elements/dependencies/base-platform.bst b/integration-tests/script-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/script-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/script-test/elements/script-cwd-test.bst b/integration-tests/script-test/elements/script-cwd-test.bst new file mode 100644 index 000000000..48b25fb07 --- /dev/null +++ b/integration-tests/script-test/elements/script-cwd-test.bst @@ -0,0 +1,14 @@ +kind: script +description: Write to root using a script element + +variables: + cwd: /buildstream + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + commands: + - "echo 'test' > test" + - "cp /buildstream/test %{install-root}" diff --git a/integration-tests/script-test/elements/script-layout-test.bst b/integration-tests/script-test/elements/script-layout-test.bst new file mode 100644 index 000000000..bb623a88f --- /dev/null +++ b/integration-tests/script-test/elements/script-layout-test.bst @@ -0,0 +1,23 @@ +kind: script +description: Write to root using a script element + +variables: + install-root: /buildstream/nstall + build-root: /buildstream/uild + +depends: + - filename: dependencies/base-platform.bst + type: build + - filename: script-test.bst + type: build + +config: + layout: + - element: dependencies/base-platform.bst + destination: / + + - element: script-test.bst + destination: "%{build-root}" + + commands: + - "cp %{build-root}/test %{install-root}" diff --git a/integration-tests/script-test/elements/script-no-root-test.bst b/integration-tests/script-test/elements/script-no-root-test.bst new file mode 100644 index 000000000..2a40202d5 --- /dev/null +++ b/integration-tests/script-test/elements/script-no-root-test.bst @@ -0,0 +1,12 @@ +kind: script +description: Write to root using a script element + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + commands: + - "mkdir -p /buildstream/install" + - "echo 'I can not write to root' > /test" + - "cp /test /buildstream/install" diff --git a/integration-tests/script-test/elements/script-root-test.bst b/integration-tests/script-test/elements/script-root-test.bst new file mode 100644 index 000000000..4b2045e6f --- /dev/null +++ b/integration-tests/script-test/elements/script-root-test.bst @@ -0,0 +1,14 @@ +kind: script +description: Write to root using a script element + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + root-read-only: False + + commands: + - "mkdir -p /buildstream/install" + - "echo 'I can write to root' > /test" + - "cp /test /buildstream/install" diff --git a/integration-tests/script-test/elements/script-test.bst b/integration-tests/script-test/elements/script-test.bst new file mode 100644 index 000000000..8ea31e0fe --- /dev/null +++ b/integration-tests/script-test/elements/script-test.bst @@ -0,0 +1,11 @@ +kind: script +description: Script test + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + commands: + - "mkdir -p /buildstream/install" + - "echo 'Hi' > /buildstream/install/test" diff --git a/integration-tests/script-test/expected/script-cwd-test/test b/integration-tests/script-test/expected/script-cwd-test/test new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/integration-tests/script-test/expected/script-cwd-test/test @@ -0,0 +1 @@ +test diff --git a/integration-tests/script-test/expected/script-layout-test/test b/integration-tests/script-test/expected/script-layout-test/test new file mode 100644 index 000000000..b14df6442 --- /dev/null +++ b/integration-tests/script-test/expected/script-layout-test/test @@ -0,0 +1 @@ +Hi diff --git a/integration-tests/script-test/expected/script-no-root-test/test b/integration-tests/script-test/expected/script-no-root-test/test new file mode 100644 index 000000000..520aaba9b --- /dev/null +++ b/integration-tests/script-test/expected/script-no-root-test/test @@ -0,0 +1 @@ +I can not write to root diff --git a/integration-tests/script-test/expected/script-root-test/test b/integration-tests/script-test/expected/script-root-test/test new file mode 100644 index 000000000..0987e6f11 --- /dev/null +++ b/integration-tests/script-test/expected/script-root-test/test @@ -0,0 +1 @@ +I can write to root diff --git a/integration-tests/script-test/expected/script-test/test b/integration-tests/script-test/expected/script-test/test new file mode 100644 index 000000000..b14df6442 --- /dev/null +++ b/integration-tests/script-test/expected/script-test/test @@ -0,0 +1 @@ +Hi diff --git a/integration-tests/script-test/keys/gnome-sdk.gpg b/integration-tests/script-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/script-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/script-test/project.conf b/integration-tests/script-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/script-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/script-test/run-script-test.sh b/integration-tests/script-test/run-script-test.sh new file mode 100644 index 000000000..3b4472ff5 --- /dev/null +++ b/integration-tests/script-test/run-script-test.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/shell-test/.bst/workspaces.yml b/integration-tests/shell-test/.bst/workspaces.yml new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/shell-test/elements/dependencies/base-platform.bst b/integration-tests/shell-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/shell-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/shell-test/keys/gnome-sdk.gpg b/integration-tests/shell-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/shell-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/shell-test/project.conf b/integration-tests/shell-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/shell-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/shell-test/run-shell-test.sh b/integration-tests/shell-test/run-shell-test.sh new file mode 100644 index 000000000..4de4b4a3b --- /dev/null +++ b/integration-tests/shell-test/run-shell-test.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + +ECHO_TEST_KEY="1234567890abcdefghijklmnopqrstuvwzyz" + +set -eu +source ../lib.sh + +assert_expected_key () { + + local test_name=$1 + local success=0 + + # Assert that the test key we echoed in our runtime made it to stdout and that we + # captured it in the output file. + if ! grep "${ECHO_TEST_KEY}" shell.out > /dev/null + then + success=1 + else + success=0 + fi + + report_results "$test_name" $success + return $success +} + +# run_test +# +# Run tests for this test case. +# +run_test () { + local success=0 + + bst_with_flags build "dependencies/base-platform.bst" + + bst_with_flags shell "dependencies/base-platform.bst" -- sh -c "echo ${ECHO_TEST_KEY}" | tee shell.out + assert_expected_key 'sh -c "echo ${ECHO_TEST_KEY}"' + if [ $? -ne 0 ]; then + success=1 + fi + + bst_with_flags shell "dependencies/base-platform.bst" -- /bin/echo ${ECHO_TEST_KEY} | tee shell.out + assert_expected_key "/bin/echo ${ECHO_TEST_KEY}" + if [ $? -ne 0 ]; then + success=1 + fi + + bst_with_flags shell "dependencies/base-platform.bst" -- sh -c "printf \"${ECHO_TEST_KEY}\n\"" | tee shell.out + assert_expected_key 'sh -c "printf \"${ECHO_TEST_KEY}\n\""' + if [ $? -ne 0 ]; then + success=1 + fi + + return $success +} + +run_test "$@" diff --git a/integration-tests/stack-test/elements/dependencies/another-hi.bst b/integration-tests/stack-test/elements/dependencies/another-hi.bst new file mode 100644 index 000000000..c2b273dec --- /dev/null +++ b/integration-tests/stack-test/elements/dependencies/another-hi.bst @@ -0,0 +1,11 @@ +kind: script +description: Another hi test + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + commands: + - "mkdir -p /buildstream/install" + - "echo 'Another hi' > /buildstream/install/another-hi" diff --git a/integration-tests/stack-test/elements/dependencies/base-platform.bst b/integration-tests/stack-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/stack-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/stack-test/elements/dependencies/hi.bst b/integration-tests/stack-test/elements/dependencies/hi.bst new file mode 100644 index 000000000..0b15e8761 --- /dev/null +++ b/integration-tests/stack-test/elements/dependencies/hi.bst @@ -0,0 +1,11 @@ +kind: script +description: Hi test + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + commands: + - "mkdir -p /buildstream/install" + - "echo 'Hi' > /buildstream/install/hi" diff --git a/integration-tests/stack-test/elements/stack-test.bst b/integration-tests/stack-test/elements/stack-test.bst new file mode 100644 index 000000000..4141dcc17 --- /dev/null +++ b/integration-tests/stack-test/elements/stack-test.bst @@ -0,0 +1,6 @@ +kind: stack +description: Stack test + +depends: + - dependencies/hi.bst + - dependencies/another-hi.bst diff --git a/integration-tests/stack-test/expected/stack-test/another-hi b/integration-tests/stack-test/expected/stack-test/another-hi new file mode 100644 index 000000000..42fa76d82 --- /dev/null +++ b/integration-tests/stack-test/expected/stack-test/another-hi @@ -0,0 +1 @@ +Another hi diff --git a/integration-tests/stack-test/expected/stack-test/hi b/integration-tests/stack-test/expected/stack-test/hi new file mode 100644 index 000000000..b14df6442 --- /dev/null +++ b/integration-tests/stack-test/expected/stack-test/hi @@ -0,0 +1 @@ +Hi diff --git a/integration-tests/stack-test/keys/gnome-sdk.gpg b/integration-tests/stack-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/stack-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/stack-test/project.conf b/integration-tests/stack-test/project.conf new file mode 100644 index 000000000..7f1e9370c --- /dev/null +++ b/integration-tests/stack-test/project.conf @@ -0,0 +1,11 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/stack-test/run-stack-test.sh b/integration-tests/stack-test/run-stack-test.sh new file mode 100644 index 000000000..3b4472ff5 --- /dev/null +++ b/integration-tests/stack-test/run-stack-test.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/tar-test/elements/dependencies/base-platform.bst b/integration-tests/tar-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/tar-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/tar-test/elements/dependencies/base-sdk.bst b/integration-tests/tar-test/elements/dependencies/base-sdk.bst new file mode 100644 index 000000000..cd191fd1b --- /dev/null +++ b/integration-tests/tar-test/elements/dependencies/base-sdk.bst @@ -0,0 +1,20 @@ +kind: import +description: Import the base freedesktop SDK +config: + source: files + target: usr +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BaseSdk/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981 diff --git a/integration-tests/tar-test/elements/tar-test.bst b/integration-tests/tar-test/elements/tar-test.bst new file mode 100644 index 000000000..193cfc837 --- /dev/null +++ b/integration-tests/tar-test/elements/tar-test.bst @@ -0,0 +1,18 @@ +kind: manual +description: tar test + +depends: +- filename: dependencies/base-platform.bst + type: build +- filename: dependencies/base-sdk.bst + type: build + +sources: +- kind: tar + url: file:///home/tristanmaat/Documents/Projects/buildstream/buildstream-tests/tar-test/src.tar.gz + + ref: 164ab309db28e97e96896eb830a04dc3558444fb870ab3930694b5b160327d88 +config: + install-commands: + - mkdir -p %{install-root} + - ./test diff --git a/integration-tests/tar-test/expected/tar-test/test b/integration-tests/tar-test/expected/tar-test/test new file mode 100644 index 000000000..9daeafb98 --- /dev/null +++ b/integration-tests/tar-test/expected/tar-test/test @@ -0,0 +1 @@ +test diff --git a/integration-tests/tar-test/keys/gnome-sdk.gpg b/integration-tests/tar-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/tar-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/tar-test/project.conf b/integration-tests/tar-test/project.conf new file mode 100644 index 000000000..4212ca3d1 --- /dev/null +++ b/integration-tests/tar-test/project.conf @@ -0,0 +1,14 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +aliases: + gnomesdk: https://sdk.gnome.org/ + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/tar-test/run-tar-test.sh b/integration-tests/tar-test/run-tar-test.sh new file mode 100644 index 000000000..7e2256374 --- /dev/null +++ b/integration-tests/tar-test/run-tar-test.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + local bst_file + local tar_file + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + tar_file="$(dirname "$(readlink -f "$0")")/src.tar.gz" + bst_file="$(dirname "$(readlink -f "$0")")/elements/tar-test.bst" + + patch_file_location "$bst_file" "$tar_file" + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" diff --git a/integration-tests/tar-test/src.tar.gz b/integration-tests/tar-test/src.tar.gz new file mode 100644 index 000000000..e68c4e99b Binary files /dev/null and b/integration-tests/tar-test/src.tar.gz differ diff --git a/integration-tests/x86image-test/elements/dependencies/base-platform.bst b/integration-tests/x86image-test/elements/dependencies/base-platform.bst new file mode 100644 index 000000000..09c95acb4 --- /dev/null +++ b/integration-tests/x86image-test/elements/dependencies/base-platform.bst @@ -0,0 +1,23 @@ +kind: import +description: Import the base freedesktop platform +config: + source: files +public: + bst: + integration-commands: + - ldconfig +arches: + x86_64: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/x86_64/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: c9d09b7250a12ef09d95952fc4f49a35e5f8c2c1dd7141b7eeada4069e6f6576 + i386: + sources: + - kind: ostree + url: gnomesdk:repo/ + track: runtime/org.freedesktop.BasePlatform/i386/1.4 + gpg-key: keys/gnome-sdk.gpg + ref: 27ebae91839a454596a273391b0e53063eaa8aca4fc9cb64654582bfbc338c96 diff --git a/integration-tests/x86image-test/elements/x86-test.bst b/integration-tests/x86image-test/elements/x86-test.bst new file mode 100644 index 000000000..09b2078ef --- /dev/null +++ b/integration-tests/x86image-test/elements/x86-test.bst @@ -0,0 +1,10 @@ +kind: x86image +description: x86image test + +depends: + - filename: dependencies/base-platform.bst + type: build + +config: + base: dependencies/base-platform.bst + input: dependencies/base-platform.bst diff --git a/integration-tests/x86image-test/keys/gnome-sdk.gpg b/integration-tests/x86image-test/keys/gnome-sdk.gpg new file mode 100644 index 000000000..8434b686c Binary files /dev/null and b/integration-tests/x86image-test/keys/gnome-sdk.gpg differ diff --git a/integration-tests/x86image-test/project.conf b/integration-tests/x86image-test/project.conf new file mode 100644 index 000000000..7f1e9370c --- /dev/null +++ b/integration-tests/x86image-test/project.conf @@ -0,0 +1,11 @@ +# Import-test BuildStream project configuration. + +# Project name +# +name: script-test + +# Base project relative element path, elements will be loaded +# from this base. + +element-path: elements + diff --git a/integration-tests/x86image-test/run-x86image-test.sh b/integration-tests/x86image-test/run-x86image-test.sh new file mode 100644 index 000000000..3b4472ff5 --- /dev/null +++ b/integration-tests/x86image-test/run-x86image-test.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# +# A script to run a BuildStream test case. + + +TEST_DIR="elements/" +RESULTS="results/" +EXPECTED="expected/" + +set -eu + +# run_test +# +# Run tests for this test case. +# +# This should create a set of directories that match the directories +# in 'results/', as well as a log of the BuildStream output in +# 'test_log.log'. +# +run_test () { + local element + local elements + local element_name + local test_dir + + local successes=0 + local total=0 + local exit + + source ../lib.sh + + mkdir -p "$TEST_DIR" + elements="$(find "$TEST_DIR" -maxdepth 1 -type f)" + + for element in $elements; + do + total=$((total + 1)) + + element_name="$(basename "$element")" + element_name="${element_name%.*}" + + test_dir="$RESULTS/$element_name" + + echo "Running test '$element_name'" + + 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=$? + if [ $exit == 0 ] + then + successes=$((successes + 1)) + fi + done + + if [ $total != $successes ] + then + return 1 + fi +} + +run_test "$@" -- cgit v1.2.1