grep: fix a case when -o loops forever
[oweals/busybox.git] / testsuite / mdev.tests
index 6d6a21d417c39b4a38354daa753fa819acf046a7..319c670da1bb5f9f047c821fd38537f157f07845 100755 (executable)
@@ -2,7 +2,7 @@
 # Copyright 2008 by Denys Vlasenko
 # Licensed under GPL v2, see file LICENSE for details.
 
-. testing.sh
+. ./testing.sh
 
 # ls -ln is showing date. Need to remove that, it's variable
 # sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces
@@ -136,12 +136,12 @@ brw-r--r-- 1 0 0 8,0 sda
 
 # continuing to use directory structure from prev test
 rm -rf mdev.testdir/dev/*
-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
 testing "mdev move and command" \
        "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
        ls -lnR mdev.testdir/dev | $FILTER_LS2" \
 "\
-@echo TEST
+@echo TEST:block/sda
 mdev.testdir/dev:
 drwxr-xr-x 2 0 0 block
 
@@ -152,7 +152,7 @@ brw-r--r-- 1 0 0 sda
 
 # continuing to use directory structure from prev test
 rm -rf mdev.testdir/dev/*
-echo "@8,0 :1 644" >mdev.testdir/etc/mdev.conf
+echo "@8,0 0:1 644" >mdev.testdir/etc/mdev.conf
 testing "mdev #maj,min and no explicit uid" \
        "env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
        ls -lnR mdev.testdir/dev | $FILTER_LS" \
@@ -162,6 +162,32 @@ brw-r--r-- 1 0 1 8,0 sda
 " \
        "" ""
 
+# continuing to use directory structure from prev test
+rm -rf mdev.testdir/dev/*
+mkdir -p mdev.testdir/sys/class/tty/capi
+echo "191:0" >mdev.testdir/sys/class/tty/capi/dev
+mkdir -p mdev.testdir/sys/class/tty/capi1
+echo "191:1" >mdev.testdir/sys/class/tty/capi1/dev
+mkdir -p mdev.testdir/sys/class/tty/capi20
+echo "191:20" >mdev.testdir/sys/class/tty/capi20/dev
+echo "capi            0:0 0660 =capi20"      >mdev.testdir/etc/mdev.conf
+echo "capi([0-9])     0:0 0660 =capi20.0%1" >>mdev.testdir/etc/mdev.conf
+echo "capi([0-9]*)    0:0 0660 =capi20.%1"  >>mdev.testdir/etc/mdev.conf
+# mdev invocation with DEVPATH=/class/tty/capi20 was deleting /dev/capi20
+testing "move rule does not delete node with name == device_name" \
+       "\
+       env - PATH=$PATH ACTION=add DEVPATH=/class/tty/capi chroot mdev.testdir /mdev 2>&1;
+       env - PATH=$PATH ACTION=add DEVPATH=/class/tty/capi1 chroot mdev.testdir /mdev 2>&1;
+       env - PATH=$PATH ACTION=add DEVPATH=/class/tty/capi20 chroot mdev.testdir /mdev 2>&1;
+       ls -lnR mdev.testdir/dev | $FILTER_LS" \
+"\
+mdev.testdir/dev:
+crw-rw---- 1 0 0 191,0 capi20
+crw-rw---- 1 0 0 191,1 capi20.01
+crw-rw---- 1 0 0 191,20 capi20.20
+" \
+       "" ""
+
 # clean up
 rm -rf mdev.testdir