summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-11-10 01:50:06 +0100
committerKay Sievers <kay.sievers@suse.de>2005-11-10 01:50:06 +0100
commit53899a171ea862124b49c75b7511b7eb30742ef9 (patch)
tree6552376fba823d79c2f84c9a38b67244b9ed2437
parentf5f8f316aa66251d0ccf71b940182a9d00dbd040 (diff)
fix tests and remove no longer useful stuff
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
-rwxr-xr-xtest/devd_test37
-rwxr-xr-xtest/net_test35
-rwxr-xr-xtest/replace_test33
-rwxr-xr-xtest/show_all_devices.sh27
-rwxr-xr-xtest/test.all41
-rwxr-xr-xtest/test.block29
-rwxr-xr-xtest/test.tty20
-rwxr-xr-xtest/testd.block36
-rwxr-xr-xtest/udev-test.pl5
-rw-r--r--udev_remove.c4
10 files changed, 5 insertions, 262 deletions
diff --git a/test/devd_test b/test/devd_test
deleted file mode 100755
index 534e787f24..0000000000
--- a/test/devd_test
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-RULES=label_test.rules
-CONFIG=label_test.conf
-
-export SYSFS_PATH=$PWD/sys/
-export UDEV_CONFIG_FILE=$PWD/$CONFIG
-
-cat > $RULES << EOF
-BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_diskX%n"
-BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="a/nice/place/to/put/a/boot_disk%n"
-EOF
-
-cat > $CONFIG << EOF
-udev_root="$PWD/udev/"
-udev_db="$PWD/udev/.udevdb"
-udev_rules="$PWD/$RULES"
-EOF
-
-mkdir udev
-
-export ACTION=add
-export DEVPATH=block/sda
-
-../udev block
-ls -l udev
-
-export ACTION=remove
-export DEVPATH=block/sda
-
-../udev block
-ls -l udev
-
-
-rm $RULES
-rm $CONFIG
-rm -rf udev
diff --git a/test/net_test b/test/net_test
deleted file mode 100755
index 9daf8da082..0000000000
--- a/test/net_test
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-RULES=label_test.rules
-CONFIG=label_test.conf
-
-export SYSFS_PATH=$PWD/sys/
-export UDEV_CONFIG_FILE=$PWD/$CONFIG
-
-cat > $RULES << EOF
-SYSFS{address}="00:e0:00:8d:9f:25", NAME="wireless"
-EOF
-
-cat > $CONFIG << EOF
-udev_root="$PWD/udev/"
-udev_db="$PWD/udev/.udevdb"
-udev_rules="$PWD/$RULES"
-EOF
-
-mkdir udev
-
-export ACTION=add
-export DEVPATH=class/net/eth1
-
-../udevtest class/net/eth1 net
-ls -l udev
-
-export ACTION=remove
-export DEVPATH=class/net/eth1
-
-../udevtest class/net/eth1 net
-ls -l udev
-
-rm $RULES
-rm $CONFIG
-rm -rf udev
diff --git a/test/replace_test b/test/replace_test
deleted file mode 100755
index 6e01f28ed5..0000000000
--- a/test/replace_test
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-RULES=replace_test.rules
-CONFIG=replace_test.conf
-
-export SYSFS_PATH=$PWD/sys/
-export UDEV_CONFIG_FILE=$PWD/$CONFIG
-
-cat > $RULES << EOF
-KERNEL="ttyUSB0", NAME="visor"
-EOF
-
-cat > $CONFIG << EOF
-udev_root="$PWD/udev/"
-udev_db="$PWD/udev/.udevdb"
-udev_rules="$PWD/$RULES"
-EOF
-
-mkdir udev
-
-export DEVPATH=class/tty/ttyUSB0
-export ACTION=add
-
-../udev tty
-ls -l udev
-
-export ACTION=remove
-../udev tty
-ls -l udev
-
-rm $RULES
-rm $CONFIG
-rm -rf udev
diff --git a/test/show_all_devices.sh b/test/show_all_devices.sh
deleted file mode 100755
index 921b8e6163..0000000000
--- a/test/show_all_devices.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /bin/bash
-#
-# Directory where sysfs is mounted
-SYSFS_DIR=/sys
-
-# handle block devices and their partitions
-for i in ${SYSFS_DIR}/block/*; do
- # each drive
- echo ${i#${SYSFS_DIR}/block/}
-
- # each partition, on each device
- for j in $i/*; do
- if [ -f $j/dev ]; then
- echo ${j#${SYSFS_DIR}} | cut --delimiter='/' --fields=4-
- fi
- done
-done
-
-# all other device classes
-for i in ${SYSFS_DIR}/class/*; do
- for j in $i/*; do
- if [ -f $j/dev ]; then
- echo ${j#${SYSFS_DIR}} | cut --delimiter='/' --fields=4-
- fi
- done
-done
-
diff --git a/test/test.all b/test/test.all
deleted file mode 100755
index 527569bd43..0000000000
--- a/test/test.all
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/sh
-#
-# test.block - run udev(8) on each block device in /sys/block
-
-if [ $# = "0" ] ; then
- echo
- echo "usage: $0 <action>"
- echo "where <action> is \"add\" or \"remove\""
- echo
- exit 1
-fi
-
-SYSFSDIR=/sys # change this for a nonstand sysfs mount point
-BIN=../udev # location of your udev binary
-export ACTION=$1 # 'add' or 'remove'
-
-# do the block devices first
-for i in ${SYSFSDIR}/block/*; do
- # add each drive
- export DEVPATH=${i#${SYSFSDIR}}
- $BIN block
-
- # add each partition, on each device
- for j in $i/*; do
- if [ -f $j/dev ]; then
- export DEVPATH=${j#${SYSFSDIR}}
- $BIN block
- fi
- done
-done
-
-# now all the devices in the class directories
-for i in ${SYSFSDIR}/class/*; do
- for j in $i/*; do
- if [ -f $j/dev ]; then
- export DEVPATH=${j#${SYSFSDIR}}
- CLASS=`echo ${i#${SYSFSDIR}} | cut --delimiter='/' --fields=3-`
- $BIN $CLASS
- fi
- done
-done
diff --git a/test/test.block b/test/test.block
deleted file mode 100755
index 294c47c0be..0000000000
--- a/test/test.block
+++ /dev/null
@@ -1,29 +0,0 @@
-#! /bin/sh
-#
-# test.block - run udev(8) on each block device in /sys/block
-
-if [ $# = "0" ] ; then
- echo
- echo "usage: $0 <action>"
- echo "where <action> is \"add\" or \"remove\""
- echo
- exit 1
-fi
-
-SYSFSDIR=/sys # change this for a nonstand sysfs mount point
-BIN=../udev # location of your udev binary
-export ACTION=$1 # 'add' or 'remove'
-
-for i in ${SYSFSDIR}/block/*; do
- # add each drive
- export DEVPATH=${i#${SYSFSDIR}}
- $BIN block
-
- # add each partition, on each device
- for j in $i/*; do
- if [ -f $j/dev ]; then
- export DEVPATH=${j#${SYSFSDIR}}
- $BIN block
- fi
- done
-done
diff --git a/test/test.tty b/test/test.tty
deleted file mode 100755
index b89ad5a6d8..0000000000
--- a/test/test.tty
+++ /dev/null
@@ -1,20 +0,0 @@
-#! /bin/sh
-#
-# test.tty - run udev(8) on each tty device in /sys/class/tty
-
-if [ $# = "0" ] ; then
- echo
- echo "usage: $0 <action>"
- echo "where <action> is \"add\" or \"remove\""
- echo
- exit 1
-fi
-
-SYSFSDIR=/sys # change this for a nonstand sysfs mount point
-BIN=../udev # location of your udev binary
-export ACTION=$1 # 'add' or 'remove'
-
-for i in ${SYSFSDIR}/class/tty/*; do
- export DEVPATH=${i#${SYSFSDIR}}
- $BIN tty
-done
diff --git a/test/testd.block b/test/testd.block
deleted file mode 100755
index ca9ac8c1ac..0000000000
--- a/test/testd.block
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-#
-# test.block - run udev(8) on each block device in /sys/block
-
-if [ $# = "0" ] ; then
- echo
- echo "usage: $0 <action>"
- echo "where <action> is \"add\" or \"remove\""
- echo
- exit 1
-fi
-
-killall udevd
-
-SYSFSDIR=/sys # change this for a nonstand sysfs mount point
-BIN=./udevsend # location of your udev binary
-export ACTION=$1 # 'add' or 'remove'
-seq=1
-
-for i in ${SYSFSDIR}/block/*; do
- # add each drive
- export DEVPATH=${i#${SYSFSDIR}}
- export SEQNUM=$seq
- $BIN block
- x=$((seq++))
-
- # add each partition, on each device
- for j in $i/*; do
- if [ -f $j/dev ]; then
- export DEVPATH=${j#${SYSFSDIR}}
- export SEQNUM=$seq
- $BIN block
- x=$((seq++))
- fi
- done
-done
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 44bc483cf1..2549c7ee69 100755
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -262,9 +262,9 @@ EOF
desc => "import of shell-value file",
subsys => "block",
devpath => "/block/sda",
- exp_name => "subdir/sys/node" ,
+ exp_name => "subdir/info/node" ,
rules => <<EOF
-BUS=="scsi", IMPORT{file}="test.all", NAME="subdir%E{SYSFSDIR}/node"
+BUS=="scsi", IMPORT{file}="udev-test.conf", NAME="subdir/%E{udev_log}/node"
KERNEL=="ttyUSB0", NAME="visor"
EOF
},
@@ -1763,6 +1763,7 @@ open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf";
print CONF "udev_root=\"$udev_root\"\n";
print CONF "udev_db=\"$udev_db\"\n";
print CONF "udev_rules=\"$udev_rules\"\n";
+print CONF "udev_log=\"info\"\n";
close CONF;
my $test_num = 1;
diff --git a/udev_remove.c b/udev_remove.c
index cb5523af92..4d1b9286a0 100644
--- a/udev_remove.c
+++ b/udev_remove.c
@@ -152,8 +152,8 @@ int udev_remove_device(struct udevice *udev)
dbg("remove name='%s'", udev->name);
udev_db_delete_device(udev);
} else {
- dbg("'%s' not found in database, don't remove anything", udev->devpath);
- return -1;
+ dbg("'%s' not found in database, using kernel name '%s'", udev->devpath, udev->kernel_name);
+ strlcpy(udev->name, udev->kernel_name, sizeof(udev->name));
}
return delete_node(udev);