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
3
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
BuildStream
buildstream
Commits
505c6ddc
Commit
505c6ddc
authored
6 years ago
by
Jim MacArthur
Browse files
Options
Downloads
Patches
Plain Diff
Add a main() to virtual_directory_test.py to allow manual testing
parent
e5e5be9d
No related branches found
No related tags found
Loading
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/storage/virtual_directory_import.py
+33
-1
33 additions, 1 deletion
tests/storage/virtual_directory_import.py
with
33 additions
and
1 deletion
tests/storage/virtual_directory_import.py
+
33
−
1
View file @
505c6ddc
...
...
@@ -8,6 +8,8 @@ from tests.testutils import cli
from
buildstream.storage
import
CasBasedDirectory
from
buildstream.storage
import
FileBasedDirectory
from
buildstream._artifactcache
import
ArtifactCache
from
buildstream._artifactcache.cascache
import
CASCache
from
buildstream
import
utils
class
FakeContext
():
...
...
@@ -156,6 +158,8 @@ def directory_not_empty(path):
def
_import_test
(
tmpdir
,
original
,
overlay
,
generator_function
,
verify_contents
=
False
):
fake_context
=
FakeContext
()
fake_context
.
artifactdir
=
tmpdir
print
(
"
Creating CAS Cache with artifact dir {}
"
.
format
(
tmpdir
))
fake_context
.
artifactcache
=
CASCache
(
fake_context
)
# Create some fake content
generator_function
(
original
,
tmpdir
)
if
original
!=
overlay
:
...
...
@@ -228,6 +232,8 @@ def test_random_cas_import_fast(cli, tmpdir, original, overlay):
def
_listing_test
(
tmpdir
,
root
,
generator_function
):
fake_context
=
FakeContext
()
fake_context
.
artifactdir
=
tmpdir
print
(
"
Creating CAS Cache with artifact dir {}
"
.
format
(
tmpdir
))
fake_context
.
artifactcache
=
CASCache
(
fake_context
)
# Create some fake content
generator_function
(
root
,
tmpdir
)
...
...
@@ -251,3 +257,29 @@ def test_random_directory_listing(cli, tmpdir, root):
@pytest.mark.parametrize
(
"
root
"
,
[
1
,
2
,
3
,
4
,
5
])
def
test_fixed_directory_listing
(
cli
,
tmpdir
,
root
):
_listing_test
(
tmpdir
,
root
,
generate_import_roots
)
def
main
():
for
i
in
range
(
1
,
6
):
with
tempfile
.
TemporaryDirectory
(
prefix
=
"
/home/jimmacarthur/.cache/buildstream/cas
"
)
as
tmpdirname
:
test_fixed_directory_listing
(
None
,
tmpdirname
,
i
)
for
i
in
range
(
1
,
11
):
with
tempfile
.
TemporaryDirectory
(
prefix
=
"
/home/jimmacarthur/.cache/buildstream/cas
"
)
as
tmpdirname
:
test_random_directory_listing
(
None
,
tmpdirname
,
i
)
for
i
in
range
(
1
,
21
):
for
j
in
range
(
1
,
21
):
with
tempfile
.
TemporaryDirectory
(
prefix
=
"
/home/jimmacarthur/.cache/buildstream/cas
"
)
as
tmpdirname
:
test_random_cas_import_fast
(
None
,
tmpdirname
,
i
,
j
)
for
i
in
range
(
1
,
len
(
root_filesets
)
+
1
):
for
j
in
range
(
1
,
len
(
root_filesets
)
+
1
):
with
tempfile
.
TemporaryDirectory
(
prefix
=
"
/home/jimmacarthur/.cache/buildstream/cas
"
)
as
tmpdirname
:
test_fixed_cas_import
(
None
,
tmpdirname
,
i
,
j
)
if
__name__
==
"
__main__
"
:
main
()
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