File: bootcdmk2diskconf.tst1

package info (click to toggle)
bootcd 6.9.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 520 kB
  • sloc: sh: 1,940; makefile: 49
file content (174 lines) | stat: -rwxr-xr-x 5,927 bytes parent folder | download | duplicates (2)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/sh
#        file: /usr/share/doc/bootcd/examples/bootcdmk2diskconf.tst1
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2001-2020)
#     license: GNU General Public License, version 3
# description: bootcdmk2diskconf.tst1 - functions to test bootcdmk2diskconf

VERBOSE="" # VERBOSE="" means silent; VERBOSE="1" means verbose
if [ "$1" = "-v" ];then
  VERBOSE="1"
  shift
fi
if [ $# -ge 1 ]; then
  echo "Usage $(basename $0) [-v]" >&2
  exit 1
fi

EXPECTED="$(mktemp --suffix=.bootcd.expected)"
RESULT="$(mktemp --suffix=.bootcd.result)"
[ ! "$VERBOSE" ] || echo "EXPECTED=<$EXPECTED> RESULT=<$RESULT>"

############################
### 1. define Test Input ###
############################

export RIFSTAB="# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/                 /                       ext3    defaults        1 1
/dev/devpts             /dev/pts                devpts  gid=5,mode=620  0 0
/dev/shm                /dev/shm                tmpfs   defaults        0 0
LABEL=/home             /home                   ext3    defaults        1 2
/dev/proc               /proc                   proc    defaults        0 0
/dev/sys                /sys                    sysfs   defaults        0 0
/dev/hda3               swap                    swap    defaults        0 0
/dev/hdc                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0"
export RIGRUB="# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /, eg.
#          root (hd0,1)
#          kernel /boot/vmlinuz-version ro root=/dev/hda2
#          initrd /boot/initrd-version.img
#boot=/dev/hda
default=0
timeout=5
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.9)
        root (hd0,1)
        kernel /boot/vmlinuz-2.6.9 ro root=LABEL=/ resume2=/dev/hda3
        initrd /boot/initrd-2.6.9.img
title Fedora Core (2.6.9 NoResume)
        root (hd0,1)
        kernel /boot/vmlinuz-2.6.9 ro root=LABEL=/ noresume2
        initrd /boot/initrd-2.6.9.img
title Fedora Core (2.6.17-1.2142_1.rhfc4.cubbi_swsusp2)
        root (hd0,1)
        kernel /boot/vmlinuz-2.6.17-1.2142_1.rhfc4.cubbi_swsusp2 ro root=LABEL=/ resume2=swap:/dev/sda3 libata.atapi_enabled=1 combined_mode=libata
        initrd /boot/initrd-2.6.17-1.2142_1.rhfc4.cubbi_swsusp2.img
title Fedora Core (2.6.17-1.2142_1.rhfc4.cubbi_swsusp2 NoResume)
        root (hd0,1)
        kernel /boot/vmlinuz-2.6.17-1.2142_1.rhfc4.cubbi_swsusp2 ro root=LABEL=/ noresume2
        initrd /boot/initrd-2.6.17-1.2142_1.rhfc4.cubbi_swsusp2.img
title Windows XP
        rootnoverify (hd0,0)
        chainloader +1
"
export RIGRUB2=""
export RILV=""
export RIPV=""
export RIDF="/dev/hda2:14529
/dev/hda5:22816"
export RILABEL="/dev/hda2:/
/dev/hda5:/home"
export RIUUID=""
export RIPARTITION="/dev/hda:57231
/dev/hda1:18026
/dev/hda2:14998
/dev/hda3:1027
/dev/hda4:0
/dev/hda5:23179"
export RIMD=""

#################################
### 2. define expected Output ###
#################################

cat <<'END' >$EXPECTED
ORIG_DISK0="/dev/hda"
DISK0="auto"
LVMGRP=""
LVMVOL=""
ALLOWEDDISKS=""
SFDISK0=",18026
,14998
,1027
,,E
;"
VFAT=""
EXT2FS=""
EXT3FS="DISK0P2
DISK0P5"
EXT4FS=""
XFS=""
SWAP="DISK0P3"
bootcd_mount()
{
  bootcd_global DISK0P2 DISK0P5
  mkdir -p $1; mount $DISK0P2 $1
  mkdir -p $1/home; mount $DISK0P5 $1/home
}
bootcd_umount()
{
  umount $1/home
  umount $1
}
FSTAB="# This file is edited by fstab-sync - see 'man fstab-sync' for details
LABEL=/                 /                       ext3    defaults        1 1
/dev/devpts             /dev/pts                devpts  gid=5,mode=620  0 0
/dev/shm                /dev/shm                tmpfs   defaults        0 0
LABEL=/home             /home                   ext3    defaults        1 2
/dev/proc               /proc                   proc    defaults        0 0
/dev/sys                /sys                    sysfs   defaults        0 0
DISK0P3               swap                    swap    defaults        0 0
/dev/hdc                /media/cdrecorder       auto    pamconsole,exec,noauto,managed 0 0"
ORIG_GRUB2=""
GRUB="# grub.conf generated by anaconda
default=0
timeout=5
splashimage=(hd0,1)/boot/grub/splash.xpm.gz
hiddenmenu
title Fedora Core (2.6.9)
        root (hd0,1)
        kernel /boot/vmlinuz-2.6.9 ro root=LABEL=/ resume2=DISK0P3
        initrd /boot/initrd-2.6.9.img
title Fedora Core (2.6.9 NoResume)
        root (hd0,1)
        kernel /boot/vmlinuz-2.6.9 ro root=LABEL=/ noresume2
        initrd /boot/initrd-2.6.9.img
title Fedora Core (2.6.17-1.2142_1.rhfc4.cubbi_swsusp2)
        root (hd0,1)
        kernel /boot/vmlinuz-2.6.17-1.2142_1.rhfc4.cubbi_swsusp2 ro root=LABEL=/ resume2=swap:/dev/sda3 libata.atapi_enabled=1 combined_mode=libata
        initrd /boot/initrd-2.6.17-1.2142_1.rhfc4.cubbi_swsusp2.img
title Fedora Core (2.6.17-1.2142_1.rhfc4.cubbi_swsusp2 NoResume)
        root (hd0,1)
        kernel /boot/vmlinuz-2.6.17-1.2142_1.rhfc4.cubbi_swsusp2 ro root=LABEL=/ noresume2
        initrd /boot/initrd-2.6.17-1.2142_1.rhfc4.cubbi_swsusp2.img
title Windows XP
        rootnoverify (hd0,0)
        chainloader +1"
GRUBDEVICEMAP="auto"
SSHHOSTKEY="no"
UDEV_FIXNET="no"
PARTITIONLABEL="DISK0P2:/
DISK0P5:/home"
END

################################
### 3. Run bootcdmk2diskconf ###
################################

ia_logfile=/dev/null ./bootcdmk2diskconf --testdata | grep -v "^#" |
grep -v "^libfakeroot internal error: payload not recognized!$" > $RESULT
[ "$VERBOSE" ] && cat "$RESULT"

########################
### 4. Check Results ###
########################

DIFF="$(diff $EXPECTED $RESULT)"
if [ "$DIFF" ]; then
  echo "==== ERROR $(basename $0): diff $EXPECTED $RESULT ===="
  echo "$DIFF"
fi
rm $EXPECTED $RESULT