From: Ian Jackson Date: Tue, 3 Apr 2007 16:41:20 +0000 (+0100) Subject: * Default kernel image guesser is more sophisticated - now we look X-Git-Tag: converted-from-bzr~32^3~14 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=c0a09a0a656f48da969971aae6e79d3449b07edd;p=autopkgtest.git * Default kernel image guesser is more sophisticated - now we look for something that looks like a Xen kernel rather than guessing from the filename since the filenames seem unstable. --- diff --git a/debian/changelog b/debian/changelog index b7b0807..eb8aefa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,8 +8,11 @@ autopkgtest (0.7.2~~iwj) unstable; urgency=low * new `timeout=' option on `execute' virt server command. * set some default timeouts (these should be settable with options, really). + * Default kernel image guesser is more sophisticated - now we look + for something that looks like a Xen kernel rather than guessing + from the filename since the filenames seem unstable. - -- Ian Jackson Fri, 23 Mar 2007 16:58:42 +0000 + -- autopkgtest (0.7.2) feisty; urgency=low diff --git a/xen/README b/xen/README index ed13712..cd11f06 100644 --- a/xen/README +++ b/xen/README @@ -121,10 +121,10 @@ adt_fw_hook with _config replaced with _fwhook ---------- Items that are likely to need attention ---------- -adt_kernel the booted kernel file /boot/xen*`uname -r` +adt_kernel Xen kernel matching /boot/xen*`uname -r` Kernel to boot in the testbed image -adt_ramdisk .initrd.img +adt_ramdisk initrd.img-* where is vmlinuz-* Initial ramdisk to provide to the testbid image. "none" means do not provide an initial ramdisk. diff --git a/xen/readconfig.in b/xen/readconfig.in index 15c58b9..b958293 100644 --- a/xen/readconfig.in +++ b/xen/readconfig.in @@ -103,26 +103,53 @@ case "$adt_lvm_vg" in ;; esac -case "$adt_kernel" in -'') +if [ "$adt_readconfig_needkernel" ]; then + case "$adt_kernel" in + '') printf "searching for kernel ... " - for f in /boot/xen*"`uname -r`"; do + for f in /boot/*"`uname -r`"*; do test -e "$f" || continue + printf "(%s:" "$f" + output="$(file -- "$f")" + case "$output" in + *"gzip compressed data"*) ;; + *) printf "!gzip) "; continue ;; + esac + trap 'rm -f -- "$tf"; exit 127' 0 + tf=`mktemp -t` + zcat -- "$f" >"$tf" + output="$(file -- "$tf")" + case "$output" in + *"ELF "*" executable,"*) ;; + *) printf "!ELF) "; continue;; + esac + output="$(objdump -j __xen_guest -s -- "$tf")" + rm -f "$tf"; trap '' 0 + case "$output" in + *" __xen_guest:"*) ;; + *) printf "!Xen) "; continue + esac + printf "y) " test "x$adt_kernel" = x || \ fail 'several kernels, config must specify which' adt_kernel="$f" done + [ "x$adt_kernel" != x ] || \ + fail 'could not find currently booted Xen kernel' echo "using currently booted kernel: $adt_kernel" ;; -esac + esac -case "$adt_ramdisk" in -none) echo "ramdisk \`none' specified, using static kernel" + case "$adt_ramdisk" in + none) echo "ramdisk \`none' specified, using static kernel" adt_ramdisk='' ;; -'') adt_ramdisk="$adt_kernel.initrd.img" - echo "using default ramdisk .initrd.img: $adt_ramdisk" ;; -*) ;; -esac + '') adt_ramdisk="${adt_kernel/\/vmlinuz-//initrd.img-}" + test -e "$adt_ramdisk" || \ + fail "calculated default ramdisk initrd.img \`$adt_ramdisk' does not exist" + echo "using calculated default ramdisk initrd.img: $adt_ramdisk" ;; + *) ;; + esac +fi case "$adt_modules" in '') adt_modules="/lib/modules/`uname -r`" ;; diff --git a/xen/setup b/xen/setup index d617a88..6a69b64 100755 --- a/xen/setup +++ b/xen/setup @@ -1,5 +1,6 @@ #!/bin/bash set -e +adt_readconfig_needkernel=y . ${ADT_XENLVM_SHARE:=/usr/share/autopkgtest/xenlvm}/readconfig test $nonoptargs = 0 || fail "non-option arguments not allowed"