2 # Copyright 2008 by Denys Vlasenko
3 # Licensed under GPL v2, see file LICENSE for details.
7 # ls -ln is showing date. Need to remove that, it's variable
8 # sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces
10 FILTER_LS="sed -e 's/, */,/g' -e 's/ */ /g' | cut -d' ' -f 1-5,9-"
12 # testing "test name" "options" "expected result" "file input" "stdin"
16 # We need mdev executable to be in chroot jail!
17 # (will still fail with dynamically linked one, though...)
18 cp ../busybox mdev.testdir/mdev
19 mkdir mdev.testdir/etc
20 mkdir mdev.testdir/dev
21 mkdir -p mdev.testdir/sys/block/sda
22 echo "8:0" >mdev.testdir/sys/block/sda/dev
24 testing "mdev add /block/sda" \
25 "env - ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
26 ls -ln mdev.testdir/dev | $FILTER_LS" \
28 mdev: /etc/mdev.conf: No such file or directory
29 brw-rw---- 1 0 0 8,0 sda
33 # continuing to use directory structure from prev test
34 rm mdev.testdir/dev/sda
35 echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf
36 echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf
37 testing "mdev stops on first rule" \
38 "env - ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
39 ls -ln mdev.testdir/dev | $FILTER_LS" \
41 brw-rw-rw- 1 1 1 8,0 sda