udev-test.pl revision ac28b86d631f23b5df74dbeb33e76a2b3f5d88bb
0N/A# Provides automated testing of the udev binary. 0N/A# The whole test is self contained in this file, except the matching sysfs tree. 0N/A# Simply extend the @tests array, to add a new test variant. 0N/A# Every test is driven by its own temporary config file. 0N/A# This program prepares the environment, creates the config and calls udev. 0N/A# udev reads the config, looks at the provided sysfs and 0N/A# first creates and then removes the device node. 0N/A# After creation and removal the result is checked against the 0N/A# expected value and the result is printed. 0N/A# Kay Sievers <kay.sievers@vrfy.org>, 2003 0N/A desc =>
"label test of scsi partition",
desc =>
"label test of max sysfs files",
desc =>
"catch device by *",
desc =>
"catch device by ?",
desc =>
"catch device by character class",
desc =>
"replace kernel name",
desc =>
"Handle comment lines in config file (and replace kernel name)",
desc =>
"Handle comment lines in config file with whitespace (and replace kernel name)",
# this is a comment with whitespace before the comment desc =>
"Handle empty lines in config file (and replace kernel name)",
desc =>
"subdirectory handling",
desc =>
"place on bus of scsi partition",
desc =>
"test NAME substitution chars",
expected =>
"Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" ,
BUS=
"scsi",
PLACE=
"0:0:0:0",
NAME=
"Major:%M:minor:%m:kernelnumber:%n:bus:%b" desc =>
"program result substitution",
desc =>
"program result substitution",
desc =>
"program result substitution (numbered part of)",
desc =>
"invalid program for device with no bus",
desc =>
"valid program for device with no bus",
desc =>
"invalid label for device with no bus",
desc =>
"valid label for device with no bus",
desc =>
"devfs disk naming substitution",
desc =>
"devfs disk naming substitution",
desc =>
"program and bus type match",
desc =>
"symlink creation (same directory)",
desc =>
"symlink creation (relative link back)",
desc =>
"symlink creation (relative link forward)",
desc =>
"symlink creation (relative link back and forward)",
desc =>
"multiple symlinks",
# create temporary config open CONF,
">$conf_tmp" ||
die "unable to create config file: $conf_tmp";
system(
"$udev_bin $subsys");
system(
"rm -rf $udev_root");
mkdir($
udev_root) ||
die "unable to create udev_root: $udev_root\n";
print "\nudev-test will run ".($
#tests + 1)." tests:\n\n"; # create initial config file open CONF,
">$main_conf" ||
die "unable to create config file: $main_conf";
print CONF "udev_root=\"$udev_root\"\n";
print CONF "udev_db=\"$udev_db\"\n";
print CONF "udev_rules=\"$conf_tmp\"\n";
print CONF "udev_permissions=\"$perm\"\n";
print "TEST: $config->{desc}\n";
print "device \'$config->{devpath}\' expecting node \'$config->{expected}\'\n";
if (-e
"$PWD/$udev_root$config->{expected}") {
system(
"tree $udev_root");
if ((-e
"$PWD/$udev_root$config->{expected}") ||
(-l
"$PWD/$udev_root$config->{expected}")) {
print "remove: error\n\n";
system(
"tree $udev_root");
print "$error errors occured\n\n";
system(
"rm -rf $udev_root");