File: bootcdmk2diskconf.tst6

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 (125 lines) | stat: -rwxr-xr-x 3,742 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
#!/bin/sh
#        file: /usr/share/doc/bootcd/examples/bootcdmk2diskconf.tst6
#   copyright: Bernd Schumacher <bernd.schumacher@hpe.com> (2001-2020)
#     license: GNU General Public License, version 3
# description: bootcdmk2diskconf.tst6 - 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="# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/sda1 during installation
UUID=bdde4b15-7e0e-43fd-af48-6ce344017237 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=de0dc81f-c3d4-42b7-961f-80f39e8d6b6c none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0"
export RIGRUB=""
export RIGRUB2="anything to long for this test, like ...
search --no-floppy --fs-uuid --set=root bdde4b15-7e0e-43fd-af48-6ce344017237
echo    'Loading Linux 3.0.0-1-amd64 ...'
linux   /boot/vmlinuz-3.0.0-1-amd64 root=UUID=bdde4b15-7e0e-43fd-af48-6ce344017237 ro  quiet
..."

export RILV=""
export RIPV=""
export RIDF="/dev/sda1:19402"
export RILABEL=""
export RIUUID="/dev/sda1:bdde4b15-7e0e-43fd-af48-6ce344017237
/dev/sda5:de0dc81f-c3d4-42b7-961f-80f39e8d6b6c"
export RIPARTITION="/dev/sda:20480
/dev/sda1:19711
/dev/sda2:0
/dev/sda5:766"
export RIMD=""

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

cat <<'END' >$EXPECTED
ORIG_DISK0="/dev/sda"
DISK0="auto"
LVMGRP=""
LVMVOL=""
ALLOWEDDISKS=""
SFDISK0="unit: sectors

2048,40368128
40370176,,E
0,0
0,0
;"
VFAT=""
EXT2FS=""
EXT3FS=""
EXT4FS="DISK0P1"
XFS=""
SWAP="DISK0P5"
bootcd_mount()
{
  bootcd_global DISK0P1
  mkdir -p $1; mount $DISK0P1 $1
}
bootcd_umount()
{
  umount $1
}
FSTAB="# /etc/fstab: static file system information.
proc            /proc           proc    defaults        0       0
UUID=UUID!DISK0P1 /               ext4    errors=remount-ro 0       1
UUID=UUID!DISK0P5 none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0"
ORIG_GRUB2="anything to long for this test, like ...
search --no-floppy --fs-uuid --set=root UUID!DISK0P1
echo    'Loading Linux 3.0.0-1-amd64 ...'
linux   /boot/vmlinuz-3.0.0-1-amd64 root=UUID=UUID!DISK0P1 ro  quiet
..."
GRUB=""
GRUBDEVICEMAP="auto"
SSHHOSTKEY="no"
UDEV_FIXNET="no"
PARTITIONLABEL=""
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