teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame SOURCES/0516-test-udev-add-a-testcase-of-too-long-line.patch

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