]>
Commit | Line | Data |
---|---|---|
9ecbe2e4 | 1 | #!/bin/bash |
967cc19a | 2 | |
9ecbe2e4 DD |
3 | TEST_DESCRIPTION="root filesystem on NBD" |
4 | ||
5 | KVERSION=${KVERSION-$(uname -r)} | |
6 | ||
7 | # Uncomment this to debug failures | |
06853123 | 8 | #DEBUGFAIL="rd.shell rd.break" |
51b28ba9 HH |
9 | #SERIAL="udp:127.0.0.1:9999" |
10 | SERIAL="null" | |
9ecbe2e4 DD |
11 | |
12 | run_server() { | |
13 | # Start server first | |
b2c5f5dc | 14 | echo "NBD TEST SETUP: Starting DHCP/NBD server" |
9ecbe2e4 | 15 | |
0be1785a | 16 | $testdir/run-qemu \ |
4358ace4 HH |
17 | -drive format=raw,index=0,media=disk,file=$TESTDIR/server.ext2 \ |
18 | -drive format=raw,index=1,media=disk,file=$TESTDIR/nbd.ext2 \ | |
19 | -drive format=raw,index=2,media=disk,file=$TESTDIR/encrypted.ext2 \ | |
44f870be HH |
20 | -m 256M -smp 2 \ |
21 | -display none \ | |
83691c41 HH |
22 | -net nic,macaddr=52:54:00:12:34:56,model=e1000 \ |
23 | -net socket,listen=127.0.0.1:12340 \ | |
24 | -serial $SERIAL \ | |
83691c41 HH |
25 | -append "root=/dev/sda rootfstype=ext2 rw quiet console=ttyS0,115200n81 selinux=0" \ |
26 | -initrd $TESTDIR/initramfs.server -pidfile $TESTDIR/server.pid -daemonize || return 1 | |
0be1785a | 27 | sudo chmod 644 $TESTDIR/server.pid || return 1 |
9ecbe2e4 DD |
28 | |
29 | # Cleanup the terminal if we have one | |
30 | tty -s && stty sane | |
31 | ||
32 | echo Sleeping 10 seconds to give the server a head start | |
33 | sleep 10 | |
34 | } | |
35 | ||
36 | client_test() { | |
37 | local test_name="$1" | |
38 | local mac=$2 | |
39 | local cmdline="$3" | |
a29f15a5 DD |
40 | local fstype=$4 |
41 | local fsopt=$5 | |
42 | local found opts nbdinfo | |
43 | ||
44 | [[ $fstype ]] || fstype=ext3 | |
75e8f476 | 45 | [[ $fsopt ]] || fsopt="ro" |
9ecbe2e4 DD |
46 | |
47 | echo "CLIENT TEST START: $test_name" | |
48 | ||
49 | # Clear out the flags for each test | |
0be1785a | 50 | if ! dd if=/dev/zero of=$TESTDIR/flag.img bs=1M count=1; then |
83691c41 HH |
51 | echo "Unable to make client sda image" 1>&2 |
52 | return 1 | |
9ecbe2e4 | 53 | fi |
83691c41 | 54 | |
0be1785a | 55 | $testdir/run-qemu \ |
4358ace4 | 56 | -drive format=raw,index=0,media=disk,file=$TESTDIR/flag.img \ |
bb278147 | 57 | -m 512M -smp 2 \ |
83691c41 HH |
58 | -nographic \ |
59 | -net nic,macaddr=$mac,model=e1000 \ | |
60 | -net socket,connect=127.0.0.1:12340 \ | |
83691c41 HH |
61 | -append "$cmdline $DEBUGFAIL rd.auto rd.info rd.retry=10 ro console=ttyS0,115200n81 selinux=0 " \ |
62 | -initrd $TESTDIR/initramfs.testing | |
9ecbe2e4 | 63 | |
021b2fdd | 64 | if [[ $? -ne 0 ]] || ! grep -F -m 1 -q nbd-OK $TESTDIR/flag.img; then |
83691c41 HH |
65 | echo "CLIENT TEST END: $test_name [FAILED - BAD EXIT]" |
66 | return 1 | |
9ecbe2e4 DD |
67 | fi |
68 | ||
a29f15a5 | 69 | # nbdinfo=( fstype fsoptions ) |
0be1785a | 70 | nbdinfo=($(awk '{print $2, $3; exit}' $TESTDIR/flag.img)) |
a29f15a5 DD |
71 | |
72 | if [[ "${nbdinfo[0]}" != "$fstype" ]]; then | |
83691c41 HH |
73 | echo "CLIENT TEST END: $test_name [FAILED - WRONG FS TYPE] \"${nbdinfo[0]}\" != \"$fstype\"" |
74 | return 1 | |
a29f15a5 DD |
75 | fi |
76 | ||
77 | opts=${nbdinfo[1]}, | |
78 | while [[ $opts ]]; do | |
83691c41 HH |
79 | if [[ ${opts%%,*} = $fsopt ]]; then |
80 | found=1 | |
81 | break | |
82 | fi | |
83 | opts=${opts#*,} | |
a29f15a5 DD |
84 | done |
85 | ||
86 | if [[ ! $found ]]; then | |
83691c41 HH |
87 | echo "CLIENT TEST END: $test_name [FAILED - BAD FS OPTS] \"${nbdinfo[1]}\" != \"$fsopt\"" |
88 | return 1 | |
a29f15a5 DD |
89 | fi |
90 | ||
9ecbe2e4 DD |
91 | echo "CLIENT TEST END: $test_name [OK]" |
92 | } | |
93 | ||
94 | test_run() { | |
ebcfda6c | 95 | modinfo nbd &>/dev/null || { echo "Kernel does not support nbd"; exit 1; } |
9ecbe2e4 | 96 | if ! run_server; then |
83691c41 HH |
97 | echo "Failed to start server" 1>&2 |
98 | return 1 | |
9ecbe2e4 | 99 | fi |
57aa1e91 HH |
100 | client_run |
101 | kill_server | |
97add1b3 HH |
102 | } |
103 | ||
104 | client_run() { | |
a29f15a5 DD |
105 | # The default is ext3,errors=continue so use that to determine |
106 | # if our options were parsed and used | |
83691c41 HH |
107 | client_test "NBD root=nbd:IP:port::fsopts" 52:54:00:12:34:00 \ |
108 | "root=nbd:192.168.50.1:2000::errors=panic rd.luks=0" \ | |
109 | ext3 errors=panic || return 1 | |
110 | ||
bcf94bba | 111 | client_test "NBD root=nbd:IP:port" 52:54:00:12:34:00 \ |
83691c41 | 112 | "root=nbd:192.168.50.1:2000 rd.luks=0" || return 1 |
9ecbe2e4 | 113 | |
bcf94bba | 114 | client_test "NBD root=nbd:IP:port:fstype" 52:54:00:12:34:00 \ |
83691c41 | 115 | "root=nbd:192.168.50.1:2000:ext2 rd.luks=0" ext2 || return 1 |
a29f15a5 | 116 | |
bcf94bba | 117 | client_test "NBD root=nbd:IP:port:fstype:fsopts" 52:54:00:12:34:00 \ |
83691c41 HH |
118 | "root=nbd:192.168.50.1:2000:ext2:errors=panic rd.luks=0" \ |
119 | ext2 errors=panic || return 1 | |
a29f15a5 | 120 | |
bcf94bba | 121 | client_test "NBD Bridge root=nbd:IP:port:fstype:fsopts" 52:54:00:12:34:00 \ |
83691c41 HH |
122 | "root=nbd:192.168.50.1:2000:ext2:errors=panic bridge rd.luks=0" \ |
123 | ext2 errors=panic || return 1 | |
beb097d9 | 124 | |
50e7ff76 PS |
125 | # There doesn't seem to be a good way to validate the NBD options, so |
126 | # just check that we don't screw up the other options | |
a29f15a5 | 127 | |
bcf94bba | 128 | client_test "NBD root=nbd:IP:port:::NBD opts" 52:54:00:12:34:00 \ |
83691c41 | 129 | "root=nbd:192.168.50.1:2000:::bs=2048 rd.luks=0" || return 1 |
a29f15a5 | 130 | |
bcf94bba | 131 | client_test "NBD root=nbd:IP:port:fstype::NBD opts" 52:54:00:12:34:00 \ |
83691c41 | 132 | "root=nbd:192.168.50.1:2000:ext2::bs=2048 rd.luks=0" ext2 || return 1 |
a29f15a5 | 133 | |
bcf94bba | 134 | client_test "NBD root=nbd:IP:port:fstype:fsopts:NBD opts" \ |
83691c41 HH |
135 | 52:54:00:12:34:00 \ |
136 | "root=nbd:192.168.50.1:2000:ext2:errors=panic:bs=2048 rd.luks=0" \ | |
137 | ext2 errors=panic || return 1 | |
a29f15a5 | 138 | |
a29f15a5 DD |
139 | # DHCP root-path parsing |
140 | ||
9ecbe2e4 | 141 | client_test "NBD root=dhcp DHCP root-path nbd:srv:port" 52:54:00:12:34:01 \ |
83691c41 | 142 | "root=dhcp rd.luks=0" || return 1 |
a29f15a5 | 143 | |
beb097d9 | 144 | client_test "NBD Bridge root=dhcp DHCP root-path nbd:srv:port" 52:54:00:12:34:01 \ |
83691c41 | 145 | "root=dhcp bridge rd.luks=0" || return 1 |
beb097d9 | 146 | |
a29f15a5 | 147 | client_test "NBD root=dhcp DHCP root-path nbd:srv:port:fstype" \ |
83691c41 | 148 | 52:54:00:12:34:02 "root=dhcp rd.luks=0" ext2 || return 1 |
a29f15a5 DD |
149 | |
150 | client_test "NBD root=dhcp DHCP root-path nbd:srv:port::fsopts" \ | |
83691c41 | 151 | 52:54:00:12:34:03 "root=dhcp rd.luks=0" ext3 errors=panic || return 1 |
a29f15a5 DD |
152 | |
153 | client_test "NBD root=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \ | |
83691c41 | 154 | 52:54:00:12:34:04 "root=dhcp rd.luks=0" ext2 errors=panic || return 1 |
aec48753 DD |
155 | |
156 | # netroot handling | |
157 | ||
158 | client_test "NBD netroot=nbd:IP:port" 52:54:00:12:34:00 \ | |
83691c41 | 159 | "netroot=nbd:192.168.50.1:2000 rd.luks=0" || return 1 |
aec48753 DD |
160 | |
161 | client_test "NBD netroot=dhcp DHCP root-path nbd:srv:port:fstype:fsopts" \ | |
83691c41 | 162 | 52:54:00:12:34:04 "netroot=dhcp rd.luks=0" ext2 errors=panic || return 1 |
8bd5873f DD |
163 | |
164 | # Encrypted root handling via LVM/LUKS over NBD | |
165 | ||
83691c41 HH |
166 | . $TESTDIR/luks.uuid |
167 | ||
bb278147 | 168 | client_test "NBD root=LABEL=dracut netroot=nbd:IP:port" \ |
83691c41 | 169 | 52:54:00:12:34:00 \ |
bb278147 | 170 | "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=nbd:192.168.50.1:2001" || return 1 |
8bd5873f DD |
171 | |
172 | # XXX This should be ext2,errors=panic but that doesn't currently | |
173 | # XXX work when you have a real root= line in addition to netroot= | |
174 | # XXX How we should work here needs clarification | |
bb278147 | 175 | client_test "NBD root=LABEL=dracut netroot=dhcp (w/ fstype and opts)" \ |
83691c41 | 176 | 52:54:00:12:34:05 \ |
bb278147 | 177 | "root=LABEL=dracut rd.luks.uuid=$ID_FS_UUID rd.lv.vg=dracut netroot=dhcp" || return 1 |
9ca74ffe HH |
178 | |
179 | if [[ -s server.pid ]]; then | |
83691c41 | 180 | sudo kill -TERM $(cat $TESTDIR/server.pid) |
32bd2fbb | 181 | rm -f -- $TESTDIR/server.pid |
9ca74ffe HH |
182 | fi |
183 | ||
8bd5873f DD |
184 | } |
185 | ||
186 | make_encrypted_root() { | |
187 | # Create the blank file to use as a root filesystem | |
0be1785a HH |
188 | dd if=/dev/null of=$TESTDIR/encrypted.ext2 bs=1M seek=20 |
189 | dd if=/dev/null of=$TESTDIR/flag.img bs=1M seek=1 | |
8bd5873f DD |
190 | |
191 | kernel=$KVERSION | |
192 | # Create what will eventually be our root filesystem onto an overlay | |
193 | ( | |
83691c41 | 194 | export initdir=$TESTDIR/overlay/source |
777f2db0 | 195 | . $basedir/dracut-init.sh |
28f0b27f | 196 | mkdir -p "$initdir" |
06853123 HH |
197 | ( |
198 | cd "$initdir"; mkdir -p dev sys proc etc var/run tmp | |
199 | mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin | |
200 | for i in bin sbin lib lib64; do | |
201 | ln -sfnr usr/$i $i | |
202 | done | |
203 | ) | |
af119460 | 204 | inst_multiple sh df free ls shutdown poweroff stty cat ps ln ip \ |
83691c41 | 205 | mount dmesg mkdir cp ping |
96d22bd7 | 206 | for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do |
83691c41 HH |
207 | [ -f ${_terminfodir}/l/linux ] && break |
208 | done | |
af119460 | 209 | inst_multiple -o ${_terminfodir}/l/linux |
83691c41 | 210 | inst ./client-init.sh /sbin/init |
021b2fdd | 211 | inst_simple /etc/os-release |
af119460 | 212 | find_binary plymouth >/dev/null && inst_multiple plymouth |
83691c41 HH |
213 | cp -a /etc/ld.so.conf* $initdir/etc |
214 | sudo ldconfig -r "$initdir" | |
8bd5873f DD |
215 | ) |
216 | ||
217 | # second, install the files needed to make the root filesystem | |
218 | ( | |
83691c41 | 219 | export initdir=$TESTDIR/overlay |
777f2db0 | 220 | . $basedir/dracut-init.sh |
06853123 HH |
221 | ( |
222 | cd "$initdir"; mkdir -p dev sys proc etc var/run tmp | |
223 | mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin | |
224 | for i in bin sbin lib lib64; do | |
225 | ln -sfnr usr/$i $i | |
226 | done | |
227 | ) | |
af119460 | 228 | inst_multiple mke2fs poweroff cp umount tune2fs |
bb278147 | 229 | inst_hook emergency 000 ./hard-off.sh |
83691c41 | 230 | inst_hook initqueue 01 ./create-root.sh |
356333b3 | 231 | inst_hook initqueue/finished 01 ./finished-false.sh |
83691c41 | 232 | inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules |
8bd5873f DD |
233 | ) |
234 | ||
235 | # create an initramfs that will create the target root filesystem. | |
236 | # We do it this way so that we do not risk trashing the host mdraid | |
237 | # devices, volume groups, encrypted partitions, etc. | |
552ecca6 | 238 | $basedir/dracut.sh -l -i $TESTDIR/overlay / \ |
eda73c0a | 239 | -m "dash crypt lvm mdraid udev-rules base rootfs-block fs-lib kernel-modules" \ |
83691c41 | 240 | -d "piix ide-gd_mod ata_piix ext2 ext3 sd_mod" \ |
e3e1f406 | 241 | --no-hostonly-cmdline -N \ |
83691c41 | 242 | -f $TESTDIR/initramfs.makeroot $KVERSION || return 1 |
32bd2fbb | 243 | rm -rf -- $TESTDIR/overlay |
8bd5873f DD |
244 | |
245 | # Invoke KVM and/or QEMU to actually create the target filesystem. | |
0be1785a | 246 | $testdir/run-qemu \ |
4358ace4 HH |
247 | -drive format=raw,index=0,media=disk,file=$TESTDIR/flag.img \ |
248 | -drive format=raw,index=1,media=disk,file=$TESTDIR/encrypted.ext2 \ | |
bb278147 | 249 | -m 256M -smp 2\ |
83691c41 | 250 | -nographic -net none \ |
bb278147 | 251 | -append "root=/dev/fakeroot rw quiet console=ttyS0,115200n81 selinux=0" \ |
83691c41 | 252 | -initrd $TESTDIR/initramfs.makeroot || return 1 |
021b2fdd HH |
253 | grep -F -m 1 -q dracut-root-block-created $TESTDIR/flag.img || return 1 |
254 | grep -F -a -m 1 ID_FS_UUID $TESTDIR/flag.img > $TESTDIR/luks.uuid | |
9ecbe2e4 DD |
255 | } |
256 | ||
257 | make_client_root() { | |
0be1785a HH |
258 | dd if=/dev/null of=$TESTDIR/nbd.ext2 bs=1M seek=30 |
259 | mke2fs -F -j $TESTDIR/nbd.ext2 | |
260 | mkdir $TESTDIR/mnt | |
261 | sudo mount -o loop $TESTDIR/nbd.ext2 $TESTDIR/mnt | |
9ecbe2e4 DD |
262 | |
263 | kernel=$KVERSION | |
264 | ( | |
83691c41 | 265 | export initdir=$TESTDIR/mnt |
777f2db0 | 266 | . $basedir/dracut-init.sh |
28f0b27f | 267 | mkdir -p "$initdir" |
06853123 HH |
268 | ( |
269 | cd "$initdir"; mkdir -p dev sys proc etc var/run tmp | |
270 | mkdir -p root usr/bin usr/lib usr/lib64 usr/sbin | |
271 | for i in bin sbin lib lib64; do | |
272 | ln -sfnr usr/$i $i | |
273 | done | |
274 | ) | |
af119460 | 275 | inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ |
83691c41 | 276 | dmesg mkdir cp ping |
96d22bd7 | 277 | for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do |
83691c41 HH |
278 | [ -f ${_terminfodir}/l/linux ] && break |
279 | done | |
af119460 | 280 | inst_multiple -o ${_terminfodir}/l/linux |
83691c41 | 281 | inst ./client-init.sh /sbin/init |
021b2fdd | 282 | inst_simple /etc/os-release |
83691c41 HH |
283 | inst /etc/nsswitch.conf /etc/nsswitch.conf |
284 | inst /etc/passwd /etc/passwd | |
285 | inst /etc/group /etc/group | |
286 | for i in /usr/lib*/libnss_files* /lib*/libnss_files*;do | |
28f0b27f | 287 | [ -e "$i" ] || continue |
83691c41 HH |
288 | inst $i |
289 | done | |
290 | cp -a /etc/ld.so.conf* $initdir/etc | |
291 | sudo ldconfig -r "$initdir" | |
9ecbe2e4 DD |
292 | ) |
293 | ||
0be1785a | 294 | sudo umount $TESTDIR/mnt |
32bd2fbb | 295 | rm -fr -- $TESTDIR/mnt |
9ecbe2e4 DD |
296 | } |
297 | ||
298 | make_server_root() { | |
0be1785a HH |
299 | dd if=/dev/null of=$TESTDIR/server.ext2 bs=1M seek=30 |
300 | mke2fs -F $TESTDIR/server.ext2 | |
301 | mkdir $TESTDIR/mnt | |
302 | sudo mount -o loop $TESTDIR/server.ext2 $TESTDIR/mnt | |
9ecbe2e4 DD |
303 | |
304 | kernel=$KVERSION | |
305 | ( | |
83691c41 | 306 | export initdir=$TESTDIR/mnt |
777f2db0 | 307 | . $basedir/dracut-init.sh |
28f0b27f | 308 | mkdir -p "$initdir" |
83691c41 HH |
309 | ( |
310 | cd "$initdir"; | |
311 | mkdir -p dev sys proc etc var/run var/lib/dhcpd tmp | |
312 | ) | |
af119460 | 313 | inst_multiple sh ls shutdown poweroff stty cat ps ln ip \ |
83691c41 HH |
314 | dmesg mkdir cp ping grep \ |
315 | sleep nbd-server chmod | |
96d22bd7 | 316 | for _terminfodir in /lib/terminfo /etc/terminfo /usr/share/terminfo; do |
83691c41 HH |
317 | [ -f ${_terminfodir}/l/linux ] && break |
318 | done | |
af119460 | 319 | inst_multiple -o ${_terminfodir}/l/linux |
83691c41 | 320 | instmods af_packet |
af119460 | 321 | type -P dhcpd >/dev/null && inst_multiple dhcpd |
83691c41 HH |
322 | [ -x /usr/sbin/dhcpd3 ] && inst /usr/sbin/dhcpd3 /usr/sbin/dhcpd |
323 | inst ./server-init.sh /sbin/init | |
021b2fdd | 324 | inst_simple /etc/os-release |
83691c41 HH |
325 | inst ./hosts /etc/hosts |
326 | inst ./dhcpd.conf /etc/dhcpd.conf | |
327 | inst /etc/nsswitch.conf /etc/nsswitch.conf | |
328 | inst /etc/passwd /etc/passwd | |
329 | inst /etc/group /etc/group | |
330 | for i in /usr/lib*/libnss_files* /lib*/libnss_files*;do | |
28f0b27f | 331 | [ -e "$i" ] || continue |
83691c41 HH |
332 | inst $i |
333 | done | |
9ecbe2e4 | 334 | |
83691c41 HH |
335 | cp -a /etc/ld.so.conf* $initdir/etc |
336 | sudo ldconfig -r "$initdir" | |
9ecbe2e4 DD |
337 | ) |
338 | ||
0be1785a | 339 | sudo umount $TESTDIR/mnt |
32bd2fbb | 340 | rm -fr -- $TESTDIR/mnt |
9ecbe2e4 DD |
341 | } |
342 | ||
343 | test_setup() { | |
ebcfda6c HH |
344 | |
345 | modinfo nbd &>/dev/null || { echo "Kernel does not support nbd"; exit 1; } | |
346 | ||
8bd5873f | 347 | make_encrypted_root || return 1 |
9ecbe2e4 DD |
348 | make_client_root || return 1 |
349 | make_server_root || return 1 | |
350 | ||
351 | # Make the test image | |
352 | ( | |
83691c41 | 353 | export initdir=$TESTDIR/overlay |
777f2db0 | 354 | . $basedir/dracut-init.sh |
af119460 | 355 | inst_multiple poweroff shutdown |
83691c41 HH |
356 | inst_hook emergency 000 ./hard-off.sh |
357 | inst_simple ./99-idesymlinks.rules /etc/udev/rules.d/99-idesymlinks.rules | |
3f7e5358 | 358 | inst ./cryptroot-ask.sh /sbin/cryptroot-ask |
83691c41 HH |
359 | |
360 | # inst ./debug-shell.service /lib/systemd/system/debug-shell.service | |
361 | # mkdir -p "${initdir}/lib/systemd/system/sysinit.target.wants" | |
362 | # ln -fs ../debug-shell.service "${initdir}/lib/systemd/system/sysinit.target.wants/debug-shell.service" | |
363 | ||
3f7e5358 HH |
364 | . $TESTDIR/luks.uuid |
365 | mkdir -p $initdir/etc | |
83691c41 | 366 | echo "luks-$ID_FS_UUID /dev/nbd0 /etc/key" > $initdir/etc/crypttab |
3f7e5358 | 367 | echo -n test > $initdir/etc/key |
9ecbe2e4 DD |
368 | ) |
369 | ||
552ecca6 | 370 | sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \ |
eda73c0a | 371 | -m "dash udev-rules rootfs-block fs-lib base debug kernel-modules" \ |
83691c41 | 372 | -d "af_packet piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000" \ |
e3e1f406 | 373 | --no-hostonly-cmdline -N \ |
83691c41 | 374 | -f $TESTDIR/initramfs.server $KVERSION || return 1 |
9ecbe2e4 | 375 | |
552ecca6 | 376 | sudo $basedir/dracut.sh -l -i $TESTDIR/overlay / \ |
83691c41 HH |
377 | -o "plymouth" \ |
378 | -a "debug watchdog" \ | |
56fb5c4d | 379 | -d "af_packet piix ide-gd_mod ata_piix ext2 ext3 sd_mod e1000 i6300esb ib700wdt" \ |
e3e1f406 | 380 | --no-hostonly-cmdline -N \ |
83691c41 | 381 | -f $TESTDIR/initramfs.testing $KVERSION || return 1 |
9ecbe2e4 DD |
382 | } |
383 | ||
97add1b3 | 384 | kill_server() { |
0be1785a | 385 | if [[ -s $TESTDIR/server.pid ]]; then |
83691c41 | 386 | sudo kill -TERM $(cat $TESTDIR/server.pid) |
32bd2fbb | 387 | rm -f -- $TESTDIR/server.pid |
9ecbe2e4 | 388 | fi |
97add1b3 HH |
389 | } |
390 | ||
391 | test_cleanup() { | |
392 | kill_server | |
9ecbe2e4 DD |
393 | } |
394 | ||
395 | . $testdir/test-functions |