Magellan Linux

Contents of /trunk/mkinitrd-magellan/busybox/testsuite/parse.tests

Parent Directory Parent Directory | Revision Log Revision Log


Revision 984 - (show annotations) (download)
Sun May 30 11:32:42 2010 UTC (13 years, 11 months ago) by niro
File size: 3413 byte(s)
-updated to busybox-1.16.1 and enabled blkid/uuid support in default config
1 #!/bin/sh
2
3 # Copyright 2008 by Denys Vlasenko <vda.linux@googlemail.com>
4 # Licensed under GPL v2, see file LICENSE for details.
5
6 . ./testing.sh
7
8 COLLAPSE=$(( 0x00010000))
9 TRIM=$(( 0x00020000))
10 GREEDY=$(( 0x00040000))
11 MIN_DIE=$(( 0x00100000))
12 KEEP_COPY=$((0x00200000))
13 ESCAPE=$(( 0x00400000))
14 NORMAL=$(( COLLAPSE | TRIM | GREEDY))
15
16 # testing "description" "command" "result" "infile" "stdin"
17
18 testing "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
24 testing "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
30 FILE=__parse
31 cat >$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
44 none /dev/pts devpts gid=5,mode=620 0 0
45 none /proc proc defaults 0 0
46 EOF
47
48 cat >$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]
59 EOF
60
61 testing "parse polluted fstab" \
62 "parse -n 6 -m 6 $FILE" \
63 "`cat $FILE.res`\n" \
64 "" \
65 ""
66 cp ../examples/inittab $FILE
67 cat >$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]
79 EOF
80
81 testing "parse inittab from examples" \
82 "parse -n 4 -m 4 -f $((NORMAL - TRIM - COLLAPSE)) -d'#:' $FILE" \
83 "`cat $FILE.res`\n" \
84 "" \
85 ""
86
87 cp ../examples/udhcp/udhcpd.conf $FILE
88 cat >$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 EOF
100
101 testing "parse udhcpd.conf from examples" \
102 "parse -n 127 $FILE" \
103 "`cat $FILE.res`\n" \
104 "" \
105 ""
106
107 rm -f $FILE $FILE.res
108
109 exit $FAILCOUNT