Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Spack
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
Package registry
Container 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
eic_tools
Spack
Commits
bcec21b2
Commit
bcec21b2
authored
4 years ago
by
Tamara Dahlgren
Browse files
Options
Downloads
Patches
Plain Diff
Add install test show (logs) command
parent
93e2810a
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
lib/spack/llnl/util/tty/__init__.py
+35
-0
35 additions, 0 deletions
lib/spack/llnl/util/tty/__init__.py
lib/spack/spack/cmd/test.py
+43
-0
43 additions, 0 deletions
lib/spack/spack/cmd/test.py
with
78 additions
and
0 deletions
lib/spack/llnl/util/tty/__init__.py
+
35
−
0
View file @
bcec21b2
...
@@ -239,6 +239,41 @@ def die(message, *args, **kwargs):
...
@@ -239,6 +239,41 @@ def die(message, *args, **kwargs):
sys
.
exit
(
1
)
sys
.
exit
(
1
)
def
get_answer
(
prompt
,
**
kwargs
):
options
=
kwargs
.
get
(
'
options
'
,
[])
default
=
kwargs
.
get
(
'
default
'
,
None
)
abort
=
kwargs
.
get
(
'
abort
'
,
None
)
explain
=
''
if
default
is
not
None
:
assert
default
in
options
explain
+=
'
default is
\'
{0}
\'
'
.
format
(
default
)
if
abort
is
not
None
:
if
explain
:
explain
+=
'
,
'
explain
+=
'
\'
{0}
\'
to abort
'
.
format
(
abort
)
if
explain
:
prompt
=
'
{0} ({1})
'
.
format
(
prompt
,
explain
)
val
=
None
while
val
is
None
:
msg
(
prompt
,
newline
=
False
)
ans
=
input
()
if
ans
==
abort
:
return
None
if
ans
:
if
ans
in
options
:
val
=
ans
else
:
msg
(
'
Please enter one of: {0}
'
.
format
(
'
,
'
.
join
(
options
)))
elif
default
is
not
None
:
val
=
default
return
val
def
get_number
(
prompt
,
**
kwargs
):
def
get_number
(
prompt
,
**
kwargs
):
default
=
kwargs
.
get
(
'
default
'
,
None
)
default
=
kwargs
.
get
(
'
default
'
,
None
)
abort
=
kwargs
.
get
(
'
abort
'
,
None
)
abort
=
kwargs
.
get
(
'
abort
'
,
None
)
...
...
This diff is collapsed.
Click to expand it.
lib/spack/spack/cmd/test.py
+
43
−
0
View file @
bcec21b2
...
@@ -92,6 +92,12 @@ def setup_parser(subparser):
...
@@ -92,6 +92,12 @@ def setup_parser(subparser):
'
filter
'
,
nargs
=
argparse
.
REMAINDER
,
'
filter
'
,
nargs
=
argparse
.
REMAINDER
,
help
=
'
optional case-insensitive glob patterns to filter results.
'
)
help
=
'
optional case-insensitive glob patterns to filter results.
'
)
# Show
show_parser
=
sp
.
add_parser
(
'
show
'
,
help
=
test_show
.
__doc__
)
show_parser
.
add_argument
(
'
names
'
,
nargs
=
argparse
.
REMAINDER
,
help
=
"
Test suites for which to show test logs
"
)
# Status
# Status
status_parser
=
sp
.
add_parser
(
'
status
'
,
help
=
test_status
.
__doc__
)
status_parser
=
sp
.
add_parser
(
'
status
'
,
help
=
test_status
.
__doc__
)
status_parser
.
add_argument
(
status_parser
.
add_argument
(
...
@@ -219,6 +225,42 @@ def match(t, f):
...
@@ -219,6 +225,42 @@ def match(t, f):
tty
.
msg
(
msg
)
tty
.
msg
(
msg
)
def
test_show
(
args
):
"""
Provide ability to view test logs for particular Spack test suites.
"""
if
args
.
names
:
test_suites
=
[]
for
name
in
args
.
names
:
test_suite
=
spack
.
install_test
.
get_test_suite
(
name
)
if
test_suite
:
test_suites
.
append
(
test_suite
)
else
:
tty
.
msg
(
"
No test suite %s found in test stage
"
%
name
)
else
:
test_suites
=
spack
.
install_test
.
get_all_test_suites
()
if
not
test_suites
:
tty
.
msg
(
"
No test suites with status to report
"
)
for
test_suite
in
test_suites
:
for
spec
in
test_suite
.
specs
:
log_file
=
test_suite
.
log_file_for_spec
(
spec
)
if
os
.
path
.
exists
(
log_file
):
filename
=
os
.
path
.
basename
(
log_file
)
msg
=
'
Show {0}?
\n\t
'
.
format
(
filename
)
answer
=
tty
.
get_answer
(
msg
,
options
=
[
'
y
'
,
'
n
'
,
'
q
'
],
default
=
'
y
'
,
abort
=
'
q
'
)
if
not
answer
:
tty
.
msg
(
'
Aborting show of test suite logs
'
)
return
if
answer
==
'
y
'
:
with
open
(
log_file
,
'
r
'
)
as
ifd
:
lines
=
ifd
.
readlines
()
for
ln
in
lines
:
print
(
ln
.
strip
())
print
()
# Add a blank line for readability if multiple
def
test_status
(
args
):
def
test_status
(
args
):
"""
Get the current status for a particular Spack test suites.
"""
"""
Get the current status for a particular Spack test suites.
"""
if
args
.
names
:
if
args
.
names
:
...
@@ -307,5 +349,6 @@ def test_remove(args):
...
@@ -307,5 +349,6 @@ def test_remove(args):
for
test_suite
in
test_suites
:
for
test_suite
in
test_suites
:
shutil
.
rmtree
(
test_suite
.
stage
)
shutil
.
rmtree
(
test_suite
.
stage
)
def
test
(
parser
,
args
):
def
test
(
parser
,
args
):
globals
()[
'
test_%s
'
%
args
.
test_command
](
args
)
globals
()[
'
test_%s
'
%
args
.
test_command
](
args
)
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