Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/testsuite/mdev.tests

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 983 by niro, Fri Apr 24 18:33:46 2009 UTC revision 984 by niro, Sun May 30 11:32:42 2010 UTC
# Line 2  Line 2 
2  # Copyright 2008 by Denys Vlasenko  # Copyright 2008 by Denys Vlasenko
3  # Licensed under GPL v2, see file LICENSE for details.  # Licensed under GPL v2, see file LICENSE for details.
4    
5  . testing.sh  . ./testing.sh
6    
7  # ls -ln is showing date. Need to remove that, it's variable  # ls -ln is showing date. Need to remove that, it's variable
8  # sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces  # sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces
9  # cut: remove date  # cut: remove date
10  FILTER_LS="sed -e 's/,  */,/g' -e 's/  */ /g' | cut -d' ' -f 1-5,9-"  FILTER_LS="grep -v '^total ' | sed -e 's/,  */,/g' -e 's/  */ /g' | cut -d' ' -f 1-5,9-"
11  # cut: remove size+date  # cut: remove size+date
12  FILTER_LS2="sed -e 's/,  */,/g' -e 's/  */ /g' | cut -d' ' -f 1-4,9-"  FILTER_LS2="grep -v '^total ' | sed -e 's/,  */,/g' -e 's/  */ /g' | cut -d' ' -f 1-4,9-"
13    
14  # testing "test name" "options" "expected result" "file input" "stdin"  # testing "test name" "options" "expected result" "file input" "stdin"
15    
# Line 49  brw-rw-rw- 1 1 1 8,0 sda Line 49  brw-rw-rw- 1 1 1 8,0 sda
49    
50  # continuing to use directory structure from prev test  # continuing to use directory structure from prev test
51  rm -rf mdev.testdir/dev/*  rm -rf mdev.testdir/dev/*
52    echo "-.* 1:1 666" >mdev.testdir/etc/mdev.conf
53    echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf
54    testing "mdev does not stop on dash-rule" \
55     "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
56     ls -ln mdev.testdir/dev | $FILTER_LS" \
57    "\
58    br--r--r-- 1 2 2 8,0 sda
59    " \
60     "" ""
61    
62    # continuing to use directory structure from prev test
63    rm -rf mdev.testdir/dev/*
64    echo "\$MODALIAS=qw  1:1 666" >mdev.testdir/etc/mdev.conf
65    echo "\$MODALIAS=qw. 2:2 444" >>mdev.testdir/etc/mdev.conf
66    echo "\$MODALIAS=qw. 3:3 400" >>mdev.testdir/etc/mdev.conf
67    testing "mdev \$ENVVAR=regex match" \
68     "env - PATH=$PATH ACTION=add DEVPATH=/block/sda MODALIAS=qwe chroot mdev.testdir /mdev 2>&1;
69     ls -ln mdev.testdir/dev | $FILTER_LS" \
70    "\
71    br--r--r-- 1 2 2 8,0 sda
72    " \
73     "" ""
74    
75    # continuing to use directory structure from prev test
76    rm -rf mdev.testdir/dev/*
77  echo "sda 0:0 444 >disk/scsiA" >mdev.testdir/etc/mdev.conf  echo "sda 0:0 444 >disk/scsiA" >mdev.testdir/etc/mdev.conf
78  testing "mdev move/symlink rule '>bar/baz'" \  testing "mdev move/symlink rule '>bar/baz'" \
79   "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;   "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
# Line 111  brw-r--r-- 1 0 0 8,0 sda Line 136  brw-r--r-- 1 0 0 8,0 sda
136    
137  # continuing to use directory structure from prev test  # continuing to use directory structure from prev test
138  rm -rf mdev.testdir/dev/*  rm -rf mdev.testdir/dev/*
139  echo "sda 0:0 644 =block/ @echo @echo TEST" >mdev.testdir/etc/mdev.conf  echo "sda 0:0 644 =block/ @echo @echo TEST:\$MDEV" >mdev.testdir/etc/mdev.conf
140  testing "mdev move and command" \  testing "mdev move and command" \
141   "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;   "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
142   ls -lnR mdev.testdir/dev | $FILTER_LS2" \   ls -lnR mdev.testdir/dev | $FILTER_LS2" \
143  "\  "\
144  @echo TEST  @echo TEST:block/sda
145  mdev.testdir/dev:  mdev.testdir/dev:
146  drwxr-xr-x 2 0 0 block  drwxr-xr-x 2 0 0 block
147    
# Line 127  brw-r--r-- 1 0 0 sda Line 152  brw-r--r-- 1 0 0 sda
152    
153  # continuing to use directory structure from prev test  # continuing to use directory structure from prev test
154  rm -rf mdev.testdir/dev/*  rm -rf mdev.testdir/dev/*
155  echo "@8,0 :1 644" >mdev.testdir/etc/mdev.conf  echo "@8,0 0:1 644" >mdev.testdir/etc/mdev.conf
156  testing "mdev #maj,min and no explicit uid" \  testing "mdev #maj,min and no explicit uid" \
157   "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;   "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
158   ls -lnR mdev.testdir/dev | $FILTER_LS" \   ls -lnR mdev.testdir/dev | $FILTER_LS" \
# Line 137  brw-r--r-- 1 0 1 8,0 sda Line 162  brw-r--r-- 1 0 1 8,0 sda
162  " \  " \
163   "" ""   "" ""
164    
165    # continuing to use directory structure from prev test
166    rm -rf mdev.testdir/dev/*
167    mkdir -p mdev.testdir/sys/class/tty/capi
168    echo "191:0" >mdev.testdir/sys/class/tty/capi/dev
169    mkdir -p mdev.testdir/sys/class/tty/capi1
170    echo "191:1" >mdev.testdir/sys/class/tty/capi1/dev
171    mkdir -p mdev.testdir/sys/class/tty/capi20
172    echo "191:20" >mdev.testdir/sys/class/tty/capi20/dev
173    echo "capi            0:0 0660 =capi20"      >mdev.testdir/etc/mdev.conf
174    echo "capi([0-9])     0:0 0660 =capi20.0%1" >>mdev.testdir/etc/mdev.conf
175    echo "capi([0-9]*)    0:0 0660 =capi20.%1"  >>mdev.testdir/etc/mdev.conf
176    # mdev invocation with DEVPATH=/class/tty/capi20 was deleting /dev/capi20
177    testing "move rule does not delete node with name == device_name" \
178     "\
179     env - PATH=$PATH ACTION=add DEVPATH=/class/tty/capi chroot mdev.testdir /mdev 2>&1;
180     env - PATH=$PATH ACTION=add DEVPATH=/class/tty/capi1 chroot mdev.testdir /mdev 2>&1;
181     env - PATH=$PATH ACTION=add DEVPATH=/class/tty/capi20 chroot mdev.testdir /mdev 2>&1;
182     ls -lnR mdev.testdir/dev | $FILTER_LS" \
183    "\
184    mdev.testdir/dev:
185    crw-rw---- 1 0 0 191,0 capi20
186    crw-rw---- 1 0 0 191,1 capi20.01
187    crw-rw---- 1 0 0 191,20 capi20.20
188    " \
189     "" ""
190    
191  # clean up  # clean up
192  rm -rf mdev.testdir  rm -rf mdev.testdir
193    

Legend:
Removed from v.983  
changed lines
  Added in v.984