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