summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-02-11 06:44:20 +0100
committerJürg Billeter <j@bitron.ch>2019-02-11 06:44:20 +0100
commit7ec0bb5e06c83646611954b4a15da87442b73d4c (patch)
treea218c79bfb6b4e1bc8ed19517c4a87b857aa1d34
parent7cf67ed3f05dc0754d19a6313501ae0f85fd6eec (diff)
downloadbuildstream-7ec0bb5e06c83646611954b4a15da87442b73d4c.tar.gz
tests/sources/local.py: Add directory symlink test
-rw-r--r--tests/sources/local.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/sources/local.py b/tests/sources/local.py
index f7c1f4bd2..0da9e8cc1 100644
--- a/tests/sources/local.py
+++ b/tests/sources/local.py
@@ -136,3 +136,23 @@ def test_stage_file_exists(cli, tmpdir, datafiles):
result = cli.run(project=project, args=['build', 'target.bst'])
result.assert_main_error(ErrorDomain.STREAM, None)
result.assert_task_error(ErrorDomain.SOURCE, 'ensure-stage-dir-fail')
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'directory'))
+def test_stage_directory_symlink(cli, tmpdir, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename)
+ checkoutdir = os.path.join(str(tmpdir), "checkout")
+
+ symlink = os.path.join(project, 'files', 'symlink-to-subdir')
+ os.symlink('subdir', symlink)
+
+ # Build, checkout
+ result = cli.run(project=project, args=['build', 'target.bst'])
+ result.assert_success()
+ result = cli.run(project=project, args=['artifact', 'checkout', 'target.bst', '--directory', checkoutdir])
+ result.assert_success()
+
+ # Check that the checkout contains the expected directory and directory symlink
+ assert(os.path.exists(os.path.join(checkoutdir, 'subdir', 'anotherfile.txt')))
+ assert(os.path.exists(os.path.join(checkoutdir, 'symlink-to-subdir', 'anotherfile.txt')))
+ assert(os.path.islink(os.path.join(checkoutdir, 'symlink-to-subdir')))