udev-test.pl - automatic testing script
Quoted 9 lines · Kay Sievers
here is a automatic udev test script. To test place it in the test/ directory of the current tree to find the sysfs tree copy and run it.
The whole test is self contained, it only needs a matching sysfs tree. To extend the test add a hash to the @tests array inside the script. The script checks the created node and prints a summary of all tests.
Please don't change $udev_root to something useful, its a temorary directory and will be removed after the test run.
Here is a slightly better version that runs 'tree' on error and prints a description for every test.
thanks,
Kay
pim:/home/kay/src/udev.kay/test# ./udev-test.pl
udev-test will run 6 tests:
TEST: label test of scsi disc
method 'LABEL' for 'block/sda' expecting node 'boot_disk'
add: ok remove: ok
TEST: label test of scsi partition
method 'LABEL' for 'block/sda/sda1' expecting node 'boot_disk1'
add: ok remove: ok
TEST: replace kernel name
method 'REPLACE' for 'class/tty/ttyUSB0' expecting node 'visor'
add: ok remove: ok
TEST: place on bus of scsi partition
method 'TOPOLOGY' for 'block/sda/sda3' expecting node 'first_disk2'
add: error
udev-root/
`-- first_disk3
0 directories, 1 file
TEST: test NAME substitution chars
method 'TOPOLOGY' for 'block/sda/sda3' expecting node 'Major:8:minor:3:kernelnumber:3:bus:0:0:0:0'
add: ok remove: ok
TEST: callout result subtitution, only last should match method 'CALLOUT' for 'block/sda/sda3' expecting node 'special-device-3'
add: ok remove: ok
1 errors occured
Quoted 8 lines · Kay Sievers
Quoted 7 lines · Kay Sievers
here is a automatic udev test script. To test place it in the test/ directory of the current tree to find the sysfs tree copy and run it.
The whole test is self contained, it only needs a matching sysfs tree. To extend the test add a hash to the @tests array inside the script. The script checks the created node and prints a summary of all tests.
Quoted 5 lines
Quoted 2 lines
Please don't change $udev_root to something useful, its a temorary directory and will be removed after the test run.
Here is a slightly better version that runs 'tree' on error and prints a description for every test.
Sweet, this blows away my mess of shell scripts. I've added this script to the test/ directory, thanks a lot for this.
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 9 lines · Greg KH
Quoted 8 lines · Kay Sievers
Quoted 7 lines · Kay Sievers
here is a automatic udev test script. To test place it in the test/ directory of the current tree to find the sysfs tree copy and run it.
The whole test is self contained, it only needs a matching sysfs tree. To extend the test add a hash to the @tests array inside the script. The script checks the created node and prints a summary of all tests.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Please don't change $udev_root to something useful, its a temorary directory and will be removed after the test run.
Here is a slightly better version that runs 'tree' on error and prints a description for every test.
Sweet, this blows away my mess of shell scripts. I've added this script to the test/ directory, thanks a lot for this.
We don't want to test the "remove" if "add" fails.
thanks,
Kay
udev-test.pl renamed from ../udev/test/udev-test.pl +1 -1
@@ -151,7 +151,7 @@ system("tree $udev_root"); print "\n"; $error++; -# next; + next; } udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf});
Quoted 13 lines · Kay Sievers
Quoted 12 lines · Greg KH
Quoted 11 lines · Kay Sievers
Quoted 9 lines · Kay Sievers
here is a automatic udev test script. To test place it in the test/ directory of the current tree to find the sysfs tree copy and run it.
The whole test is self contained, it only needs a matching sysfs tree. To extend the test add a hash to the @tests array inside the script. The script checks the created node and prints a summary of all tests.
Please don't change $udev_root to something useful, its a temorary directory and will be removed after the test run.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Here is a slightly better version that runs 'tree' on error and prints a description for every test.
Sweet, this blows away my mess of shell scripts. I've added this script to the test/ directory, thanks a lot for this.
We don't want to test the "remove" if "add" fails.
Why not? We should remove the same device, right? That way we end up with a clean directory :)
thanks,
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 17 lines · Greg KH
Quoted 16 lines · Kay Sievers
Quoted 15 lines · Greg KH
Quoted 13 lines · Kay Sievers
Quoted 9 lines · Kay Sievers
here is a automatic udev test script. To test place it in the test/ directory of the current tree to find the sysfs tree copy and run it.
The whole test is self contained, it only needs a matching sysfs tree. To extend the test add a hash to the @tests array inside the script. The script checks the created node and prints a summary of all tests.
Please don't change $udev_root to something useful, its a temorary directory and will be removed after the test run.
Here is a slightly better version that runs 'tree' on error and prints a description for every test.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Sweet, this blows away my mess of shell scripts. I've added this script to the test/ directory, thanks a lot for this.
We don't want to test the "remove" if "add" fails.
Why not? We should remove the same device, right? That way we end up with a clean directory :)
Yes, you are right. If we have two errors we don't want to list at the second error the node from the first.
But I found two missing characters and optimized $PWD. You see my queue is empty now :)
thanks,
Kay
udev-test.pl renamed from ../udev/test/udev-test.pl +3 -6
@@ -21,9 +21,7 @@ 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 !!!
@@ -80,7 +78,7 @@ 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" ,
@@ -93,7 +91,7 @@ EOF }, { - desc => "callout program subtitution", + desc => "callout program substitution", subsys => "block", devpath => "block/sda/sda3", expected => "test-0:0:0:0" ,
@@ -151,7 +149,6 @@ system("tree $udev_root"); print "\n"; $error++; -# next; } udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf});
Quoted 3 lines · Kay Sievers
But I found two missing characters and optimized $PWD. You see my queue is empty now :)
Thanks, I've applied this.
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel