~straemer/ubuntu/quantal/update-manager/fix-for-1058070

« back to all changes in this revision

Viewing changes to DistUpgrade/base-installer/kernel/tests/dotest

  • Committer: Package Import Robot
  • Author(s): Michael Terry
  • Date: 2012-06-29 10:59:30 UTC
  • mfrom: (389.1.2 precise-security)
  • Revision ID: package-import@ubuntu.com-20120629105930-0oaj9vdvykmvkjum
Tags: 1:0.165
* Implementation of "update on start" feature from spec
  https://wiki.ubuntu.com/SoftwareUpdates
* Use a single main window that changes instead of having modal dialogs
* Implement several special-purpose dialogs like "No updates" or
  "Dist upgrade needed" accordingn to the above spec
* Split out release upgrader code and DistUpgrade module into a separate
  source package
* Drop python-update-manager, as it is unused
* debian/tests:
  - Add dep8 tests

Show diffs side-by-side

added added

removed removed

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