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
65e4ca44
Commit
65e4ca44
authored
6 years ago
by
William Salmon
Browse files
Options
Downloads
Patches
Plain Diff
tests: Basic options for shell --build to use buildtrees\n issue
#740
parent
cb3acd17
No related branches found
No related tags found
Loading
Pipeline
#38935840
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/integration/build-tree.py
+82
-0
82 additions, 0 deletions
tests/integration/build-tree.py
with
82 additions
and
0 deletions
tests/integration/build-tree.py
+
82
−
0
View file @
65e4ca44
...
...
@@ -32,6 +32,40 @@ def test_buildtree_staged(cli_integration, tmpdir, datafiles):
res
.
assert_success
()
@pytest.mark.datafiles
(
DATA_DIR
)
@pytest.mark.skipif
(
IS_LINUX
and
not
HAVE_BWRAP
,
reason
=
'
Only available with bubblewrap on Linux
'
)
def
test_buildtree_staged_forced_true
(
cli_integration
,
tmpdir
,
datafiles
):
# i.e. tests that cached build trees are staged by `bst shell --build`
project
=
os
.
path
.
join
(
datafiles
.
dirname
,
datafiles
.
basename
)
element_name
=
'
build-shell/buildtree.bst
'
res
=
cli_integration
.
run
(
project
=
project
,
args
=
[
'
build
'
,
element_name
])
res
.
assert_success
()
res
=
cli_integration
.
run
(
project
=
project
,
args
=
[
'
shell
'
,
'
--build
'
,
'
--use-buildtree=True
'
,
element_name
,
'
--
'
,
'
cat
'
,
'
test
'
])
res
.
assert_success
()
assert
'
Hi
'
in
res
.
output
@pytest.mark.datafiles
(
DATA_DIR
)
@pytest.mark.skipif
(
IS_LINUX
and
not
HAVE_BWRAP
,
reason
=
'
Only available with bubblewrap on Linux
'
)
def
test_buildtree_staged_forced_false
(
cli_integration
,
tmpdir
,
datafiles
):
# i.e. tests that cached build trees are staged by `bst shell --build`
project
=
os
.
path
.
join
(
datafiles
.
dirname
,
datafiles
.
basename
)
element_name
=
'
build-shell/buildtree.bst
'
res
=
cli_integration
.
run
(
project
=
project
,
args
=
[
'
build
'
,
element_name
])
res
.
assert_success
()
res
=
cli_integration
.
run
(
project
=
project
,
args
=
[
'
shell
'
,
'
--build
'
,
'
--use-buildtree=False
'
,
element_name
,
'
--
'
,
'
cat
'
,
'
test
'
])
##res.assert_success()
assert
not
'
Hi
'
in
res
.
output
@pytest.mark.datafiles
(
DATA_DIR
)
@pytest.mark.skipif
(
IS_LINUX
and
not
HAVE_BWRAP
,
reason
=
'
Only available with bubblewrap on Linux
'
)
def
test_buildtree_from_failure
(
cli_integration
,
tmpdir
,
datafiles
):
...
...
@@ -83,3 +117,51 @@ def test_buildtree_pulled(cli, tmpdir, datafiles):
'
shell
'
,
'
--build
'
,
element_name
,
'
--
'
,
'
grep
'
,
'
-q
'
,
'
Hi
'
,
'
test
'
])
res
.
assert_success
()
# Check that build shells work when pulled from a remote cache
# This is to roughly simulate remote execution
@pytest.mark.datafiles
(
DATA_DIR
)
@pytest.mark.skipif
(
IS_LINUX
and
not
HAVE_BWRAP
,
reason
=
'
Only available with bubblewrap on Linux
'
)
def
test_buildtree_options
(
cli
,
tmpdir
,
datafiles
):
project
=
os
.
path
.
join
(
datafiles
.
dirname
,
datafiles
.
basename
)
element_name
=
'
build-shell/buildtree.bst
'
with
create_artifact_share
(
os
.
path
.
join
(
str
(
tmpdir
),
'
artifactshare
'
))
as
share
:
# Build the element to push it to cache
cli
.
configure
({
'
artifacts
'
:
{
'
url
'
:
share
.
repo
,
'
push
'
:
True
}
})
result
=
cli
.
run
(
project
=
project
,
args
=
[
'
build
'
,
element_name
])
result
.
assert_success
()
assert
cli
.
get_element_state
(
project
,
element_name
)
==
'
cached
'
# Discard the cache
cli
.
configure
({
'
artifacts
'
:
{
'
url
'
:
share
.
repo
,
'
push
'
:
True
},
'
artifactdir
'
:
os
.
path
.
join
(
cli
.
directory
,
'
artifacts2
'
)
})
assert
cli
.
get_element_state
(
project
,
element_name
)
!=
'
cached
'
# Pull from cache, ensuring cli options is set to pull the buildtree
result
=
cli
.
run
(
project
=
project
,
args
=
[
'
pull
'
,
'
--deps
'
,
'
all
'
,
element_name
])
result
.
assert_success
()
# Check it's using the cached build tree
res
=
cli
.
run
(
project
=
project
,
args
=
[
'
shell
'
,
'
--build
'
,
element_name
,
'
--use_buildtree=False
'
,
'
--
'
,
'
cat
'
,
'
test
'
])
#res.assert_success()
assert
not
'
Hi
'
in
res
.
output
# Check it's using the cached build tree
res
=
cli
.
run
(
project
=
project
,
args
=
[
'
shell
'
,
'
--build
'
,
element_name
,
'
--use_buildtree=True
'
,
'
--
'
,
'
cat
'
,
'
test
'
])
assert
not
'
Hi
'
in
res
.
output
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