use warnings;
use strict;
-my $PWD = `pwd`;
-chomp($PWD);
-
+my $PWD = $ENV{PWD};
my $sysfs = "sys/";
my $udev_bin = "../udev";
my $udev_root = "udev-root/"; # !!! directory will be removed !!!
-my $udev_db = "udev.tdb";
+my $udev_db = ".udev.tdb";
my $perm = "udev.permissions";
my $conf_tmp = "udev-test.config";
expected => "boot_disk1" ,
conf => <<EOF
LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n"
+EOF
+ },
+ {
+ desc => "catch device by wildcard",
+ subsys => "tty",
+ devpath => "class/tty/ttyUSB0",
+ expected => "visor/0" ,
+ conf => <<EOF
+REPLACE, KERNEL="ttyUSB*", NAME="visor/%n"
EOF
},
{
expected => "visor" ,
conf => <<EOF
REPLACE, KERNEL="ttyUSB0", NAME="visor"
+EOF
+ },
+ {
+ desc => "subdirectory handling",
+ subsys => "tty",
+ devpath => "class/tty/ttyUSB0",
+ expected => "sub/direct/ory/visor" ,
+ conf => <<EOF
+REPLACE, KERNEL="ttyUSB0", NAME="sub/direct/ory/visor"
EOF
},
{
EOF
},
{
- desc => "callout result subtitution, only last should match",
+ desc => "callout result substitution, only last should match",
subsys => "block",
devpath => "block/sda/sda3",
expected => "special-device-3" ,
CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n special-device", ID="special-device-", NAME="%c-3-%n"
CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n special-device", ID="special-devic", NAME="%c-4-%n"
CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n special-device", ID="special-*", NAME="%c-%n"
+EOF
+ },
+ {
+ desc => "callout program substitution",
+ subsys => "block",
+ devpath => "block/sda/sda3",
+ expected => "test-0:0:0:0" ,
+ conf => <<EOF
+CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-*", NAME="%c"
+EOF
+ },
+ {
+ desc => "devfs disk naming substitution",
+ subsys => "block",
+ devpath => "block/sda",
+ expected => "lun0/disk" ,
+ conf => <<EOF
+LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="lun0/%D"
+EOF
+ },
+ {
+ desc => "devfs disk naming substitution",
+ subsys => "block",
+ devpath => "block/sda/sda2",
+ expected => "lun0/part2" ,
+ conf => <<EOF
+LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="lun0/%D"
+EOF
+ },
+ {
+ desc => "callout bus type",
+ subsys => "block",
+ devpath => "block/sda",
+ expected => "scsi-0:0:0:0" ,
+ conf => <<EOF
+CALLOUT, BUS="usb", PROGRAM="/bin/echo -n usb-%b", ID="*", NAME="%c"
+CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n scsi-%b", ID="*", NAME="%c"
+CALLOUT, BUS="foo", PROGRAM="/bin/echo -n foo-%b", ID="*", NAME="%c"
EOF
},
);
system("tree $udev_root");
print "\n";
$error++;
-# next;
}
udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf});
print "$error errors occured\n\n";
# cleanup
+unlink($udev_db);
system("rm -rf $udev_root");
unlink($conf_tmp);
-unlink($udev_db);