summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Traut <manut@linutronix.de>2017-12-04 17:07:28 +0100
committerManuel Traut <manut@linutronix.de>2017-12-04 17:07:28 +0100
commit572e2642b5cc0f6e51d0b64e59bfc8081aa2ab11 (patch)
tree542cf45dc17d423b22c5f1883b21a6955ebf229d
parent44e2248fb9982efa76a4b0c61c81ad5ee9b7abb4 (diff)
add --name Parameter to specify a test-case name
Signed-off-by: Manuel Traut <manut@linutronix.de>
-rwxr-xr-xpyjutest10
1 files changed, 7 insertions, 3 deletions
diff --git a/pyjutest b/pyjutest
index 5c3f60a..96766cb 100755
--- a/pyjutest
+++ b/pyjutest
@@ -22,6 +22,7 @@ from pyju.version import pyju_version
oparser = OptionParser(usage="usage: %prog [options] \'mycmd param1 param2\'")
oparser.add_option("--version", dest="version", action="store_true", default=False)
oparser.add_option("--class", dest="uclass", default="sh")
+oparser.add_option("--name", dest="uname", default=None)
(opt,args) = oparser.parse_args(sys.argv)
@@ -35,6 +36,9 @@ if len(args) != 2:
cmd = args[1]
+if not opt.uname:
+ opt.uname = cmd
+
if os.path.exists('pyjutest.dat'):
with open('pyjutest.dat', 'rb') as dat:
tss = load(dat)
@@ -48,7 +52,7 @@ out,err = p.communicate()
duration = time.time() - start
-tc = TestCase(cmd, opt.uclass, duration, out[:-1].decode('utf-8'),
+tc = TestCase(opt.uname, opt.uclass, duration, out[:-1].decode('utf-8'),
err[:-1].decode('utf-8'))
if p.returncode:
@@ -62,9 +66,9 @@ with open('pyjutest.dat', 'wb') as dat:
with open('pyjutest.xml', 'w') as xml:
TestSuite.to_file(xml, tss, prettyprint=True)
-print("%s STDOUT:" % cmd)
+print("%s STDOUT:" % opt.uname)
for l in out.decode().split("\n"):
print(l)
-print("%s STDERR:" % cmd)
+print("%s STDERR:" % opt.uname)
for l in err.decode().split("\n"):
print(l, file=sys.stderr)