linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: [patch] compatibility symlinks for udev
Date: Tue, 14 Sep 2004 17:50:31 +0000	[thread overview]
Message-ID: <20040914175031.GA18594@vrfy.org> (raw)
In-Reply-To: <1094481997.4727.14.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1133 bytes --]

On Fri, Sep 10, 2004 at 01:09:07PM -0700, Greg KH wrote:
> On Tue, Sep 07, 2004 at 01:19:34PM +0200, David Zeuthen wrote:
> > 
> >         KERNEL="sr*", NAME="%k", SYMLINK="cdrom%e"
> >         KERNEL="scd*", NAME="%k", SYMLINK="cdrom%e"
> >         KERNEL="pcd*", NAME="%k", SYMLINK="cdrom%e"
> >         KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="\%k", SYMLINK="cdrom%e"
> >         KERNEL="fd[0-9]", NAME="%k", SYMLINK="floppy%e"
> >         KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy", NAME=\"%k", SYMLINK="floppy%e"
> >         
> > New patch is attached. 
> 
> Nice, I've applied this.
> 
> How about sending a patch for the test/udev-test.pl script that adds a
> test for this new paramater, so we make sure to not break it in the
> future.

Here are the tests for the enumeration character %e. I've added a option
string to be able to do a whole sequence of tests without node removal,
so we can skip the "remove" event and get an increasing number to append
to the name. After the sequence test the whole directory is cleaned for
the next tests.

Thanks,
Kay

[-- Attachment #2: udev-tests-enum-02.patch --]
[-- Type: text/plain, Size: 3008 bytes --]

===== test/udev-test.pl 1.57 vs edited =====
--- 1.57/test/udev-test.pl	2004-09-14 16:00:29 +02:00
+++ edited/test/udev-test.pl	2004-09-14 19:42:53 +02:00
@@ -1017,6 +1017,74 @@
 BUS="scsi", PROGRAM="/bin/echo -n node link1 link2 link3 link4", RESULT="node *", NAME="%c{1}", SYMLINK="%c{2+}"
 EOF
 	},
+	{
+		desc		=> "enumeration char test (single test)",
+		subsys		=> "block",
+		devpath		=> "/block/sda",
+		exp_name	=> "cdrom",
+		conf		=> <<EOF
+KERNEL="sda", NAME="cdrom%e"
+EOF
+	},
+	{
+		desc		=> "enumeration char test sequence (1/5 keep)",
+		subsys		=> "block",
+		devpath		=> "/block/sda",
+		exp_name	=> "cdrom",
+		option		=> "keep",
+		conf		=> <<EOF
+KERNEL="sda", NAME="cdrom%e"
+EOF
+	},
+	{
+		desc		=> "enumeration char test sequence 2/5 (keep)",
+		subsys		=> "block",
+		devpath		=> "/block/sda/sda1",
+		exp_name	=> "enum",
+		option		=> "keep",
+		conf		=> <<EOF
+KERNEL="sda1", NAME="enum%e"
+EOF
+	},
+	{
+		desc		=> "enumeration char test sequence 3/5 (keep)",
+		subsys		=> "block",
+		devpath		=> "/block/sda/sda2",
+		exp_name	=> "cdrom1",
+		option		=> "keep",
+		conf		=> <<EOF
+KERNEL="sda2", NAME="cdrom%e"
+EOF
+	},
+	{
+		desc		=> "enumeration char test sequence 4/5 (keep)",
+		subsys		=> "block",
+		devpath		=> "/block/sda/sda3",
+		exp_name	=> "enum1",
+		option		=> "keep",
+		conf		=> <<EOF
+KERNEL="sda3", NAME="enum%e"
+EOF
+	},
+	{
+		desc		=> "enumeration char test sequence 5/5 (clean)",
+		subsys		=> "block",
+		devpath		=> "/block/sda/sda4",
+		exp_name	=> "cdrom2",
+		option		=> "clear",
+		conf		=> <<EOF
+KERNEL="sda4", NAME="cdrom%e"
+EOF
+	},
+	{
+		desc		=> "enumeration char test after cleanup (single test)",
+		subsys		=> "block",
+		devpath		=> "/block/sda",
+		exp_name	=> "cdrom",
+		conf		=> <<EOF
+KERNEL="sda", NAME="cdrom%e"
+EOF
+	},
 );
 
 # set env
@@ -1160,6 +1228,11 @@
 		}
 	}
 
+	if (defined($config->{option}) && $config->{option} eq "keep") {
+		print "\n\n";
+		return;
+	}
+
 	udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf});
 	if ((-e "$PWD/$udev_root$config->{exp_name}") ||
 	    (-l "$PWD/$udev_root$config->{exp_name}")) {
@@ -1175,6 +1248,13 @@
 	} else {
 		print "remove: ok\n\n";
 	}
+
+	if (defined($config->{option}) && $config->{option} eq "clear") {
+		unlink($udev_db);
+		system("rm -rf $udev_root");
+		mkdir($udev_root) || die "unable to create udev_root: $udev_root\n";
+	}
+
 }
 
 # prepare
@@ -1194,9 +1274,13 @@
 if ($ARGV[0]) {
 	# only run one test
 	$test_num = $ARGV[0];
-	print "udev-test will run test number $test_num only\n";
 
-	run_test($tests[$test_num-1], $test_num);
+	if (defined($tests[$test_num-1]->{desc})) {
+		print "udev-test will run test number $test_num only:\n\n";
+		run_test($tests[$test_num-1], $test_num);
+	} else {
+		print "test does not exist.\n";
+	}
 } else {
 	# test all
 	print "\nudev-test will run ".($#tests + 1)." tests:\n\n";
@@ -1204,7 +1288,6 @@
 	foreach my $config (@tests) {
 		run_test($config, $test_num);
 		$test_num++;
-
 	}
 }
 

  parent reply	other threads:[~2004-09-14 17:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-06 14:46 [patch] compatibility symlinks for udev David Zeuthen
2004-09-06 15:45 ` Kay Sievers
2004-09-07 11:19 ` David Zeuthen
2004-09-10 20:09 ` Greg KH
2004-09-14 17:50 ` Kay Sievers [this message]
2004-09-14 20:50 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040914175031.GA18594@vrfy.org \
    --to=kay.sievers@vrfy.org \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).