diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2003-12-07 09:12:07 -0800 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:13:06 -0700 |
commit | 3d150dfb28efbaf0b25f154fb8955c47d606c3d5 (patch) | |
tree | d94d704c7c0aa21ccfacf0f821a6e7071af22c46 /test/udev-test.pl | |
parent | eadb1bbc2eece84d9aff79bf17e252106c37f355 (diff) |
[PATCH] experimental (very simple) SYMLINK creation
> > here is a experimental symlink creation patch - for discussion,
> > in which direction we should go.
> > It is possible now to define SYMLINK= after the NAME= in udev.rules.
> > The link is relative to the node, but the path is not optimized now
> > if the node and the link are in the same nested directory.
> > Only one link is supported, cause i need to sleep now :)
> >
> > 06-simple-symlink-creation.diff
> > simple symlink creation
> > reorganized udev-remove to have access to the symlink field
> > subdir creation/removal are functions now
> > udev-test.pl tests for link creation/removal
Here is a new version with relative link target path optimization
an better tests in udev-test.pl:
LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink"
Dec 7 06:48:34 pim udev[13789]: create_node: symlink 'udev-root/1/2/c/d/symlink' to node '1/2/a/b/node' requested
Dec 7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c'
Dec 7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c/d'
Dec 7 06:48:34 pim udev[13789]: create_node: symlink(../../a/b/node, udev-root/1/2/c/d/symlink)
Diffstat (limited to 'test/udev-test.pl')
-rw-r--r-- | test/udev-test.pl | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl index b1757ee1bb..190b7ce4d6 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -39,7 +39,7 @@ my @tests = ( expected => "boot_disk" , conf => <<EOF LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n" -REPLACE, KERNEL="ttyUSB0", NAME="visor"" +REPLACE, KERNEL="ttyUSB0", NAME="visor" EOF }, { @@ -181,6 +181,42 @@ 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 }, + { + desc => "symlink creation (same directory)", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor0" , + conf => <<EOF +REPLACE, KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="visor%n" +EOF + }, + { + desc => "symlink creation (relative link back)", + subsys => "block", + devpath => "block/sda/sda2", + expected => "1/2/a/b/symlink" , + conf => <<EOF +LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="1/2/node", SYMLINK="1/2/a/b/symlink" +EOF + }, + { + desc => "symlink creation (relative link forward)", + subsys => "block", + devpath => "block/sda/sda2", + expected => "1/2/symlink" , + conf => <<EOF +LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/symlink" +EOF + }, + { + desc => "symlink creation (relative link back and forward)", + subsys => "block", + devpath => "block/sda/sda2", + expected => "1/2/c/d/symlink" , + conf => <<EOF +LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink" +EOF + }, ); # set env @@ -238,7 +274,8 @@ foreach my $config (@tests) { } udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf}); - if (-e "$PWD/$udev_root$config->{expected}") { + if ((-e "$PWD/$udev_root$config->{expected}") || + (-l "$PWD/$udev_root$config->{expected}")) { print "remove: error\n\n"; system("tree $udev_root"); $error++; |