diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2016-04-06 23:18:06 +0200 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-04-06 23:30:10 +0200 |
commit | bf8f7583ee2a6f93ede82c97d6b47f1f4a7245db (patch) | |
tree | 3a966f92ea5747bccd8633b6ed72b9ce62abb2d9 /test/udev-test.pl | |
parent | test: udev: check exit code of test-udev (diff) | |
download | systemd-bf8f7583ee2a6f93ede82c97d6b47f1f4a7245db.tar.gz systemd-bf8f7583ee2a6f93ede82c97d6b47f1f4a7245db.tar.bz2 systemd-bf8f7583ee2a6f93ede82c97d6b47f1f4a7245db.zip |
test: udev: Check tags
Add two more tests:
- Add a single tag, match on it, don't match on another.
- Add 10.000 tags to a device, ensure that udev survives this.
(Reproduces crash fixed by commit 1d88a271a)
Diffstat (limited to 'test/udev-test.pl')
-rwxr-xr-x | test/udev-test.pl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl index 60c10b388..da0a4e1f6 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -35,6 +35,11 @@ my $udev_rules_dir = "$udev_run/udev/rules.d"; my $udev_rules = "$udev_rules_dir/udev-test.rules"; my $EXIT_TEST_SKIP = 77; +my $rules_10k_tags = ""; +for (my $i = 1; $i <= 10000; ++$i) { + $rules_10k_tags .= 'KERNEL=="sda", TAG+="test' . $i . "\"\n"; +} + my @tests = ( { desc => "no rules", @@ -1319,6 +1324,25 @@ KERNEL=="sda", IMPORT{builtin}="path_id" KERNEL=="sda", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/\$env{ID_PATH}" EOF }, + { + desc => "add and match tag", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "found", + not_exp_name => "bad" , + rules => <<EOF +SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", TAG+="green" +TAGS=="green", SYMLINK+="found" +TAGS=="blue", SYMLINK+="bad" +EOF + }, + { + desc => "don't crash with lots of tags", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "found", + rules => $rules_10k_tags . <<EOF +TAGS=="test1", TAGS=="test500", TAGS=="test1234", TAGS=="test9999", TAGS=="test10000", SYMLINK+="found" +EOF + }, ); sub udev { |