1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
#! /bin/sh
set -e
if [ "$TEST_VERBOSE" -ge 3 ]; then
set -x
fi
. "$(dirname "$0")/../$ARCH.sh"
ok () {
echo "PASS $testname"
}
notok () {
echo "FAIL $testname"
}
log () {
echo "$*" >&2
}
warning () {
echo "warning: $*" >&2
}
for KERNEL_MAJOR in $MAJORS; do
WANT_FLAVOUR="$FLAVOUR"
case $KERNEL_MAJOR in
2.6)
WANT_KERNELS="$KERNEL_26"
;;
7)
WANT_KERNELS="$KERNEL_7"
;;
8)
WANT_KERNELS="$KERNEL_8"
;;
esac
WANT_KERNELS="$(echo "$WANT_KERNELS" | tr '\n' ' ' | tr -s ' ' | sed 's/ *$//')"
WANT_KERNEL_STEM="${WANT_KERNELS%% *}"
WANT_KERNEL_STEM="${WANT_KERNEL_STEM#kernel-image-}"
WANT_KERNEL_STEM="${WANT_KERNEL_STEM#linux-image-}"
export KERNEL_MAJOR
export KERNEL_VERSION="$(echo "$WANT_KERNEL_STEM" | cut -d - -f 1)"
# Is the correct kernel flavour selected?
testname="arch_get_kernel_flavour $KERNEL_MAJOR exit code"
if GOT_FLAVOUR="$(arch_get_kernel_flavour)" && [ "$GOT_FLAVOUR" ] ; then
ok
else
notok
continue # nothing else will work
fi
testname="arch_get_kernel_flavour want $WANT_FLAVOUR, got $GOT_FLAVOUR"
if [ "$WANT_FLAVOUR" = "$GOT_FLAVOUR" ]; then
ok
else
notok
fi
# Are the correct kernels treated as usable?
for kernel in $USABLE; do
testname="arch_check_usable_kernel $KERNEL_MAJOR $kernel should be usable"
if arch_check_usable_kernel "$kernel" "$GOT_FLAVOUR"; then
ok
else
notok
fi
done
# By default any postfix should be allowed
for kernel in $USABLE; do
testname="arch_check_usable_kernel $KERNEL_MAJOR ${kernel}-<postfix> should be usable"
if arch_check_usable_kernel "${kernel}-postfix" "$GOT_FLAVOUR"; then
ok
else
notok
fi
done
for kernel in $UNUSABLE; do
testname="arch_check_usable_kernel $KERNEL_MAJOR $kernel should be unusable"
if arch_check_usable_kernel "$kernel" "$GOT_FLAVOUR"; then
notok
else
ok
fi
done
# Is the correct preference order of default kernels selected?
testname="arch_get_kernel $KERNEL_MAJOR exit code"
if GOT_KERNELS="$(arch_get_kernel "$GOT_FLAVOUR" | tr '\n' ' ' | sed 's/ *$//')"; then
ok
else
notok
continue # the rest won't work
fi
testname="arch_get_kernel want '$WANT_KERNELS', got '$GOT_KERNELS'"
if [ "$WANT_KERNELS" = "$GOT_KERNELS" ]; then
ok
else
notok
fi
done
|