source: MondoRescue/branches/3.2/mindi-busybox/testsuite/parse.tests@ 3232

Last change on this file since 3232 was 3232, checked in by Bruno Cornec, 10 years ago
  • Update mindi-busybox to 1.21.1
  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#!/bin/sh
2
3# Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPLv2, see file LICENSE in this source tree.
5
6. ./testing.sh
7
8COLLAPSE=$(( 0x00010000))
9TRIM=$(( 0x00020000))
10GREEDY=$(( 0x00040000))
11MIN_DIE=$(( 0x00100000))
12KEEP_COPY=$((0x00200000))
13ESCAPE=$(( 0x00400000))
14NORMAL=$(( COLLAPSE | TRIM | GREEDY))
15
16# testing "description" "command" "result" "infile" "stdin"
17
18testing "parse mdev.conf" \
19 "parse -n 4 -m 3 -f $((NORMAL)) -" \
20 "[sda][0:0][644][@echo @echo TEST]\n" \
21 "-" \
22 " sda 0:0 644 @echo @echo TEST # echo trap\n"
23
24testing "parse notrim" \
25 "parse -n 4 -m 3 -f $((NORMAL - TRIM - COLLAPSE)) -" \
26 "[][sda][0:0][644 @echo @echo TEST ]\n" \
27 "-" \
28 " sda 0:0 644 @echo @echo TEST \n"
29
30FILE=__parse
31cat >$FILE <<EOF
32#
33# Device Point System Options
34#_______________________________________________________________
35/dev/hdb3 / ext2 defaults 1 0
36 /dev/hdb1 /dosc hpfs ro 1 0
37 /dev/fd0 /dosa vfat rw,user,noauto,nohide 0 0
38 /dev/fd1 /dosb vfat rw,user,noauto,nohide 0 0
39#
40 /dev/cdrom /cdrom iso9660 ro,user,noauto,nohide 0 0
41/dev/hdb5 /redhat ext2 rw,root,noauto,nohide 0 0 #sssd
42 /dev/hdb6 /win2home ntfs rw,root,noauto,nohide 0 0# ssdsd
43/dev/hdb7 /win2skul ntfs rw,root,noauto,nohide none 0 0
44none /dev/pts devpts gid=5,mode=620 0 0
45 none /proc proc defaults 0 0
46EOF
47
48cat >$FILE.res <<EOF
49[/dev/hdb3][/][ext2][defaults][1][0]
50[/dev/hdb1][/dosc][hpfs][ro][1][0]
51[/dev/fd0][/dosa][vfat][rw,user,noauto,nohide][0][0]
52[/dev/fd1][/dosb][vfat][rw,user,noauto,nohide][0][0]
53[/dev/cdrom][/cdrom][iso9660][ro,user,noauto,nohide][0][0]
54[/dev/hdb5][/redhat][ext2][rw,root,noauto,nohide][0][0]
55[/dev/hdb6][/win2home][ntfs][rw,root,noauto,nohide][0][0]
56[/dev/hdb7][/win2skul][ntfs][rw,root,noauto,nohide][none][0 0]
57[none][/dev/pts][devpts][gid=5,mode=620][0][0]
58[none][/proc][proc][defaults][0][0]
59EOF
60
61testing "parse polluted fstab" \
62 "parse -n 6 -m 6 $FILE" \
63 "`cat $FILE.res`\n" \
64 "" \
65 ""
66cp ../examples/inittab $FILE
67cat >$FILE.res <<EOF
68[][][sysinit][/etc/init.d/rcS]
69[][][askfirst][-/bin/sh]
70[tty2][][askfirst][-/bin/sh]
71[tty3][][askfirst][-/bin/sh]
72[tty4][][askfirst][-/bin/sh]
73[tty4][][respawn][/sbin/getty 38400 tty5]
74[tty5][][respawn][/sbin/getty 38400 tty6]
75[][][restart][/sbin/init]
76[][][ctrlaltdel][/sbin/reboot]
77[][][shutdown][/bin/umount -a -r]
78[][][shutdown][/sbin/swapoff -a]
79EOF
80
81testing "parse inittab from examples" \
82 "parse -n 4 -m 4 -f $((NORMAL - TRIM - COLLAPSE)) -d'#:' $FILE" \
83 "`cat $FILE.res`\n" \
84 "" \
85 ""
86
87cp ../examples/udhcp/udhcpd.conf $FILE
88cat >$FILE.res <<EOF
89[start][192.168.0.20]
90[end][192.168.0.254]
91[interface][eth0]
92[opt][dns][192.168.10.2][192.168.10.10]
93[option][subnet][255.255.255.0]
94[opt][router][192.168.10.2]
95[opt][wins][192.168.10.10]
96[option][dns][129.219.13.81]
97[option][domain][local]
98[option][lease][864000]
99[option][0x08][01020304]
100EOF
101
102testing "parse udhcpd.conf from examples" \
103 "parse -n 127 $FILE" \
104 "`cat $FILE.res`\n" \
105 "" \
106 ""
107
108rm -f $FILE $FILE.res
109
110exit $FAILCOUNT
Note: See TracBrowser for help on using the repository browser.