Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
envsetup
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor 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
mediaserver
envsetup
Commits
21e264ea
Commit
21e264ea
authored
4 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Log test output for all attemps | refs
#31996
parent
ee43c3d1
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
tester.py
+21
-25
21 additions, 25 deletions
tester.py
with
21 additions
and
25 deletions
tester.py
+
21
−
25
View file @
21e264ea
...
...
@@ -4,16 +4,17 @@
Script to start tests and to manage their results
"""
import
base64
from
io
import
StringIO
import
base64
import
datetime
import
glob
import
os
import
re
import
socket
import
subprocess
import
sys
import
time
import
uuid
import
glob
from
time
import
sleep
import
utils
from
utils
import
log
...
...
@@ -122,22 +123,21 @@ class Tester:
sys
.
path
.
append
(
root_dir
)
# Check that this script is run by root
debug
=
"
-d
"
in
args
whoami
=
subprocess
.
check_output
([
"
whoami
"
]).
decode
(
"
utf-8
"
).
strip
()
if
whoami
!=
"
root
"
and
not
debug
:
if
os
.
environ
.
get
(
"
USER
"
)
!=
"
root
"
and
not
debug
:
log
(
"
This script should be run as root user.
"
)
sys
.
exit
(
1
)
# Update envsetup files
if
"
-n
"
not
in
args
:
tester_path
=
os
.
path
.
join
(
root_dir
,
os
.
path
.
basename
(
__file__
))
mtime
=
os
.
path
.
getmtime
(
tester_path
)
subprocess
.
call
([
"
python3
"
,
"
update_envsetup.py
"
])
subprocess
.
run
([
"
python3
"
,
"
update_envsetup.py
"
])
if
mtime
!=
os
.
path
.
getmtime
(
tester_path
):
log
(
"
The script has changed, restarting it...
"
)
os
.
execl
(
"
/usr/bin/python3
"
,
"
python3
"
,
tester_path
,
"
-n
"
,
*
args
)
sys
.
exit
(
1
)
# not reachable
# Install utilities packages
if
"
-p
"
not
in
args
:
subprocess
.
call
([
"
python3
"
,
"
pkgs_envsetup.py
"
])
subprocess
.
run
([
"
python3
"
,
"
pkgs_envsetup.py
"
])
# Load conf
conf
=
utils
.
load_conf
()
if
not
conf
:
...
...
@@ -260,7 +260,7 @@ class Tester:
ms_path
=
os
.
path
.
join
(
path
,
"
ms-testing-suite
"
)
if
not
os
.
path
.
exists
(
ms_path
):
log
(
'
Cloning ms-testing-suite in
"
%s
"
.
'
%
ms_path
)
subprocess
.
call
(
subprocess
.
run
(
[
"
git
"
,
"
clone
"
,
...
...
@@ -274,11 +274,11 @@ class Tester:
os
.
chdir
(
ms_path
)
branch
=
utils
.
get_conf
(
"
ENVSETUP_BRANCH
"
)
or
"
stable
"
if
branch
:
subprocess
.
call
([
"
git
"
,
"
checkout
"
,
branch
])
subprocess
.
call
([
"
git
"
,
"
fetch
"
,
"
--recurse-submodules
"
,
"
--all
"
])
subprocess
.
call
([
"
git
"
,
"
reset
"
,
"
--hard
"
,
"
origin/{}
"
.
format
(
branch
)])
subprocess
.
call
([
"
git
"
,
"
pull
"
,
"
--recurse-submodules
"
])
subprocess
.
call
([
"
git
"
,
"
submodule
"
,
"
update
"
,
"
--init
"
,
"
--recursive
"
])
subprocess
.
run
([
"
git
"
,
"
checkout
"
,
branch
])
subprocess
.
run
([
"
git
"
,
"
fetch
"
,
"
--recurse-submodules
"
,
"
--all
"
])
subprocess
.
run
([
"
git
"
,
"
reset
"
,
"
--hard
"
,
"
origin/{}
"
.
format
(
branch
)])
subprocess
.
run
([
"
git
"
,
"
pull
"
,
"
--recurse-submodules
"
])
subprocess
.
run
([
"
git
"
,
"
submodule
"
,
"
update
"
,
"
--init
"
,
"
--recursive
"
])
os
.
chdir
(
self
.
root_dir
)
# Add tests to list
log
(
"
Add MediaServer tests if available.
"
)
...
...
@@ -329,20 +329,18 @@ class Tester:
while
count
<
3
:
count
+=
1
log
(
"
Attempt: %s
"
%
str
(
count
))
p
=
subprocess
.
Pope
n
(
p
=
subprocess
.
ru
n
(
command
,
stdin
=
s
ys
.
stdin
,
stdin
=
s
ubprocess
.
DEVNULL
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
)
out
,
_
=
p
.
communicate
()
out
=
p
.
stdout
.
decode
(
"
utf-8
"
).
strip
()
log
(
out
)
if
p
.
returncode
in
(
0
,
2
,
3
):
break
sleep
(
5
*
count
*
count
)
if
out
:
out
=
out
.
decode
(
"
utf-8
"
).
strip
()
out_of_support
=
out_of_support
or
"
out of support
"
in
out
log
(
out
)
time
.
sleep
(
5
*
count
*
count
)
out_of_support
=
out_of_support
or
"
out of support
"
in
out
if
p
.
returncode
==
0
:
status
=
"
\033
[92msuccess
\033
[0m
"
successes
+=
1
...
...
@@ -440,10 +438,8 @@ class Tester:
except
Exception
as
e
:
log
(
"
Failed to remove old log: %s
"
%
e
)
# Write log to file
hostname
=
subprocess
.
check_output
([
"
hostname
"
])
if
hostname
:
hostname
=
hostname
.
decode
(
"
utf-8
"
).
strip
()
else
:
hostname
=
socket
.
gethostname
()
if
not
hostname
:
log
(
"
Failed to get hostname (required to send email).
"
)
log_name
=
"
results_%s_%s.txt
"
%
(
hostname
or
"
noname
"
,
...
...
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