summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Traut <manut@linutronix.de>2017-09-19 08:51:06 +0200
committerManuel Traut <manut@linutronix.de>2017-09-19 08:51:06 +0200
commit6741aee90db710ca4b8a45e2159ddf70c84b171c (patch)
tree7b9279d30cfe72d8bfd7c9d50528bbf1de5490a6
initial import
Signed-off-by: Manuel Traut <manut@linutronix.de>
-rw-r--r--.gitignore7
-rw-r--r--debian/changelog5
-rw-r--r--debian/compat1
-rw-r--r--debian/control13
-rw-r--r--debian/copyright34
-rwxr-xr-xdebian/rules24
-rw-r--r--debian/source/format1
-rwxr-xr-xpjutest35
-rw-r--r--setup.py12
9 files changed, 132 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..22afc5d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+build
+.pybuild
+debian/files
+debian/pjutest
+debian/pjutest.debhelper.log
+debian/pjutest.substvars
+debian/.debhelper
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..0b43ee5
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+pjutest (1.0) unstable; urgency=medium
+
+ * Initial Release.
+
+ -- Manuel Traut <manut@linutronix.de> Tue, 19 Sep 2017 08:27:01 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..4213b0c
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,13 @@
+Source: pjutest
+Section: text
+Priority: optional
+Maintainer: Manuel Traut <manut@linutronix.de>
+Build-Depends: debhelper (>= 9), python3
+Standards-Version: 3.9.8
+
+Package: pjutest
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, python3-junit.xml
+Description: commandline unit-test wrapper
+ use it with 'pjutest anycmd' it will capture stdout, stderr of anycmd and
+ log it into a junit xml file. multiple calls append to an existing xml.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..b5e54d7
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,34 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: pjutest
+Source: <url://example.com>
+
+Files: *
+Copyright: <years> <put author's name and email here>
+ <years> <likewise for another author>
+License: GPL-3.0+
+
+Files: debian/*
+Copyright: 2017 Manuel Traut <manut@linutronix.de>
+License: GPL-3.0+
+
+License: GPL-3.0+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+ .
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+ .
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
+
+# Please also look if there are files or directories which have a
+# different copyright/license attached and list them here.
+# Please avoid picking licenses with terms that are more restrictive than the
+# packaged work, as it may make Debian's contributions unacceptable upstream.
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..ba19335
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,24 @@
+#!/usr/bin/make -f
+# See debhelper(7) (uncomment to enable)
+# output every command that modifies files on the build system.
+#export DH_VERBOSE = 1
+
+
+# see FEATURE AREAS in dpkg-buildflags(1)
+#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+
+# see ENVIRONMENT in dpkg-buildflags(1)
+# package maintainers to append CFLAGS
+#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
+# package maintainers to append LDFLAGS
+#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+
+
+%:
+ dh $@ --buildsystem=pybuild --with python3
+
+# dh_make generated override targets
+# This is example for Cmake (See https://bugs.debian.org/641051 )
+#override_dh_auto_configure:
+# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
+
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/pjutest b/pjutest
new file mode 100755
index 0000000..8edc4f2
--- /dev/null
+++ b/pjutest
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+#
+# pjutest - junit xml generator
+
+from junit_xml import TestSuite, TestCase
+from pickle import dump, load
+from subprocess import Popen, PIPE, STDOUT
+
+import os
+import sys
+
+if len (sys.argv) != 2:
+ print("%s 'mycmd param1' # to record a test" % sys.argv[0])
+ sys.exit(-1)
+
+if os.path.exists('pjutest.dat'):
+ with open('pjutest.dat', 'r') as dat:
+ tss = load(dat)
+else:
+ tss = [TestSuite("suite", None)]
+
+p = Popen(sys.argv[1], shell=True, stdout=PIPE, stderr=PIPE)
+out,err = p.communicate()
+
+tc = TestCase(sys.argv[1], 'sh', 2, out[:-1], err[:-1])
+if p.returncode:
+ tc.add_failure_info(err, "return: %d" % p.returncode)
+
+tss[0].test_cases.append(tc)
+
+with open('pjutest.dat', 'w') as dat:
+ dump(tss, dat)
+
+with open('pjutest.xml', 'w') as xml:
+ TestSuite.to_file(xml, tss, prettyprint=True)
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..bdf4c7c
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+from distutils.core import setup
+
+setup(name='pjutest',
+ version='1.0',
+ description='junit xml generator',
+ author='Manuel Traut',
+ author_email='manut@linutronix.de',
+ url='http://mecka.net/',
+ scripts=['pjutest'],
+)