Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
buildstream
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
BuildStream
buildstream
Commits
c9e34cbf
Commit
c9e34cbf
authored
6 years ago
by
James Ennis
Committed by
Jim MacArthur
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
tar.py: Add test for a tarball containing a read-only dir
parent
78035f57
No related branches found
No related tags found
Loading
Pipeline
#28537721
failed
6 years ago
Stage: prepare
Stage: test
Stage: post
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/sources/tar.py
+31
-0
31 additions, 0 deletions
tests/sources/tar.py
with
31 additions
and
0 deletions
tests/sources/tar.py
+
31
−
0
View file @
c9e34cbf
...
...
@@ -3,6 +3,7 @@ import pytest
import
tarfile
import
tempfile
import
subprocess
from
shutil
import
copyfile
from
buildstream._exceptions
import
ErrorDomain
from
buildstream
import
_yaml
...
...
@@ -257,3 +258,33 @@ def test_stage_default_basedir_lzip(cli, tmpdir, datafiles, srcdir):
original_contents
=
list_dir_contents
(
original_dir
)
checkout_contents
=
list_dir_contents
(
checkoutdir
)
assert
(
checkout_contents
==
original_contents
)
# Test that a tarball that contains a read only dir works
@pytest.mark.datafiles
(
os
.
path
.
join
(
DATA_DIR
,
'
read-only
'
))
def
test_read_only_dir
(
cli
,
tmpdir
,
datafiles
):
try
:
project
=
os
.
path
.
join
(
datafiles
.
dirname
,
datafiles
.
basename
)
generate_project
(
project
,
tmpdir
)
# Get the tarball in tests/sources/tar/read-only/content
#
# NOTE that we need to do this because tarfile.open and tar.add()
# are packing the tar up with writeable files and dirs
tarball
=
os
.
path
.
join
(
str
(
datafiles
),
'
content
'
,
'
a.tar.gz
'
)
if
not
os
.
path
.
exists
(
tarball
):
raise
FileNotFoundError
(
'
{} does not exist
'
.
format
(
tarball
))
copyfile
(
tarball
,
os
.
path
.
join
(
tmpdir
,
'
a.tar.gz
'
))
# Track, fetch, build, checkout
result
=
cli
.
run
(
project
=
project
,
args
=
[
'
track
'
,
'
target.bst
'
])
result
.
assert_success
()
result
=
cli
.
run
(
project
=
project
,
args
=
[
'
fetch
'
,
'
target.bst
'
])
result
.
assert_success
()
result
=
cli
.
run
(
project
=
project
,
args
=
[
'
build
'
,
'
target.bst
'
])
result
.
assert_success
()
finally
:
# Make tmpdir deletable no matter what happens
print
(
"
Cleaning {}
"
.
format
(
tmpdir
))
for
dirpath
,
dnames
,
fnames
in
os
.
walk
(
tmpdir
):
os
.
chmod
(
dirpath
,
0o777
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment