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
6ad1f731
"global-conf.sh" did not exist on "3db4751a8491b74cb2c20de7300b7f100e185e6a"
Commit
6ad1f731
authored
8 years ago
by
Stéphane Diemer
Browse files
Options
Downloads
Patches
Plain Diff
Display tests duration (refs
#20583
).
parent
a0c47c49
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
+13
-8
13 additions, 8 deletions
tester.py
with
13 additions
and
8 deletions
tester.py
+
13
−
8
View file @
6ad1f731
...
@@ -165,6 +165,7 @@ class Tester():
...
@@ -165,6 +165,7 @@ class Tester():
results
=
list
()
results
=
list
()
successes
=
0
successes
=
0
failures
=
0
failures
=
0
total_duration
=
None
for
name
,
description
,
command
in
tests
:
for
name
,
description
,
command
in
tests
:
log
(
'
\033
[1;95m-- Test
"
%s
"
--
\033
[0;0m
'
%
name
)
log
(
'
\033
[1;95m-- Test
"
%s
"
--
\033
[0;0m
'
%
name
)
start_date
=
datetime
.
datetime
.
utcnow
()
start_date
=
datetime
.
datetime
.
utcnow
()
...
@@ -186,14 +187,19 @@ class Tester():
...
@@ -186,14 +187,19 @@ class Tester():
failures
+=
1
failures
+=
1
log
(
'
Command exited with code %s.
'
%
p
.
returncode
)
log
(
'
Command exited with code %s.
'
%
p
.
returncode
)
end_date
=
datetime
.
datetime
.
utcnow
()
end_date
=
datetime
.
datetime
.
utcnow
()
log
(
'
Test end: %s UTC (duration: %s).
'
%
(
end_date
.
strftime
(
'
%Y-%m-%d %H:%M:%S
'
),
end_date
-
start_date
))
duration
=
end_date
-
start_date
results
.
append
((
name
,
description
,
command
,
success
))
if
total_duration
:
total_duration
+=
duration
else
:
total_duration
=
duration
log
(
'
Test end: %s UTC (duration: %s).
'
%
(
end_date
.
strftime
(
'
%Y-%m-%d %H:%M:%S
'
),
duration
))
results
.
append
((
name
,
description
,
command
,
success
,
duration
))
exit_code
=
1
if
failures
>
0
else
0
exit_code
=
1
if
failures
>
0
else
0
# Display results
# Display results
log
(
'
\n
Tests results:
'
)
log
(
'
\n
Tests results:
'
)
html_report
=
'
<table border=
"
1
"
>
'
html_report
=
'
<table border=
"
1
"
>
'
html_report
+=
'
\n
<tr><th>Test</th><th>Result</th><th>Description</th></tr>
'
html_report
+=
'
\n
<tr><th>Test</th><th>Result</th><th>
Duration</th><th>
Description</th></tr>
'
for
name
,
description
,
command
,
success
in
results
:
for
name
,
description
,
command
,
success
,
duration
in
results
:
if
success
is
None
:
if
success
is
None
:
html_result
=
'
<span style=
"
color: blue;
"
>not testable</span>
'
html_result
=
'
<span style=
"
color: blue;
"
>not testable</span>
'
term_result
=
'
\033
[94mnot testable
\033
[0m
'
term_result
=
'
\033
[94mnot testable
\033
[0m
'
...
@@ -203,9 +209,9 @@ class Tester():
...
@@ -203,9 +209,9 @@ class Tester():
else
:
else
:
html_result
=
'
<span style=
"
color: red;
"
>failure</span>
'
html_result
=
'
<span style=
"
color: red;
"
>failure</span>
'
term_result
=
'
\033
[91mfailure
\033
[0m
'
term_result
=
'
\033
[91mfailure
\033
[0m
'
log
(
'
%s: %s
'
%
(
name
,
term_result
))
log
(
'
%s: %s
(%s)
'
%
(
name
,
term_result
,
duration
))
html_report
+=
'
\n
<tr><td>%s</td><td>%s</td><td>%s</td></tr>
'
%
(
name
,
html_result
,
description
.
replace
(
'
\n
'
,
'
<br/>
\n
'
))
html_report
+=
'
\n
<tr><td>%s</td><td>%s</td><td>%s</td><
td>%s</td><
/tr>
'
%
(
name
,
html_result
,
duration
,
description
.
replace
(
'
\n
'
,
'
<br/>
\n
'
))
log
(
'
'
)
log
(
'
Total tests duration: %s.
\n
'
%
total_duration
)
html_report
+=
'
\n
</table>
'
html_report
+=
'
\n
</table>
'
# Store locally results
# Store locally results
now
=
datetime
.
datetime
.
utcnow
()
now
=
datetime
.
datetime
.
utcnow
()
...
@@ -265,7 +271,6 @@ class Tester():
...
@@ -265,7 +271,6 @@ class Tester():
else
:
else
:
log
(
'
Too many consecutive tester failures: %s, no email will be sent.
'
%
consecutive_failures
)
log
(
'
Too many consecutive tester failures: %s, no email will be sent.
'
%
consecutive_failures
)
if
send_email
:
if
send_email
:
log
(
''
)
recipients
=
utils
.
get_conf
(
'
EMAIL_ADMINS
'
)
recipients
=
utils
.
get_conf
(
'
EMAIL_ADMINS
'
)
if
not
recipients
:
if
not
recipients
:
log
(
'
No recipients defined for email sending. Set a value for EMAIL_ADMINS.
'
)
log
(
'
No recipients defined for email sending. Set a value for EMAIL_ADMINS.
'
)
...
...
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