richardphibel / rpms / systemd

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