summaryrefslogtreecommitdiff
path: root/tests/examples
diff options
context:
space:
mode:
authorTiago Gomes <tiago.gomes@codethink.co.uk>2018-07-31 12:39:17 +0100
committerTiago Gomes <tiago.avv@gmail.com>2018-08-02 11:24:43 +0000
commit33292be4618b83147258e729a44caa58859e4ba2 (patch)
tree9af95e3e64eb4b6818b1b7d40f17dc94d2caaf52 /tests/examples
parente788bda4969de17178f3facc0d31b36c91121402 (diff)
downloadbuildstream-33292be4618b83147258e729a44caa58859e4ba2.tar.gz
local plugin: validate project paths
The autotools example had to be copied over inside of the junction example, as referring to a path outside of the project directory is now disallowed.
Diffstat (limited to 'tests/examples')
-rw-r--r--tests/examples/junctions.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/tests/examples/junctions.py b/tests/examples/junctions.py
index 49e2ebbff..d2a653884 100644
--- a/tests/examples/junctions.py
+++ b/tests/examples/junctions.py
@@ -11,42 +11,12 @@ DATA_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'junctions'
)
-JUNCTION_IMPORT_PATH = os.path.join(
- os.path.dirname(os.path.realpath(__file__)), '..', '..', 'doc', 'examples', 'autotools'
-)
-
-
-def ammend_juntion_path_paths(tmpdir):
- # The junction element in the examples/junctions project uses a local source type.
- # It's "path:" must specify a relative path from the project's root directory.
- # For the hello-junction element to function during these tests, the copy of the junctions
- # project made in the buildstream/tmp/directory, "path:" must be ammended to be the relative
- # path to the autotools example from the temporary test directory.
- junction_element = os.path.join(tmpdir, "elements", "hello-junction.bst")
- junction_element_bst = ""
- junction_relative_path = os.path.relpath(JUNCTION_IMPORT_PATH, tmpdir)
- with open(junction_element, 'r') as f:
- junction_element_bst = f.read()
- ammended_element_bst = junction_element_bst.replace("../autotools", junction_relative_path)
- with open(junction_element, 'w') as f:
- f.write(ammended_element_bst)
-
-
-# Check that the autotools project is where the junctions example expects and
-# contains the hello.bst element.
-@pytest.mark.datafiles(DATA_DIR)
-def test_autotools_example_is_present(datafiles):
- autotools_path = JUNCTION_IMPORT_PATH
- assert os.path.exists(autotools_path)
- assert os.path.exists(os.path.join(autotools_path, "elements", "hello.bst"))
-
# Test that the project builds successfully
@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux')
@pytest.mark.datafiles(DATA_DIR)
def test_build(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
- ammend_juntion_path_paths(str(tmpdir))
result = cli.run(project=project, args=['build', 'callHello.bst'])
result.assert_success()
@@ -57,7 +27,6 @@ def test_build(cli, tmpdir, datafiles):
@pytest.mark.datafiles(DATA_DIR)
def test_shell_call_hello(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
- ammend_juntion_path_paths(str(tmpdir))
result = cli.run(project=project, args=['build', 'callHello.bst'])
result.assert_success()
@@ -73,7 +42,6 @@ def test_shell_call_hello(cli, tmpdir, datafiles):
def test_open_cross_junction_workspace(cli, tmpdir, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
workspace_dir = os.path.join(str(tmpdir), "workspace_hello_junction")
- ammend_juntion_path_paths(str(tmpdir))
result = cli.run(project=project,
args=['workspace', 'open', 'hello-junction.bst:hello.bst', workspace_dir])