21255d
From 527d43064a93fae9a4490e5d152b120e91f5eade Mon Sep 17 00:00:00 2001
21255d
From: Yu Watanabe <watanabe.yu+github@gmail.com>
21255d
Date: Mon, 18 Feb 2019 10:38:29 +0900
21255d
Subject: [PATCH] test-udev: add a testcase of too long line
21255d
21255d
(cherry picked from commit 1e797cf596df50a6bdd8cbf8e9b2467a3a934171)
21255d
21255d
Related: #1642728
21255d
---
21255d
 test/udev-test.pl | 15 +++++++++++++++
21255d
 1 file changed, 15 insertions(+)
21255d
21255d
diff --git a/test/udev-test.pl b/test/udev-test.pl
21255d
index 957cda541c..3a50694fa9 100755
21255d
--- a/test/udev-test.pl
21255d
+++ b/test/udev-test.pl
21255d
@@ -39,6 +39,11 @@ for (my $i = 1; $i <= 10000; ++$i) {
21255d
         $rules_10k_tags .= 'KERNEL=="sda", TAG+="test' . $i . "\"\n";
21255d
 }
21255d
 
21255d
+my $rules_10k_tags_continuation = "";
21255d
+for (my $i = 1; $i <= 10000; ++$i) {
21255d
+        $rules_10k_tags_continuation .= 'KERNEL=="sda", TAG+="test' . $i . "\"\\\n";
21255d
+}
21255d
+
21255d
 my @tests = (
21255d
         {
21255d
                 desc            => "no rules",
21255d
@@ -1444,6 +1449,16 @@ EOF
21255d
                 exp_name        => "found",
21255d
                 rules           => $rules_10k_tags . <
21255d
 TAGS=="test1", TAGS=="test500", TAGS=="test1234", TAGS=="test9999", TAGS=="test10000", SYMLINK+="found"
21255d
+EOF
21255d
+        },
21255d
+        {
21255d
+                desc            => "don't crash with lots of tags with continuation",
21255d
+                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
21255d
+                exp_name        => "found",
21255d
+                not_exp_name    => "bad" ,
21255d
+                rules           => $rules_10k_tags_continuation . <
21255d
+TAGS=="test1", TAGS=="test500", TAGS=="test1234", TAGS=="test9999", TAGS=="test10000", SYMLINK+="bad"
21255d
+KERNEL=="sda", SYMLINK+="found"
21255d
 EOF
21255d
         },
21255d
 );