diff options
Diffstat (limited to 'integration-tests/pip-test')
18 files changed, 215 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 000000000..19f41ac78 --- /dev/null +++ b/integration-tests/pip-test/expected/hello/usr/lib/python3.5/site-packages/hello/__pycache__/__init__.cpython-35.pyc diff --git a/integration-tests/pip-test/keys/gnome-sdk.gpg b/integration-tests/pip-test/keys/gnome-sdk.gpg Binary files differnew file mode 100644 index 000000000..8434b686c --- /dev/null +++ b/integration-tests/pip-test/keys/gnome-sdk.gpg 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 Binary files differnew file mode 100644 index 000000000..72ec9b399 --- /dev/null +++ b/integration-tests/pip-test/src/hello.tar.xz |