[linux] 03/12: tests: Begin autopkgtest wrapper for selftests
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Thu Aug 13 13:23:26 UTC 2015
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch benh/autopkgtest
in repository linux.
commit 69966f3b991bc4b2df10ef1d807fdf3dedac40a9
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Wed Aug 12 00:21:41 2015 +0200
tests: Begin autopkgtest wrapper for selftests
To start with, just use kexec to test that each kernel boots.
---
debian/.gitignore | 1 +
debian/bin/gencontrol.py | 21 +++++++++++++++++-
debian/changelog | 6 ++++++
debian/templates/tests-control.main.in | 3 +++
debian/tests/selftests | 39 ++++++++++++++++++++++++++++++++++
5 files changed, 69 insertions(+), 1 deletion(-)
diff --git a/debian/.gitignore b/debian/.gitignore
index 9df6faf..597471e 100644
--- a/debian/.gitignore
+++ b/debian/.gitignore
@@ -15,4 +15,5 @@
/po/
/rules.gen
/stamps/
+/tests/control
/xen-linux-system-*
diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py
index 7eaba6f..0443975 100755
--- a/debian/bin/gencontrol.py
+++ b/debian/bin/gencontrol.py
@@ -78,6 +78,9 @@ class Gencontrol(Base):
'# Translators should edit %s instead.\n'
'#\n' % path)
+ # Prepare to generate debian/tests/control
+ self.tests_control = None
+
def do_main_makefile(self, makefile, makeflags, extra):
fs_enabled = [featureset
for featureset in self.config['base', ]['featuresets']
@@ -329,7 +332,8 @@ class Gencontrol(Base):
vars.setdefault('desc', None)
- packages_own.append(self.process_real_image(image[0], image_fields, vars))
+ image_main = self.process_real_image(image[0], image_fields, vars)
+ packages_own.append(image_main)
packages_own.extend(self.process_packages(image[1:], vars))
if config_entry_build.get('modules', True):
@@ -355,6 +359,16 @@ class Gencontrol(Base):
self.merge_packages(packages, packages_own + packages_dummy, arch)
+ tests_control = self.process_package(
+ self.templates['tests-control.main'][0], vars)
+ tests_control['Depends'].append(
+ PackageRelationGroup(image_main['Package'],
+ override_arches=(arch,)))
+ if self.tests_control:
+ self.tests_control['Depends'].extend(tests_control['Depends'])
+ else:
+ self.tests_control = tests_control
+
def get_config(*entry_name):
entry_real = ('image',) + entry_name
entry = self.config.get(entry_real, None)
@@ -513,11 +527,16 @@ class Gencontrol(Base):
def write(self, packages, makefile):
self.write_config()
super(Gencontrol, self).write(packages, makefile)
+ self.write_tests_control()
def write_config(self):
f = open("debian/config.defines.dump", 'wb')
self.config.dump(f)
f.close()
+ def write_tests_control(self):
+ self.write_rfc822(codecs.open("debian/tests/control", 'w', 'utf-8'),
+ [self.tests_control])
+
if __name__ == '__main__':
Gencontrol()()
diff --git a/debian/changelog b/debian/changelog
index 728f57d..7901a5d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+linux (4.2~rc6-1~exp2) UNRELEASED; urgency=medium
+
+ * tests: Add autopkgtest support
+
+ -- Ben Hutchings <ben at decadent.org.uk> Thu, 13 Aug 2015 11:49:05 +0200
+
linux (4.2~rc6-1~exp1) experimental; urgency=medium
* New upstream release candidate
diff --git a/debian/templates/tests-control.main.in b/debian/templates/tests-control.main.in
new file mode 100644
index 0000000..0cd6668
--- /dev/null
+++ b/debian/templates/tests-control.main.in
@@ -0,0 +1,3 @@
+Tests: selftests
+Restrictions: breaks-testbed, needs-root, isolation-machine
+Depends: kexec-tools
diff --git a/debian/tests/selftests b/debian/tests/selftests
new file mode 100644
index 0000000..e976f02
--- /dev/null
+++ b/debian/tests/selftests
@@ -0,0 +1,39 @@
+#!/bin/bash -eu
+
+PATH=/usr/sbin:/sbin:/usr/bin:/bin
+
+# TODO: use current ABI name and all current flavours/featuresets
+abiname=4.2.0-rc6
+localversion=(-amd64)
+steps=${#localversion[*]}
+
+case "${ADT_REBOOT_MARK:-}" in
+ "")
+ step=-1
+ ;;
+ step*)
+ step=${ADT_REBOOT_MARK#step}
+ ;;
+esac
+
+if [ "$step" -ge 0 ]; then
+ ver=$abiname${localversion[$step]}
+
+ if [ "$(uname -r)" != "$ver" ]; then
+ echo >&2 "Should be running: $ver"
+ echo >&2 "Actually running: $(uname -r)"
+ fi
+fi
+
+# TODO: build and run tests
+
+step=$((step + 1))
+
+if [ "$step" -lt "$steps" ]; then
+ # Load the next kernel
+ ver=$abiname${localversion[$step]}
+ kexec -l /boot/vmlinuz-$ver --initrd /boot/initrd.img-$ver --reuse-cmdline
+ /tmp/autopkgtest-reboot step$step
+fi
+
+exit 0
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git
More information about the Kernel-svn-changes
mailing list