***
Wartungsfenster jeden ersten Mittwoch vormittag im Monat
***
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rendering Data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
E193-02 Rendering Course
Rendering Data
Commits
71c08f26
Commit
71c08f26
authored
1 year ago
by
android172
Browse files
Options
Downloads
Patches
Plain Diff
Changed timeout times
parent
bccee4c0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
assignment2/run_tests.py
+62
-37
62 additions, 37 deletions
assignment2/run_tests.py
with
62 additions
and
37 deletions
assignment2/run_tests.py
+
62
−
37
View file @
71c08f26
...
...
@@ -14,16 +14,14 @@ RENDER_SCENES = [
[
"
cbox_ajax_bunny_benchmark.xml
"
,
100
,
""
,
""
],
[
"
sponza_intersections.xml
"
,
50
,
""
,
""
],
[
"
sponza_normals.xml
"
,
20
,
""
,
""
],
[
"
sponza_benchmark.xml
"
,
28
00
,
""
,
""
],
[
"
sponza_benchmark.xml
"
,
10
00
,
""
,
""
],
[
"
veach_room_intersections.xml
"
,
10
,
""
,
""
],
[
"
veach_room_normals.xml
"
,
10
,
""
,
""
],
[
"
veach_room_benchmark.xml
"
,
3
0
,
""
,
""
],
[
"
cbox_ajax_bunny_pt.xml
"
,
100
,
""
,
""
]
[
"
veach_room_benchmark.xml
"
,
8
0
,
""
,
""
],
[
"
cbox_ajax_bunny_pt.xml
"
,
100
,
""
,
""
]
,
]
TEST_SCENES
=
[
]
TEST_SCENES
=
[]
TEST_WARPS
=
[]
...
...
@@ -39,60 +37,70 @@ def find_build_directory():
return
os
.
path
.
join
(
root
,
"
../build
"
)
return
os
.
path
.
join
(
root
,
"
build
"
)
def
extract_times
(
text_log
,
value_for_failure
):
import
re
pattern_1
=
r
'
# benchmark # Building the acceleration structure took: (.*) s
'
pattern_2
=
r
'
# benchmark # Rendering took: (.*) s
'
pattern_1
=
r
"
# benchmark # Building the acceleration structure took: (.*) s
"
pattern_2
=
r
"
# benchmark # Rendering took: (.*) s
"
match_1
=
re
.
search
(
pattern_1
,
text_log
)
match_2
=
re
.
search
(
pattern_2
,
text_log
)
build_time
=
float
(
match_1
.
group
(
1
))
if
match_1
else
-
1
render_time
=
float
(
match_2
.
group
(
1
))
if
match_2
else
-
1
build_time_s
=
str
(
round
(
build_time
,
4
))
if
build_time
!=
-
1
else
value_for_failure
render_time_s
=
str
(
round
(
render_time
,
2
))
if
render_time
!=
-
1
else
value_for_failure
render_time_s
=
(
str
(
round
(
render_time
,
2
))
if
render_time
!=
-
1
else
value_for_failure
)
return
build_time_s
,
render_time_s
def
test_warps_and_scenes
():
total
=
len
(
TEST_SCENES
)
+
len
(
TEST_WARPS
)
passed
=
0
failed
=
[]
build_dir
=
find_build_directory
()
print
(
build_dir
)
print
(
build_dir
)
unit_test_output
=
open
(
"
unit_test_output.csv
"
,
"
w
"
)
times_output
=
open
(
"
times.csv
"
,
"
w
"
)
for
t
,
to
,
skip
,
skip_to
in
RENDER_SCENES
:
for
t
,
to
,
skip
,
skip_to
in
RENDER_SCENES
:
if
(
skip
and
os
.
path
.
exists
(
skip
))
or
(
skip_to
and
os
.
path
.
exists
(
skip_to
)):
times_output
.
write
(
t
.
replace
(
"
_
"
,
"
\_
"
)
+
"
, skipped, skipped,
"
+
str
(
round
(
to
,
2
))
+
"
\n
"
)
times_output
.
write
(
t
.
replace
(
"
_
"
,
"
\_
"
)
+
"
, skipped, skipped,
"
+
str
(
round
(
to
,
2
))
+
"
\n
"
)
continue
path
=
t
try
:
ret
:
subprocess
.
CompletedProcess
=
subprocess
.
run
(
[
os
.
path
.
join
(
build_dir
,
"
nori
"
),
path
,
"
--no-gui
"
],
[
os
.
path
.
join
(
build_dir
,
"
nori
"
),
path
,
"
--no-gui
"
],
timeout
=
to
,
capture_output
=
True
,
text
=
True
text
=
True
,
)
print
(
ret
.
stdout
)
print
(
ret
.
stderr
)
bt_s
,
rt_s
=
extract_times
(
ret
.
stdout
,
"
-
"
if
ret
.
returncode
==
0
else
"
error
"
)
bt_s
,
rt_s
=
extract_times
(
ret
.
stdout
,
"
-
"
if
ret
.
returncode
==
0
else
"
error
"
)
except
subprocess
.
TimeoutExpired
as
e
:
out
=
e
.
stdout
.
decode
(
'
utf-8
'
)
if
e
.
stdout
else
""
err
=
e
.
stderr
.
decode
(
'
utf-8
'
)
if
e
.
stderr
else
""
out
=
e
.
stdout
.
decode
(
"
utf-8
"
)
if
e
.
stdout
else
""
err
=
e
.
stderr
.
decode
(
"
utf-8
"
)
if
e
.
stderr
else
""
print
(
out
)
print
(
err
)
bt_s
,
rt_s
=
extract_times
(
out
,
"
timeout
"
)
with
open
(
"
to_
"
+
t
,
'
w
'
)
as
fp
:
with
open
(
"
to_
"
+
t
,
"
w
"
)
as
fp
:
pass
to_s
=
str
(
round
(
to
,
2
))
times_output
.
write
(
t
.
replace
(
"
_
"
,
"
\_
"
)
+
"
,
"
+
bt_s
+
"
,
"
+
rt_s
+
"
,
"
+
to_s
+
"
\n
"
)
times_output
.
write
(
t
.
replace
(
"
_
"
,
"
\_
"
)
+
"
,
"
+
bt_s
+
"
,
"
+
rt_s
+
"
,
"
+
to_s
+
"
\n
"
)
for
t
in
TEST_SCENES
:
path
=
t
...
...
@@ -100,15 +108,15 @@ def test_warps_and_scenes():
ret
=
subprocess
.
call
([
os
.
path
.
join
(
build_dir
,
"
nori
"
),
path
])
end_time
=
time
.
time
()
elapsed_time
=
end_time
-
start_time
elapsed_time_milliSeconds
=
elapsed_time
*
1000
elapsed_time_milliSeconds
=
elapsed_time
*
1000
times_output
.
write
(
t
+
"
,
"
+
str
(
int
(
elapsed_time_milliSeconds
))
+
"
\n
"
)
unit_test_output
.
write
(
f
"
{
t
}
;
{
(
'
passed
'
if
ret
==
0
else
'
failed
'
)
}
\n
"
)
unit_test_output
.
write
(
f
"
{
t
}
;
{
(
'
passed
'
if
ret
==
0
else
'
failed
'
)
}
\n
"
)
if
ret
==
0
:
passed
+=
1
else
:
failed
.
append
(
t
)
for
(
warp_type
,
param
)
in
TEST_WARPS
:
for
warp_type
,
param
in
TEST_WARPS
:
args
=
[
os
.
path
.
join
(
build_dir
,
"
warptest
"
),
warp_type
]
if
param
is
not
None
:
if
not
isinstance
(
param
,
(
list
,
tuple
)):
...
...
@@ -116,29 +124,46 @@ def test_warps_and_scenes():
for
p
in
param
:
args
.
append
(
str
(
p
))
ret
=
subprocess
.
call
(
args
)
unit_test_output
.
write
(
f
"
{
warp_type
}
/
{
param
if
param
!
=
None
else
''
}
;
{
(
'
passed
'
if
ret
==
0
else
'
failed
'
)
}
\n
"
)
unit_test_output
.
write
(
f
"
{
warp_type
}
/
{
param
if
param
!
=
None
else
''
}
;
{
(
'
passed
'
if
ret
==
0
else
'
failed
'
)
}
\n
"
)
if
ret
==
0
:
passed
+=
1
else
:
failed
.
append
(
'
'
.
join
(
args
))
failed
.
append
(
"
"
.
join
(
args
))
print
(
""
)
if
passed
<
total
:
print
(
"
\033
[91m
"
+
"
Passed
"
+
str
(
passed
)
+
"
/
"
+
str
(
total
)
+
"
tests.
"
+
"
\033
[0m
"
)
print
(
"
\033
[91m
"
+
"
Passed
"
+
str
(
passed
)
+
"
/
"
+
str
(
total
)
+
"
tests.
"
+
"
\033
[0m
"
)
print
(
"
Failed tests (includes bonus point tests):
"
)
for
t
in
failed
:
print
(
"
\t
"
+
str
(
t
))
return
False
else
:
print
(
"
\033
[92m
"
+
"
Passed
"
+
str
(
passed
)
+
"
/
"
+
str
(
total
)
+
"
tests.
"
+
"
\033
[0m
"
)
print
(
"
\033
[92m
"
+
"
Passed
"
+
str
(
passed
)
+
"
/
"
+
str
(
total
)
+
"
tests.
"
+
"
\033
[0m
"
)
print
(
"
\t
Good job!
"
)
unit_test_output
.
close
()
return
True
if
__name__
==
'
__main__
'
:
if
__name__
==
"
__main__
"
:
test_warps_and_scenes
()
sys
.
exit
(
0
)
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