[PATCH 1/3] adt-run: add --tests-dir option for selecting tests directory
Antonio Terceiro
terceiro at debian.org
Sat Jun 28 00:17:19 UTC 2014
---
debian/changelog | 5 +++++
lib/testdesc.py | 7 +++----
runner/adt-run | 10 +++++++---
runner/adt-run.1 | 4 ++++
4 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index bdb9685..6c7ae24 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,6 @@
autopkgtest (3.0) UNRELEASED; urgency=medium
+ [ Martin Pitt ]
Improvements:
* Convert doc/README.* to reStructuredText and rename to *.rst. Build HTML
files from them using rst2html and install them also.
@@ -34,6 +35,10 @@ autopkgtest (3.0) UNRELEASED; urgency=medium
actually set. This avoids confusing error messages if something fails
during early test bed setup.
+ [ Antonio Terceiro ]
+ * adt-run: add --tests-dir option for selecting a tests directory other then
+ debian/tests
+
-- Martin Pitt <mpitt at debian.org> Wed, 25 Jun 2014 07:43:32 +0200
autopkgtest (2.20) unstable; urgency=medium
diff --git a/lib/testdesc.py b/lib/testdesc.py
index b7dd196..2cb40c8 100644
--- a/lib/testdesc.py
+++ b/lib/testdesc.py
@@ -280,7 +280,7 @@ def _parse_debian_depends(testname, dep_str, srcdir):
return deps
-def parse_debian_source(srcdir, testbed_caps):
+def parse_debian_source(srcdir, testbed_caps, tests_dir):
'''Parse test descriptions from a Debian DEP-8 source dir
Return (list of Test objects, some_skipped). If this encounters any invalid
@@ -292,15 +292,14 @@ def parse_debian_source(srcdir, testbed_caps):
'''
some_skipped = False
tests = []
- for record in parse_rfc822(os.path.join(srcdir, 'debian', 'tests',
- 'control')):
+ for record in parse_rfc822(os.path.join(srcdir, tests_dir, 'control')):
try:
try:
test_names = record['Tests'].split()
except KeyError:
raise InvalidControl('*', 'missing "Tests" field')
- test_dir = record.get('Tests-directory', 'debian/tests')
+ test_dir = record.get('Tests-directory', tests_dir)
depends = _parse_debian_depends(test_names[0],
record.get('Depends', '@'),
srcdir)
diff --git a/runner/adt-run b/runner/adt-run
index 0dffa22..16f5091 100755
--- a/runner/adt-run
+++ b/runner/adt-run
@@ -349,6 +349,10 @@ def parse_args():
parser.add_option('--apt-pocket', metavar='POCKETNAME', action='append',
default=[],
help='Enable additional apt source for POCKETNAME')
+ parser.add_option('--tests-dir', metavar='TESTSDIR', dest='tests_dir',
+ default='debian/tests',
+ help='Read test specifications from TESTSDIR instead of '
+ 'debian/tests')
# ----------
# actual meat:
@@ -1678,8 +1682,8 @@ def build_source(act):
'cd [a-z0-9]*-*/.',
'pwd >&3',
'sed -n "1 {s/).*//; s/ (/\\n/; p}" debian/changelog >&3',
- 'set +e; test -f debian/tests/control; echo $? >&3',
- 'grep -q "^Restrictions:.*\\bbuild-needed\\b" debian/tests/control; echo $? >&3'
+ 'set +e; test -f %s/control; echo $? >&3' % opts.tests_dir,
+ 'grep -q "^Restrictions:.*\\bbuild-needed\\b" %s/control; echo $? >&3' % opts.tests_dir
]
(result_pwd, testpkg_name, testpkg_version, control_test_rc, build_needed_rc) = \
@@ -1838,7 +1842,7 @@ def process_actions():
pending_click_source = None
else:
build_source(act) # sets act.tests_tree
- (act.tests, skipped) = testdesc.parse_debian_source(act.tests_tree.host, testbed.caps)
+ (act.tests, skipped) = testdesc.parse_debian_source(act.tests_tree.host, testbed.caps, opts.tests_dir)
if skipped:
errorcode |= 2
diff --git a/runner/adt-run.1 b/runner/adt-run.1
index 334d98d..8f6357b 100644
--- a/runner/adt-run.1
+++ b/runner/adt-run.1
@@ -295,6 +295,10 @@ that pocket to
Note that this does not imply calling
.B apt-get update\fR.
+.TP
+.BI \-\-tests\-dir= DIR
+Read tests specifications from DIR instead of \fIdebian/tests\fR.
+
.SH VIRTUALIZATION SERVER
.TP
--
2.0.0
More information about the autopkgtest-devel
mailing list