Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
steam-runtime-tools
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
steamrt
steam-runtime-tools
Commits
18d2a289
Commit
18d2a289
authored
4 years ago
by
Simon McVittie
Browse files
Options
Downloads
Patches
Plain Diff
tests: Assert that STEAM_COMPAT_INSTALL_PATH, etc. get mounted
Signed-off-by:
Simon McVittie
<
smcv@collabora.com
>
parent
0ed540ac
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/containers.py
+56
-3
56 additions, 3 deletions
tests/containers.py
tests/inside-runtime.py
+36
-0
36 additions, 0 deletions
tests/inside-runtime.py
with
92 additions
and
3 deletions
tests/containers.py
+
56
−
3
View file @
18d2a289
...
@@ -144,6 +144,35 @@ class TestContainers(BaseTest):
...
@@ -144,6 +144,35 @@ class TestContainers(BaseTest):
cls
.
pv_dir
=
os
.
path
.
join
(
cls
.
tmpdir
.
name
,
'
pressure-vessel
'
)
cls
.
pv_dir
=
os
.
path
.
join
(
cls
.
tmpdir
.
name
,
'
pressure-vessel
'
)
os
.
makedirs
(
cls
.
pv_dir
,
exist_ok
=
True
)
os
.
makedirs
(
cls
.
pv_dir
,
exist_ok
=
True
)
for
var
,
plural
in
(
(
'
STEAM_COMPAT_APP_LIBRARY_PATH
'
,
False
),
(
'
STEAM_COMPAT_APP_LIBRARY_PATHS
'
,
True
),
(
'
STEAM_COMPAT_CLIENT_INSTALL_PATH
'
,
False
),
(
'
STEAM_COMPAT_DATA_PATH
'
,
False
),
(
'
STEAM_COMPAT_INSTALL_PATH
'
,
False
),
(
'
STEAM_COMPAT_LIBRARY_PATHS
'
,
True
),
(
'
STEAM_COMPAT_MOUNT_PATHS
'
,
True
),
(
'
STEAM_COMPAT_MOUNTS
'
,
True
),
(
'
STEAM_COMPAT_SHADER_PATH
'
,
False
),
(
'
STEAM_COMPAT_TOOL_PATH
'
,
False
),
(
'
STEAM_COMPAT_TOOL_PATHS
'
,
True
),
):
paths
=
[]
if
plural
:
names
=
[
var
+
'
_n1
'
,
var
+
'
_n2
'
]
else
:
# Use an inconvenient name with colon and space
# to check that we handle those correctly
names
=
[
var
+
'
: .d
'
]
for
name
in
names
:
path
=
os
.
path
.
join
(
cls
.
tmpdir
.
name
,
name
)
os
.
makedirs
(
path
,
exist_ok
=
True
)
paths
.
append
(
path
)
os
.
environ
[
var
]
=
'
:
'
.
join
(
paths
)
if
'
PRESSURE_VESSEL_UNINSTALLED
'
in
os
.
environ
:
if
'
PRESSURE_VESSEL_UNINSTALLED
'
in
os
.
environ
:
os
.
makedirs
(
os
.
path
.
join
(
cls
.
pv_dir
,
'
bin
'
))
os
.
makedirs
(
os
.
path
.
join
(
cls
.
pv_dir
,
'
bin
'
))
...
@@ -521,11 +550,35 @@ class TestContainers(BaseTest):
...
@@ -521,11 +550,35 @@ class TestContainers(BaseTest):
)
)
self
.
assertEqual
(
completed
.
returncode
,
0
)
self
.
assertEqual
(
completed
.
returncode
,
0
)
bwrap_arguments
=
bwrap_temp_file
.
read
().
decode
()
.
split
(
"
\0
"
)
bwrap_arguments
=
bwrap_temp_file
.
read
().
decode
()
if
locales
:
if
locales
:
self
.
assertIn
(
"
--generate-locales
"
,
bwrap_arguments
)
self
.
assertIn
(
"
\0
--generate-locales
\0
"
,
bwrap_arguments
)
else
:
else
:
self
.
assertNotIn
(
"
--generate-locales
"
,
bwrap_arguments
)
self
.
assertNotIn
(
"
\0
--generate-locales
\0
"
,
bwrap_arguments
)
if
only_prepare
:
for
var
,
plural
in
(
(
'
STEAM_COMPAT_APP_LIBRARY_PATH
'
,
False
),
(
'
STEAM_COMPAT_APP_LIBRARY_PATHS
'
,
True
),
(
'
STEAM_COMPAT_CLIENT_INSTALL_PATH
'
,
False
),
(
'
STEAM_COMPAT_INSTALL_PATH
'
,
False
),
(
'
STEAM_COMPAT_LIBRARY_PATHS
'
,
True
),
(
'
STEAM_COMPAT_MOUNT_PATHS
'
,
True
),
(
'
STEAM_COMPAT_MOUNTS
'
,
True
),
(
'
STEAM_COMPAT_SHADER_PATH
'
,
False
),
(
'
STEAM_COMPAT_TOOL_PATH
'
,
False
),
(
'
STEAM_COMPAT_TOOL_PATHS
'
,
True
),
):
if
plural
:
paths
=
os
.
environ
[
var
].
split
(
'
:
'
)
else
:
paths
=
[
os
.
environ
[
var
]]
for
path
in
paths
:
self
.
assertIn
(
"
\0
--bind
\0
{}
\0
{}
"
.
format
(
path
,
path
),
bwrap_arguments
,
)
bwrap_temp_file
.
close
()
bwrap_temp_file
.
close
()
...
...
This diff is collapsed.
Click to expand it.
tests/inside-runtime.py
+
36
−
0
View file @
18d2a289
...
@@ -9,6 +9,7 @@ import errno
...
@@ -9,6 +9,7 @@ import errno
import
json
import
json
import
logging
import
logging
import
os
import
os
import
re
import
shlex
import
shlex
import
subprocess
import
subprocess
import
sys
import
sys
...
@@ -627,6 +628,41 @@ class TestInsideRuntime(BaseTest):
...
@@ -627,6 +628,41 @@ class TestInsideRuntime(BaseTest):
self
.
assertEqual
(
raised
.
exception
.
errno
,
errno
.
EROFS
)
self
.
assertEqual
(
raised
.
exception
.
errno
,
errno
.
EROFS
)
def
test_imported
(
self
)
->
None
:
mount_points
=
set
()
# type: typing.Set[str]
with
open
(
'
/proc/self/mountinfo
'
)
as
mountinfo
:
for
line
in
mountinfo
:
_
,
_
,
_
,
_
,
mount_point
,
*
_
=
re
.
split
(
r
'
[ \t]
'
,
line
)
mount_point
=
re
.
sub
(
r
'
\\([0-7][0-7][0-7])
'
,
lambda
m
:
chr
(
int
(
m
.
group
(
1
),
8
)),
mount_point
,
)
mount_points
.
add
(
mount_point
)
for
var
,
plural
in
(
(
'
STEAM_COMPAT_APP_LIBRARY_PATH
'
,
False
),
(
'
STEAM_COMPAT_APP_LIBRARY_PATHS
'
,
True
),
(
'
STEAM_COMPAT_CLIENT_INSTALL_PATH
'
,
False
),
(
'
STEAM_COMPAT_DATA_PATH
'
,
False
),
(
'
STEAM_COMPAT_INSTALL_PATH
'
,
False
),
(
'
STEAM_COMPAT_LIBRARY_PATHS
'
,
True
),
(
'
STEAM_COMPAT_MOUNT_PATHS
'
,
True
),
(
'
STEAM_COMPAT_MOUNTS
'
,
True
),
(
'
STEAM_COMPAT_SHADER_PATH
'
,
False
),
(
'
STEAM_COMPAT_TOOL_PATH
'
,
False
),
(
'
STEAM_COMPAT_TOOL_PATHS
'
,
True
),
):
if
plural
:
paths
=
os
.
environ
[
var
].
split
(
'
:
'
)
else
:
paths
=
[
os
.
environ
[
var
]]
for
path
in
paths
:
self
.
assertIn
(
path
,
mount_points
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
assert
sys
.
version_info
>=
(
3
,
5
),
'
Python 3.5+ is required
'
assert
sys
.
version_info
>=
(
3
,
5
),
'
Python 3.5+ is required
'
...
...
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