... |
... |
@@ -3,6 +3,7 @@ import pytest |
3
|
3
|
import tarfile
|
4
|
4
|
import tempfile
|
5
|
5
|
import subprocess
|
|
6
|
+from shutil import copyfile
|
6
|
7
|
|
7
|
8
|
from buildstream._exceptions import ErrorDomain
|
8
|
9
|
from buildstream import _yaml
|
... |
... |
@@ -257,3 +258,27 @@ def test_stage_default_basedir_lzip(cli, tmpdir, datafiles, srcdir): |
257
|
258
|
original_contents = list_dir_contents(original_dir)
|
258
|
259
|
checkout_contents = list_dir_contents(checkoutdir)
|
259
|
260
|
assert(checkout_contents == original_contents)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+# Test that a tarball that contains a read only dir breaks
|
|
264
|
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'read-only'))
|
|
265
|
+def test_read_only_dir(cli, tmpdir, datafiles, srcdir):
|
|
266
|
+ project = os.path.join(datafiles.dirname, datafiles.basename)
|
|
267
|
+ generate_project(project, tmpdir)
|
|
268
|
+
|
|
269
|
+ # Get the tarball in tests/sources/tar/read-only/content
|
|
270
|
+ #
|
|
271
|
+ # NOTE that we need to do this because tarfile.open and tar.add()
|
|
272
|
+ # are packing the tar up with writeable files and dirs
|
|
273
|
+ tarball = os.path.join(str(datafiles), 'content', 'a.tar.gz')
|
|
274
|
+ if not os.path.exists(tarball):
|
|
275
|
+ raise FileNotFoundError('{} does not exist'.format(tarball))
|
|
276
|
+ copyfile(tarball, os.path.join(tmpdir, 'a.tar.gz'))
|
|
277
|
+
|
|
278
|
+ # Track, fetch, build, checkout
|
|
279
|
+ result = cli.run(project=project, args=['track', 'target.bst'])
|
|
280
|
+ result.assert_success()
|
|
281
|
+ result = cli.run(project=project, args=['fetch', 'target.bst'])
|
|
282
|
+ result.assert_success()
|
|
283
|
+ result = cli.run(project=project, args=['build', 'target.bst'])
|
|
284
|
+ result.assert_success()
|