Commit b3f10835 authored by Andrey Kamaev's avatar Andrey Kamaev

run.py: added option to show tests own help

parent 0ea66a38
...@@ -577,6 +577,7 @@ class RunInfo(object): ...@@ -577,6 +577,7 @@ class RunInfo(object):
logfile = userlog[0][userlog[0].find(":")+1:] logfile = userlog[0][userlog[0].find(":")+1:]
if self.targetos == "android": if self.targetos == "android":
hostlogpath = ""
try: try:
andoidcwd = "/data/bin/" + getpass.getuser().replace(" ","") + "_perf/" andoidcwd = "/data/bin/" + getpass.getuser().replace(" ","") + "_perf/"
exename = os.path.basename(exe) exename = os.path.basename(exe)
...@@ -594,18 +595,22 @@ class RunInfo(object): ...@@ -594,18 +595,22 @@ class RunInfo(object):
print >> _stderr, "adb finishes unexpectedly with error code", output print >> _stderr, "adb finishes unexpectedly with error code", output
return return
#run #run
command = exename + " " + " ".join(args) if self.options.help:
command = exename + " --help"
else:
command = exename + " " + " ".join(args)
print >> _stderr, "Running:", command print >> _stderr, "Running:", command
Popen(self.adb + ["shell", "export OPENCV_TEST_DATA_PATH=" + self.test_data_path + "&& cd " + andoidcwd + "&& ./" + command], stdout=_stdout, stderr=_stderr).wait() Popen(self.adb + ["shell", "export OPENCV_TEST_DATA_PATH=" + self.test_data_path + "&& cd " + andoidcwd + "&& ./" + command], stdout=_stdout, stderr=_stderr).wait()
# try get log # try get log
print >> _stderr, "Pulling", logfile, "from device..." if not self.options.help:
hostlogpath = os.path.join(workingDir, logfile) print >> _stderr, "Pulling", logfile, "from device..."
output = Popen(self.adb + ["pull", andoidcwd + logfile, hostlogpath], stdout=_stdout, stderr=_stderr).wait() hostlogpath = os.path.join(workingDir, logfile)
if output != 0: output = Popen(self.adb + ["pull", andoidcwd + logfile, hostlogpath], stdout=_stdout, stderr=_stderr).wait()
print >> _stderr, "adb finishes unexpectedly with error code", output if output != 0:
return print >> _stderr, "adb finishes unexpectedly with error code", output
#rm log return
Popen(self.adb + ["shell", "rm " + andoidcwd + logfile], stdout=_stdout, stderr=_stderr).wait() #rm log
Popen(self.adb + ["shell", "rm " + andoidcwd + logfile], stdout=_stdout, stderr=_stderr).wait()
except OSError: except OSError:
pass pass
if os.path.isfile(hostlogpath): if os.path.isfile(hostlogpath):
...@@ -613,7 +618,10 @@ class RunInfo(object): ...@@ -613,7 +618,10 @@ class RunInfo(object):
return None return None
else: else:
cmd = [exe] cmd = [exe]
cmd.extend(args) if self.options.help:
cmd.append("--help")
else:
cmd.extend(args)
print >> _stderr, "Running:", " ".join(cmd) print >> _stderr, "Running:", " ".join(cmd)
try: try:
Popen(cmd, stdout=_stdout, stderr=_stderr, cwd = workingDir).wait() Popen(cmd, stdout=_stdout, stderr=_stderr, cwd = workingDir).wait()
...@@ -652,6 +660,7 @@ if __name__ == "__main__": ...@@ -652,6 +660,7 @@ if __name__ == "__main__":
parser.add_option("", "--android_test_data_path", dest="test_data_path", help="OPENCV_TEST_DATA_PATH for Android run", metavar="PATH", default="/sdcard/opencv_testdata/") parser.add_option("", "--android_test_data_path", dest="test_data_path", help="OPENCV_TEST_DATA_PATH for Android run", metavar="PATH", default="/sdcard/opencv_testdata/")
parser.add_option("", "--configuration", dest="configuration", help="force Debug or Release donfiguration", metavar="CFG", default="") parser.add_option("", "--configuration", dest="configuration", help="force Debug or Release donfiguration", metavar="CFG", default="")
parser.add_option("", "--serial", dest="adb_serial", help="Android: directs command to the USB device or emulator with the given serial number", metavar="serial number", default="") parser.add_option("", "--serial", dest="adb_serial", help="Android: directs command to the USB device or emulator with the given serial number", metavar="serial number", default="")
parser.add_option("", "--help-tests", dest="help", help="Show help for test executable", action="store_true", default=False)
(options, args) = parser.parse_args(argv) (options, args) = parser.parse_args(argv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment