From 7898cd7e75f40627651cec134e3ac3a80176759a Mon Sep 17 00:00:00 2001 From: Yu Watanabe <watanabe.yu+github@gmail.com> Date: Thu, 21 Feb 2019 18:04:12 +0900 Subject: [PATCH] test-udev: fix alignment and drop unnecessary white spaces (cherry picked from commit 3dd2d524141d09d57443ae339e1a77d7ce40f847) Related: #1642728 --- test/udev-test.pl | 114 +++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 002fabd9fd..122359e377 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -49,7 +49,7 @@ my @tests = ( { desc => "no rules", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda" , + exp_name => "sda", exp_rem_error => "yes", rules => <<EOF # @@ -58,7 +58,7 @@ EOF { desc => "label test of scsi disc", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , + exp_name => "boot_disk", rules => <<EOF SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n" KERNEL=="ttyACM0", SYMLINK+="modem" @@ -67,7 +67,7 @@ EOF { desc => "label test of scsi disc", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , + exp_name => "boot_disk", rules => <<EOF SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n" KERNEL=="ttyACM0", SYMLINK+="modem" @@ -76,7 +76,7 @@ EOF { desc => "label test of scsi disc", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , + exp_name => "boot_disk", rules => <<EOF SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n" KERNEL=="ttyACM0", SYMLINK+="modem" @@ -85,7 +85,7 @@ EOF { desc => "label test of scsi partition", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , + exp_name => "boot_disk1", rules => <<EOF SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n" EOF @@ -93,7 +93,7 @@ EOF { desc => "label test of pattern match", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , + exp_name => "boot_disk1", rules => <<EOF SUBSYSTEMS=="scsi", ATTRS{vendor}=="?ATA", SYMLINK+="boot_disk%n-1" SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA?", SYMLINK+="boot_disk%n-2" @@ -104,7 +104,7 @@ EOF { desc => "label test of multiple sysfs files", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , + exp_name => "boot_disk1", rules => <<EOF SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS X ", SYMLINK+="boot_diskX%n" SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS", SYMLINK+="boot_disk%n" @@ -113,7 +113,7 @@ EOF { desc => "label test of max sysfs files (skip invalid rule)", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , + exp_name => "boot_disk1", rules => <<EOF SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS", ATTRS{scsi_level}=="6", ATTRS{rev}=="4.06", ATTRS{type}=="0", ATTRS{queue_depth}=="32", SYMLINK+="boot_diskXX%n" SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS", ATTRS{scsi_level}=="6", ATTRS{rev}=="4.06", ATTRS{type}=="0", SYMLINK+="boot_disk%n" @@ -122,7 +122,7 @@ EOF { desc => "catch device by *", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , + exp_name => "modem/0", rules => <<EOF KERNEL=="ttyACM*", SYMLINK+="modem/%n" EOF @@ -130,7 +130,7 @@ EOF { desc => "catch device by * - take 2", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , + exp_name => "modem/0", rules => <<EOF KERNEL=="*ACM1", SYMLINK+="bad" KERNEL=="*ACM0", SYMLINK+="modem/%n" @@ -139,7 +139,7 @@ EOF { desc => "catch device by ?", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , + exp_name => "modem/0", rules => <<EOF KERNEL=="ttyACM??*", SYMLINK+="modem/%n-1" KERNEL=="ttyACM??", SYMLINK+="modem/%n-2" @@ -149,7 +149,7 @@ EOF { desc => "catch device by character class", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , + exp_name => "modem/0", rules => <<EOF KERNEL=="ttyACM[A-Z]*", SYMLINK+="modem/%n-1" KERNEL=="ttyACM?[0-9]", SYMLINK+="modem/%n-2" @@ -159,7 +159,7 @@ EOF { desc => "replace kernel name", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , + exp_name => "modem", rules => <<EOF KERNEL=="ttyACM0", SYMLINK+="modem" EOF @@ -167,7 +167,7 @@ EOF { desc => "Handle comment lines in config file (and replace kernel name)", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , + exp_name => "modem", rules => <<EOF # this is a comment KERNEL=="ttyACM0", SYMLINK+="modem" @@ -177,7 +177,7 @@ EOF { desc => "Handle comment lines in config file with whitespace (and replace kernel name)", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , + exp_name => "modem", rules => <<EOF # this is a comment with whitespace before the comment KERNEL=="ttyACM0", SYMLINK+="modem" @@ -187,7 +187,7 @@ EOF { desc => "Handle whitespace only lines (and replace kernel name)", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "whitespace" , + exp_name => "whitespace", rules => <<EOF @@ -202,7 +202,7 @@ EOF { desc => "Handle empty lines in config file (and replace kernel name)", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , + exp_name => "modem", rules => <<EOF KERNEL=="ttyACM0", SYMLINK+="modem" @@ -212,7 +212,7 @@ EOF { desc => "Handle backslashed multi lines in config file (and replace kernel name)", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , + exp_name => "modem", rules => <<EOF KERNEL=="ttyACM0", \\ SYMLINK+="modem" @@ -230,7 +230,7 @@ EOF { desc => "Handle stupid backslashed multi lines in config file (and replace kernel name)", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , + exp_name => "modem", rules => <<EOF # @@ -248,7 +248,7 @@ EOF { desc => "subdirectory handling", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "sub/direct/ory/modem" , + exp_name => "sub/direct/ory/modem", rules => <<EOF KERNEL=="ttyACM0", SYMLINK+="sub/direct/ory/modem" EOF @@ -256,7 +256,7 @@ EOF { desc => "parent device name match of scsi partition", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "first_disk5" , + exp_name => "first_disk5", rules => <<EOF SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="first_disk%n" EOF @@ -264,7 +264,7 @@ EOF { desc => "test substitution chars", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , + exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0", rules => <<EOF SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="Major:%M:minor:%m:kernelnumber:%n:id:%b" EOF @@ -281,7 +281,7 @@ EOF { desc => "sustitution of sysfs value (%s{file})", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "disk-ATA-sda" , + exp_name => "disk-ATA-sda", rules => <<EOF SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="disk-%s{vendor}-%k" KERNEL=="ttyACM0", SYMLINK+="modem" @@ -290,8 +290,8 @@ EOF { desc => "program result substitution", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "special-device-5" , - not_exp_name => "not" , + exp_name => "special-device-5", + not_exp_name => "not", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="-special-*", SYMLINK+="not" SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-*", SYMLINK+="%c-%n" @@ -300,7 +300,7 @@ EOF { desc => "program result substitution (newline removal)", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "newline_removed" , + exp_name => "newline_removed", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo test", RESULT=="test", SYMLINK+="newline_removed" EOF @@ -308,7 +308,7 @@ EOF { desc => "program result substitution", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "test-0:0:0:0" , + exp_name => "test-0:0:0:0", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n test-%b", RESULT=="test-0:0*", SYMLINK+="%c" EOF @@ -316,7 +316,7 @@ EOF { desc => "program with lots of arguments", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo9" , + exp_name => "foo9", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda5", SYMLINK+="%c{7}" EOF @@ -324,7 +324,7 @@ EOF { desc => "program with subshell", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "bar9" , + exp_name => "bar9", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed s/foo9/bar9/'", KERNEL=="sda5", SYMLINK+="%c{7}" EOF @@ -332,7 +332,7 @@ EOF { desc => "program arguments combined with apostrophes", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo7" , + exp_name => "foo7", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n 'foo3 foo4' 'foo5 foo6 foo7 foo8'", KERNEL=="sda5", SYMLINK+="%c{5}" EOF @@ -340,7 +340,7 @@ EOF { desc => "program arguments combined with escaped double quotes, part 1", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo2" , + exp_name => "foo2", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c 'printf %%s \\\"foo1 foo2\\\" | grep \\\"foo1 foo2\\\"'", KERNEL=="sda5", SYMLINK+="%c{2}" EOF @@ -348,7 +348,7 @@ EOF { desc => "program arguments combined with escaped double quotes, part 2", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo2" , + exp_name => "foo2", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c \\\"printf %%s 'foo1 foo2' | grep 'foo1 foo2'\\\"", KERNEL=="sda5", SYMLINK+="%c{2}" EOF @@ -356,7 +356,7 @@ EOF { desc => "program arguments combined with escaped double quotes, part 3", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo2" , + exp_name => "foo2", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c 'printf \\\"%%s %%s\\\" \\\"foo1 foo2\\\" \\\"foo3\\\"| grep \\\"foo1 foo2\\\"'", KERNEL=="sda5", SYMLINK+="%c{2}" EOF @@ -364,7 +364,7 @@ EOF { desc => "characters before the %c{N} substitution", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "my-foo9" , + exp_name => "my-foo9", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda5", SYMLINK+="my-%c{7}" EOF @@ -372,7 +372,7 @@ EOF { desc => "substitute the second to last argument", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "my-foo8" , + exp_name => "my-foo8", rules => <<EOF SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda5", SYMLINK+="my-%c{6}" EOF @@ -396,7 +396,7 @@ EOF { desc => "test substitution by variable name 3", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "850:0:0:05" , + exp_name => "850:0:0:05", rules => <<EOF SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="%M%m%b%n" EOF @@ -404,7 +404,7 @@ EOF { desc => "test substitution by variable name 4", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "855" , + exp_name => "855", rules => <<EOF SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="\$major\$minor\$number" EOF @@ -412,7 +412,7 @@ EOF { desc => "test substitution by variable name 5", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "8550:0:0:0" , + exp_name => "8550:0:0:0", rules => <<EOF SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="\$major%m%n\$id" EOF @@ -429,7 +429,7 @@ EOF { desc => "non matching SUBSYSTEMS", devpath => "/devices/virtual/tty/console", - exp_name => "TTY" , + exp_name => "TTY", rules => <<EOF SUBSYSTEMS=="foo", ATTRS{dev}=="5:1", SYMLINK+="foo" KERNEL=="console", SYMLINK+="TTY" @@ -438,7 +438,7 @@ EOF { desc => "ATTRS match", devpath => "/devices/virtual/tty/console", - exp_name => "foo" , + exp_name => "foo", rules => <<EOF KERNEL=="console", SYMLINK+="TTY" ATTRS{dev}=="5:1", SYMLINK+="foo" @@ -447,7 +447,7 @@ EOF { desc => "ATTR (empty file)", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "empty" , + exp_name => "empty", rules => <<EOF KERNEL=="sda", ATTR{test_empty_file}=="?*", SYMLINK+="something" KERNEL=="sda", ATTR{test_empty_file}!="", SYMLINK+="not-empty" @@ -458,7 +458,7 @@ EOF { desc => "ATTR (non-existent file)", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "non-existent" , + exp_name => "non-existent", rules => <<EOF KERNEL=="sda", ATTR{nofile}=="?*", SYMLINK+="something" KERNEL=="sda", ATTR{nofile}!="", SYMLINK+="not-empty" @@ -471,7 +471,7 @@ EOF { desc => "program and bus type match", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0" , + exp_name => "scsi-0:0:0:0", rules => <<EOF SUBSYSTEMS=="usb", PROGRAM=="/bin/echo -n usb-%b", SYMLINK+="%c" SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n scsi-%b", SYMLINK+="%c" @@ -481,7 +481,7 @@ EOF { desc => "sysfs parent hierarchy", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , + exp_name => "modem", rules => <<EOF ATTRS{idProduct}=="007b", SYMLINK+="modem" EOF @@ -489,7 +489,7 @@ EOF { desc => "name test with ! in the name", devpath => "/devices/virtual/block/fake!blockdev0", - exp_name => "is/a/fake/blockdev0" , + exp_name => "is/a/fake/blockdev0", rules => <<EOF SUBSYSTEMS=="scsi", SYMLINK+="is/not/a/%k" SUBSYSTEM=="block", SYMLINK+="is/a/%k" @@ -499,7 +499,7 @@ EOF { desc => "name test with ! in the name, but no matching rule", devpath => "/devices/virtual/block/fake!blockdev0", - exp_name => "fake/blockdev0" , + exp_name => "fake/blockdev0", exp_rem_error => "yes", rules => <<EOF KERNEL=="ttyACM0", SYMLINK+="modem" @@ -542,7 +542,7 @@ EOF desc => "KERNELS wildcard partial 2", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", - rules => <<EOF + rules => <<EOF SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="before" SUBSYSTEMS=="scsi", KERNELS=="*:0:0:0", SYMLINK+="scsi-0:0:0:0" EOF @@ -739,7 +739,7 @@ EOF devpath => "/devices/virtual/misc/misc-fake1", exp_name => "node", exp_majorminor => "4095:1", - rules => <<EOF + rules => <<EOF KERNEL=="misc-fake1", SYMLINK+="node" EOF }, @@ -764,7 +764,7 @@ EOF desc => "multiple symlinks with a lot of s p a c e s", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "one", - not_exp_name => " ", + not_exp_name => " ", rules => <<EOF KERNEL=="ttyACM[0-9]*", SYMLINK=" one two " EOF @@ -860,7 +860,7 @@ EOF { desc => "multiple symlinks", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "second-0" , + exp_name => "second-0", rules => <<EOF KERNEL=="ttyACM0", SYMLINK="first-%n second-%n third-%n" EOF @@ -869,8 +869,8 @@ EOF desc => "symlink name '.'", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => ".", - exp_add_error => "yes", - exp_rem_error => "yes", + exp_add_error => "yes", + exp_rem_error => "yes", rules => <<EOF SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="." EOF @@ -879,9 +879,9 @@ EOF desc => "symlink node to itself", devpath => "/devices/virtual/tty/tty0", exp_name => "link", - exp_add_error => "yes", - exp_rem_error => "yes", - option => "clean", + exp_add_error => "yes", + exp_rem_error => "yes", + option => "clean", rules => <<EOF KERNEL=="tty0", SYMLINK+="tty0" EOF @@ -1437,7 +1437,7 @@ 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" , + not_exp_name => "bad", rules => <<EOF SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", TAG+="green" TAGS=="green", SYMLINK+="found" @@ -1456,7 +1456,7 @@ EOF desc => "continuations", 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" , + not_exp_name => "bad", rules => $rules_10k_tags_continuation . <<EOF TAGS=="test1", TAGS=="test500", TAGS=="test1234", TAGS=="test9999", TAGS=="test10000", SYMLINK+="bad" KERNEL=="sda",\\