Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
6aaa6a50
Commit
6aaa6a50
authored
Apr 01, 2015
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3887 from MSOpenTech:update_py_script
parents
80c79d40
ae090fe1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
1 deletion
+45
-1
run.py
modules/ts/misc/run.py
+45
-1
No files found.
modules/ts/misc/run.py
View file @
6aaa6a50
...
...
@@ -850,12 +850,51 @@ def getRunArgs(args):
path
=
npath
return
run_args
if
hostos
==
"nt"
:
def
moveTests
(
instance
,
destination
):
src
=
os
.
path
.
dirname
(
instance
.
tests_dir
)
# new binaries path
newBinPath
=
os
.
path
.
join
(
destination
,
"bin"
)
try
:
# copy binaries and CMakeCache.txt to the specified destination
shutil
.
copytree
(
src
,
newBinPath
)
shutil
.
copy
(
os
.
path
.
join
(
instance
.
path
,
"CMakeCache.txt"
),
os
.
path
.
join
(
destination
,
"CMakeCache.txt"
))
except
Exception
,
e
:
print
"Copying error occurred:"
,
str
(
e
)
exit
(
e
.
errno
)
# pattern of CMakeCache.txt string to be replaced
replacePattern
=
re
.
compile
(
"EXECUTABLE_OUTPUT_PATH:PATH=(.+)"
)
with
open
(
os
.
path
.
join
(
destination
,
"CMakeCache.txt"
),
"r"
)
as
cachefile
:
try
:
cachedata
=
cachefile
.
read
()
if
hostos
==
'nt'
:
# fix path slashes on nt systems
newBinPath
=
re
.
sub
(
r"\\"
,
r"/"
,
newBinPath
)
# replace old binaries path in CMakeCache.txt
cachedata
=
re
.
sub
(
re
.
search
(
replacePattern
,
cachedata
)
.
group
(
1
),
newBinPath
,
cachedata
)
except
Exception
,
e
:
print
"Reading error occurred:"
,
str
(
e
)
exit
(
e
.
errno
)
with
open
(
os
.
path
.
join
(
destination
,
"CMakeCache.txt"
),
"w"
)
as
cachefile
:
try
:
cachefile
.
write
(
cachedata
)
except
Exception
,
e
:
print
"Writing error occurred:"
,
str
(
e
)
exit
(
e
.
errno
)
exit
()
if
__name__
==
"__main__"
:
test_args
=
[
a
for
a
in
sys
.
argv
if
a
.
startswith
(
"--perf_"
)
or
a
.
startswith
(
"--gtest_"
)]
argv
=
[
a
for
a
in
sys
.
argv
if
not
(
a
.
startswith
(
"--perf_"
)
or
a
.
startswith
(
"--gtest_"
))]
parser
=
OptionParser
()
parser
=
OptionParser
(
usage
=
"run.py [options] [build_path]"
,
description
=
"Note: build_path is required if running not from CMake build directory"
)
parser
.
add_option
(
"-t"
,
"--tests"
,
dest
=
"tests"
,
help
=
"comma-separated list of modules to test"
,
metavar
=
"SUITS"
,
default
=
""
)
if
hostos
==
"nt"
:
parser
.
add_option
(
"-m"
,
"--move_tests"
,
dest
=
"move"
,
help
=
"location to move current tests build"
,
metavar
=
"PATH"
,
default
=
""
)
parser
.
add_option
(
"-w"
,
"--cwd"
,
dest
=
"cwd"
,
help
=
"working directory for tests"
,
metavar
=
"PATH"
,
default
=
"."
)
parser
.
add_option
(
"-a"
,
"--accuracy"
,
dest
=
"accuracy"
,
help
=
"look for accuracy tests instead of performance tests"
,
action
=
"store_true"
,
default
=
False
)
parser
.
add_option
(
"-l"
,
"--longname"
,
dest
=
"useLongNames"
,
action
=
"store_true"
,
help
=
"generate log files with long names"
,
default
=
False
)
...
...
@@ -880,6 +919,7 @@ if __name__ == "__main__":
if
len
(
run_args
)
==
0
:
print
>>
sys
.
stderr
,
"Usage:"
,
os
.
path
.
basename
(
sys
.
argv
[
0
]),
"[options] [build_path]"
print
>>
sys
.
stderr
,
"Please specify build_path or run script from CMake build directory"
exit
(
1
)
options
.
android_env
=
{}
...
...
@@ -906,6 +946,10 @@ if __name__ == "__main__":
test_list
=
[]
for
path
in
run_args
:
suite
=
TestSuite
(
options
,
path
)
if
hostos
==
"nt"
:
if
(
options
.
move
):
moveTests
(
suite
,
options
.
move
)
#print vars(suite),"\n"
if
options
.
list
:
test_list
.
extend
(
suite
.
tests
)
...
...
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