Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
steam-runtime-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
steamrt
steam-runtime-tools
Commits
29d783ad
Commit
29d783ad
authored
4 years ago
by
Simon McVittie
Browse files
Options
Downloads
Patches
Plain Diff
pressure-vessel test: Improve diagnostics
Signed-off-by:
Simon McVittie
<
smcv@collabora.com
>
parent
2b7aac62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/depot/pressure-vessel.py
+43
-15
43 additions, 15 deletions
tests/depot/pressure-vessel.py
with
43 additions
and
15 deletions
tests/depot/pressure-vessel.py
+
43
−
15
View file @
29d783ad
...
...
@@ -111,8 +111,9 @@ class TestPressureVessel(unittest.TestCase):
@contextlib.contextmanager
def
catch
(
self
,
msg
,
# type: str
**
kwargs
# type: typing.Any
msg
,
# type: str
diagnostic
=
None
,
# type: typing.Any
**
kwargs
# type: typing.Any
):
"""
Run a sub-test, with additional logging.
...
...
@@ -127,6 +128,10 @@ class TestPressureVessel(unittest.TestCase):
yield
except
Exception
:
logger
.
error
(
msg
,
exc_info
=
True
)
if
diagnostic
is
not
None
:
logger
.
error
(
'
%r
'
,
diagnostic
)
raise
def
get_runtime_build_id
(
self
,
suite
):
...
...
@@ -176,16 +181,29 @@ class TestPressureVessel(unittest.TestCase):
return
completed
def
tee_file_and_stderr
(
self
,
path
:
str
)
->
subprocess
.
Popen
:
"""
Return a context manager with a stdin attribute.
Anything written to its stdin will be written to `path`
and also to stderr.
"""
return
subprocess
.
Popen
(
[
'
tee
'
,
'
--
'
,
path
],
stdin
=
subprocess
.
PIPE
,
stdout
=
2
,
stderr
=
2
,
)
def
test_general_info
(
self
)
->
None
:
with
open
(
os
.
path
.
join
(
self
.
artifacts
,
'
depot-contents.txt
'
)
,
'
w
'
)
as
wri
te
r
:
with
self
.
tee_file_and_stderr
(
os
.
path
.
join
(
self
.
artifacts
,
'
depot-contents.txt
'
)
)
as
te
e
:
with
self
.
catch
(
'
List contents of depot
'
):
completed
=
self
.
run_subprocess
(
[
'
find
'
,
'
.
'
,
'
-ls
'
],
check
=
True
,
cwd
=
self
.
depot
,
stdout
=
writer
,
stdout
=
tee
.
stdin
,
stderr
=
subprocess
.
PIPE
,
)
...
...
@@ -262,8 +280,8 @@ class TestPressureVessel(unittest.TestCase):
if
completed
.
stderr
:
logger
.
info
(
'
%
s --ver
sion
(stderr) -> %s
'
,
exe
,
completed
.
stderr
,
'
s
team-runtime-system-info
--ver
bose
(stderr) -> %s
'
,
completed
.
stderr
,
)
else
:
logger
.
info
(
'
(no stderr)
'
)
...
...
@@ -356,7 +374,10 @@ class TestPressureVessel(unittest.TestCase):
self
.
assertIn
(
'
can-write-uinput
'
,
parsed
)
self
.
assertIn
(
'
steam-installation
'
,
parsed
)
with
self
.
catch
(
'
runtime information
'
):
with
self
.
catch
(
'
runtime information
'
,
diagnostic
=
parsed
.
get
(
'
runtime
'
),
):
self
.
assertIn
(
'
runtime
'
,
parsed
)
self
.
assertEqual
(
'
/
'
,
parsed
[
'
runtime
'
].
get
(
'
path
'
))
self
.
assertIn
(
'
version
'
,
parsed
[
'
runtime
'
])
...
...
@@ -377,7 +398,10 @@ class TestPressureVessel(unittest.TestCase):
self
.
assertNotIn
(
'
pinned_libs_32
'
,
parsed
[
'
runtime
'
])
self
.
assertNotIn
(
'
pinned_libs_64
'
,
parsed
[
'
runtime
'
])
with
self
.
catch
(
'
os-release information
'
):
with
self
.
catch
(
'
os-release information
'
,
diagnostic
=
parsed
.
get
(
'
os-release
'
),
):
self
.
assertIn
(
'
os-release
'
,
parsed
)
self
.
assertEqual
(
'
steamrt
'
,
parsed
[
'
os-release
'
][
'
id
'
])
self
.
assertNotIn
(
...
...
@@ -421,7 +445,11 @@ class TestPressureVessel(unittest.TestCase):
self
.
assertIn
(
multiarch
,
parsed
[
'
architectures
'
])
arch_info
=
parsed
[
'
architectures
'
][
multiarch
]
with
self
.
catch
(
'
per-architecture information
'
,
arch
=
arch
):
with
self
.
catch
(
'
per-architecture information
'
,
diagnostic
=
arch_info
,
arch
=
arch
,
):
self
.
assertTrue
(
arch_info
[
'
can-run
'
])
self
.
assertEqual
([],
arch_info
[
'
library-issues-summary
'
])
# Graphics driver support depends on the host system, so we
...
...
@@ -433,6 +461,7 @@ class TestPressureVessel(unittest.TestCase):
for
soname
,
details
in
arch_info
[
'
library-details
'
].
items
():
with
self
.
catch
(
'
per-library information
'
,
diagnostic
=
details
,
arch
=
arch
,
soname
=
soname
,
):
...
...
@@ -506,15 +535,14 @@ class TestPressureVessel(unittest.TestCase):
adverb
=
self
.
get_pressure_vessel_adverb
(
suite
)
with
open
(
with
self
.
tee_file_and_stderr
(
os
.
path
.
join
(
self
.
artifacts
,
'
platform.log
'
),
'
w
'
,
)
as
writer
:
)
as
tee
:
with
self
.
catch
(
'
run steamrt platform test in container
'
):
self
.
run_subprocess
(
adverb
+
[
'
debian/tests/platform
'
],
cwd
=
steamrt_source
,
stdout
=
writer
,
stdout
=
tee
.
stdin
,
stderr
=
subprocess
.
STDOUT
,
check
=
True
,
)
...
...
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