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
70b5d773
Commit
70b5d773
authored
7 years ago
by
Florent Thiery
Browse files
Options
Downloads
Patches
Plain Diff
support single user test execution, refs
#21724
parent
7f7aca77
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
+16
-6
16 additions, 6 deletions
tester.py
with
16 additions
and
6 deletions
tester.py
+
16
−
6
View file @
70b5d773
...
...
@@ -40,7 +40,7 @@ def strip_colors(text):
class
Tester
():
USAGE
=
'''
%s [-e] [-f] [-b] [-d] [-h]
USAGE
=
'''
%s [-e] [-f] [-b] [-d] [-h]
[msuser]
-e: send email with report.
-f: send email with report only if at least one test failed.
-b: run only basic tests (exclude mediaserver tests).
...
...
@@ -55,15 +55,23 @@ class Tester():
log
(
'
\033
[96m- UbiCast applications tester -
\033
[0m
'
)
log
(
'
\033
[96m-------------------------------
\033
[0m
'
)
args
=
list
(
args
)
msuser
=
None
# Check if help is required
if
'
-h
'
in
args
:
log
(
'
USAGE:
'
+
self
.
USAGE
)
sys
.
exit
(
0
)
for
arg
in
args
:
if
arg
not
in
self
.
VALID_ARGS
:
for
index
,
arg
in
enumerate
(
args
)
:
if
arg
not
in
self
.
VALID_ARGS
and
index
+
1
!=
len
(
args
)
:
log
(
'
Invalid argument given:
"
%s
"
.
\n
'
%
arg
)
log
(
'
USAGE:
'
+
self
.
USAGE
)
sys
.
exit
(
1
)
else
:
log
(
"
Optional target user : %s
"
%
arg
)
if
not
os
.
path
.
isdir
(
os
.
path
.
join
(
'
/home
'
,
arg
)):
log
(
"
Mediaserver user %s does not exist
"
%
arg
)
sys
.
exit
(
1
)
else
:
msuser
=
arg
# Check current dir
root_dir
=
utils
.
get_dir
(
__file__
)
if
root_dir
!=
''
:
...
...
@@ -89,7 +97,7 @@ class Tester():
email
=
'
-e
'
in
args
email_if_fail
=
'
-f
'
in
args
basic_only
=
'
-b
'
in
args
tests
=
self
.
discover_tests
(
basic_only
)
tests
=
self
.
discover_tests
(
basic_only
,
msuser
)
if
not
tests
:
sys
.
exit
(
1
)
exit_code
=
self
.
run_tests
(
tests
,
email
,
email_if_fail
)
...
...
@@ -123,7 +131,7 @@ class Tester():
criticality
=
'
not specified
'
return
criticality
,
description
def
discover_tests
(
self
,
basic_only
=
False
):
def
discover_tests
(
self
,
basic_only
=
False
,
msuser
=
None
):
ignored_tests
=
utils
.
get_conf
(
'
TESTER_IGNORED_TESTS
'
,
''
).
split
(
'
,
'
)
# Get standard tests
path
=
os
.
path
.
join
(
self
.
root_dir
,
'
tests
'
)
...
...
@@ -151,10 +159,12 @@ class Tester():
if
basic_only
:
tests
.
sort
(
key
=
lambda
i
:
(
-
criticalities_map
.
get
(
i
[
1
],
0
),
i
[
0
]))
return
tests
elif
msuser
:
tests
=
list
()
# Get MS instances
ms_users
=
list
()
for
user
in
os
.
listdir
(
'
/home
'
):
if
os
.
path
.
exists
(
'
/home/%s/msinstance
'
%
user
):
if
os
.
path
.
exists
(
'
/home/%s/msinstance
'
%
user
)
and
user
==
msuser
:
ms_users
.
append
(
user
)
# Get MediaServer tests
if
ms_users
:
...
...
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