]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-udev: add a testcase of too long line
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 18 Feb 2019 01:38:29 +0000 (10:38 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 18 Feb 2019 03:22:54 +0000 (12:22 +0900)
test/udev-test.pl

index 957cda541cc32a1653027b6e3d9e22141f8ab3c4..3a50694fa9b2aa5fc6381693db3fe8150c570eec 100755 (executable)
@@ -39,6 +39,11 @@ for (my $i = 1; $i <= 10000; ++$i) {
         $rules_10k_tags .= 'KERNEL=="sda", TAG+="test' . $i . "\"\n";
 }
 
+my $rules_10k_tags_continuation = "";
+for (my $i = 1; $i <= 10000; ++$i) {
+        $rules_10k_tags_continuation .= 'KERNEL=="sda", TAG+="test' . $i . "\"\\\n";
+}
+
 my @tests = (
         {
                 desc            => "no rules",
@@ -1444,6 +1449,16 @@ EOF
                 exp_name        => "found",
                 rules           => $rules_10k_tags . <<EOF
 TAGS=="test1", TAGS=="test500", TAGS=="test1234", TAGS=="test9999", TAGS=="test10000", SYMLINK+="found"
+EOF
+        },
+        {
+                desc            => "don't crash with lots of tags with continuation",
+                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" ,
+                rules           => $rules_10k_tags_continuation . <<EOF
+TAGS=="test1", TAGS=="test500", TAGS=="test1234", TAGS=="test9999", TAGS=="test10000", SYMLINK+="bad"
+KERNEL=="sda", SYMLINK+="found"
 EOF
         },
 );