Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TP-shell-student
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
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
gc_courses
sys-exploit
TP-shell-student
Commits
0ef49334
Commit
0ef49334
authored
2 years ago
by
Guillaume Chanel
Browse files
Options
Downloads
Patches
Plain Diff
Assert shell exits with code 0
parent
ecf63d8a
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#19920
failed
2 years ago
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test.py
+5
-1
5 additions, 1 deletion
test/test.py
with
5 additions
and
1 deletion
test/test.py
+
5
−
1
View file @
0ef49334
#!/usr/bin/env python
#!/usr/bin/env python
3
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
# Test the given TP shell
# Test the given TP shell
#
#
# Author: David Gonzalez (HEPIA) <david.dg.gonzalez@hesge.ch>
# Author: David Gonzalez (HEPIA) <david.dg.gonzalez@hesge.ch>
# Author: Guillaume Chanel <guillaume.chanel@unige.ch>
import
sys
import
sys
import
tempfile
import
tempfile
...
@@ -153,6 +154,9 @@ class Shell:
...
@@ -153,6 +154,9 @@ class Shell:
raise
subprocess
.
TimeoutExpired
(
'
The exit command did not exit the shell after {}s
'
.
format
(
timeout
))
raise
subprocess
.
TimeoutExpired
(
'
The exit command did not exit the shell after {}s
'
.
format
(
timeout
))
#TODO: should I check if process is still running at that point (stream closed but process alive ?)
#TODO: should I check if process is still running at that point (stream closed but process alive ?)
if
self
.
shell_process
.
returncode
!=
0
:
raise
AssertionError
(
'
Shell process exited with an error code ({})
'
.
format
(
self
.
shell_process
.
returncode
))
def
read_stdout
(
self
):
def
read_stdout
(
self
):
if
self
.
stdout
is
not
None
:
if
self
.
stdout
is
not
None
:
...
...
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