Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oc_jpegencode_vdt
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
oc_jpegencode_vdt
Commits
8a07f094
Commit
8a07f094
authored
Jan 09, 2015
by
chiggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Temporary debug for travis not importing coverage
parent
4df5e2c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
test_jpeg_top.py
tb/test_jpeg_top.py
+12
-4
No files found.
tb/test_jpeg_top.py
View file @
8a07f094
...
@@ -35,13 +35,12 @@ def compare(i1, i2):
...
@@ -35,13 +35,12 @@ def compare(i1, i2):
@
cocotb
.
coroutine
@
cocotb
.
coroutine
def
process_image
(
dut
,
filename
=
""
,
debug
=
False
,
threshold
=
0.22
):
def
process_image
(
dut
,
filename
=
""
,
debug
=
False
,
threshold
=
0.22
):
"""Run an image file through the jpeg encoder and compare the result"""
"""Run an image file through the jpeg encoder and compare the result"""
cocotb
.
fork
(
Clock
(
dut
.
clk
,
100
)
.
start
())
cocotb
.
fork
(
Clock
(
dut
.
clk
,
100
)
.
start
())
driver
=
ImageDriver
(
dut
)
driver
=
ImageDriver
(
dut
)
monitor
=
JpegMonitor
(
dut
)
monitor
=
JpegMonitor
(
dut
)
if
debug
:
if
debug
:
# pragma: no cover
driver
.
log
.
setLevel
(
logging
.
DEBUG
)
driver
.
log
.
setLevel
(
logging
.
DEBUG
)
monitor
.
log
.
setLevel
(
logging
.
DEBUG
)
monitor
.
log
.
setLevel
(
logging
.
DEBUG
)
...
@@ -49,17 +48,26 @@ def process_image(dut, filename="", debug=False, threshold=0.22):
...
@@ -49,17 +48,26 @@ def process_image(dut, filename="", debug=False, threshold=0.22):
yield
driver
.
send
(
stimulus
)
yield
driver
.
send
(
stimulus
)
output
=
yield
monitor
.
wait_for_recv
()
output
=
yield
monitor
.
wait_for_recv
()
if
debug
:
if
debug
:
# pragma: no cover
output
.
save
(
filename
+
"_process.jpg"
)
output
.
save
(
filename
+
"_process.jpg"
)
difference
=
compare
(
stimulus
,
output
)
difference
=
compare
(
stimulus
,
output
)
dut
.
log
.
info
(
"Compressed image differs to original by
%
f
%%
"
%
(
difference
))
dut
.
log
.
info
(
"Compressed image differs to original by
%
f
%%
"
%
(
difference
))
if
difference
>
threshold
:
if
difference
>
threshold
:
# pragma: no cover
raise
TestFailure
(
"Resulting image file was too different (
%
f >
%
f)"
%
raise
TestFailure
(
"Resulting image file was too different (
%
f >
%
f)"
%
(
difference
,
threshold
))
(
difference
,
threshold
))
try
:
import
coverage
except
ImportError
as
e
:
import
os
,
sys
print
sys
.
path
if
os
.
path
.
isdir
(
"/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages"
):
print
os
.
listdir
(
"/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages"
)
else
:
print
"/home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages doesn't exist"
tf
=
TestFactory
(
process_image
)
tf
=
TestFactory
(
process_image
)
tf
.
add_option
(
"filename"
,
[
os
.
path
.
join
(
'test_images'
,
f
)
tf
.
add_option
(
"filename"
,
[
os
.
path
.
join
(
'test_images'
,
f
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment