daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
bd1529
From ac0def8fb2b51a17b7ef256c5c0edf786fffff2a Mon Sep 17 00:00:00 2001
bd1529
From: Yu Watanabe <watanabe.yu+github@gmail.com>
bd1529
Date: Thu, 21 Feb 2019 18:03:32 +0900
bd1529
Subject: [PATCH] test-udev: add more tests for line continuation
bd1529
bd1529
(cherry picked from commit 84a0819c9d89a2ddb195a5d975ae1fd5c62fde3c)
bd1529
bd1529
Related: #1642728
bd1529
---
bd1529
 test/udev-test.pl | 34 ++++++++++++++++++++++++++++++++++
bd1529
 1 file changed, 34 insertions(+)
bd1529
bd1529
diff --git a/test/udev-test.pl b/test/udev-test.pl
bd1529
index a5e1f8cda3..002fabd9fd 100755
bd1529
--- a/test/udev-test.pl
bd1529
+++ b/test/udev-test.pl
bd1529
@@ -1466,8 +1466,42 @@ TAG+="hoge1",\\
bd1529
 TAG+="hoge2",\\
bd1529
 # spaces before and after token are dropped
bd1529
   TAG+="hoge3",   \\
bd1529
+\\
bd1529
+ \\
bd1529
 TAG+="hoge4"
bd1529
 TAGS=="hoge1", TAGS=="hoge2", TAGS=="hoge3", TAGS=="hoge4", SYMLINK+="found"
bd1529
+EOF
bd1529
+        },
bd1529
+        {
bd1529
+                desc            => "continuations with empty line",
bd1529
+                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
+                exp_name        => "found",
bd1529
+                not_exp_name    => "bad",
bd1529
+                rules           => <
bd1529
+# empty line finishes continuation
bd1529
+KERNEL=="sda", TAG+="foo" \\
bd1529
+
bd1529
+KERNEL=="sdb", TAG+="hoge"
bd1529
+KERNEL=="sda", TAG+="aaa" \\
bd1529
+KERNEL=="sdb", TAG+="bbb"
bd1529
+TAGS=="foo", SYMLINK+="found"
bd1529
+TAGS=="aaa", SYMLINK+="bad"
bd1529
+EOF
bd1529
+        },
bd1529
+        {
bd1529
+                desc            => "continuations with white only line",
bd1529
+                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
+                exp_name        => "found",
bd1529
+                not_exp_name    => "bad",
bd1529
+                rules           => <
bd1529
+# space only line finishes continuation
bd1529
+KERNEL=="sda", TAG+="foo" \\
bd1529
+   \t
bd1529
+KERNEL=="sdb", TAG+="hoge"
bd1529
+KERNEL=="sda", TAG+="aaa" \\
bd1529
+KERNEL=="sdb", TAG+="bbb"
bd1529
+TAGS=="foo", SYMLINK+="found"
bd1529
+TAGS=="aaa", SYMLINK+="bad"
bd1529
 EOF
bd1529
         },
bd1529
 );