Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
jvoisin
mat2
Commits
911d822c
Commit
911d822c
authored
May 08, 2019
by
jvoisin
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests to find possible race-conditions in the cli
parent
7e031c97
Pipeline
#24617
failed with stages
in 2 minutes and 11 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
tests/test_climat2.py
tests/test_climat2.py
+39
-0
No files found.
tests/test_climat2.py
View file @
911d822c
...
...
@@ -2,6 +2,9 @@ import os
import
shutil
import
subprocess
import
unittest
import
glob
from
libmat2
import
images
,
parser_factory
mat2_binary
=
[
'./mat2'
]
...
...
@@ -181,3 +184,39 @@ class TestControlCharInjection(unittest.TestCase):
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
proc
.
communicate
()
self
.
assertIn
(
b
'Comment: GQ
\n
'
,
stdout
)
class
TestCommandLineParallel
(
unittest
.
TestCase
):
iterations
=
24
def
test_same
(
self
):
for
i
in
range
(
self
.
iterations
):
shutil
.
copy
(
'./tests/data/dirty.jpg'
,
'./tests/data/dirty_%d.jpg'
%
i
)
proc
=
subprocess
.
Popen
(
mat2_binary
+
[
'./tests/data/dirty_%d.jpg'
%
i
for
i
in
range
(
self
.
iterations
)],
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
proc
.
communicate
()
for
i
in
range
(
self
.
iterations
):
path
=
'./tests/data/dirty_%d.jpg'
%
i
p
=
images
.
JPGParser
(
'./tests/data/dirty_%d.cleaned.jpg'
%
i
)
self
.
assertEqual
(
p
.
get_meta
(),
{})
os
.
remove
(
'./tests/data/dirty_%d.cleaned.jpg'
%
i
)
os
.
remove
(
path
)
def
test_different
(
self
):
shutil
.
copytree
(
'./tests/data/'
,
'./tests/data/parallel'
)
proc
=
subprocess
.
Popen
(
mat2_binary
+
glob
.
glob
(
'./tests/data/parallel/dirty.*'
),
stdout
=
subprocess
.
PIPE
)
stdout
,
_
=
proc
.
communicate
()
for
i
in
glob
.
glob
(
'./test/data/parallel/dirty.cleaned.*'
):
p
,
mime
=
parser_factory
.
get_parser
(
i
)
self
.
assertIsNotNone
(
mime
)
self
.
assertIsNotNone
(
p
)
p
=
parser_factory
.
get_parser
(
p
.
output_filename
)
self
.
assertEqual
(
p
.
get_meta
(),
{})
print
(
'DELET: %s'
%
i
)
shutil
.
rmtree
(
'./tests/data/parallel'
)
jvoisin
@jvoisin
mentioned in merge request
!43 (closed)
·
May 08, 2019
mentioned in merge request
!43 (closed)
mentioned in merge request !43
Toggle commit list
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