]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bootconfig: Add bootconfig tests about braces
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Fri, 13 Mar 2026 04:18:55 +0000 (13:18 +0900)
committerMasami Hiramatsu (Google) <mhiramat@kernel.org>
Fri, 13 Mar 2026 08:49:30 +0000 (17:49 +0900)
Add more bootconfig tests for checking the error message of
non closing brace and max number of nested braces.

Link: https://lore.kernel.org/all/177337553551.416919.11217619471547711262.stgit@devnote2/
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
tools/bootconfig/samples/bad-non-closed-brace.bconf [new file with mode: 0644]
tools/bootconfig/samples/bad-over-max-brace.bconf [new file with mode: 0644]
tools/bootconfig/samples/exp-good-nested-brace.bconf [new file with mode: 0644]
tools/bootconfig/samples/good-nested-brace.bconf [new file with mode: 0644]
tools/bootconfig/test-bootconfig.sh

diff --git a/tools/bootconfig/samples/bad-non-closed-brace.bconf b/tools/bootconfig/samples/bad-non-closed-brace.bconf
new file mode 100644 (file)
index 0000000..6ed9f33
--- /dev/null
@@ -0,0 +1,4 @@
+foo {
+ bar {
+   buz
+ }
diff --git a/tools/bootconfig/samples/bad-over-max-brace.bconf b/tools/bootconfig/samples/bad-over-max-brace.bconf
new file mode 100644 (file)
index 0000000..74b5dc9
--- /dev/null
@@ -0,0 +1,19 @@
+key1 {
+key2 {
+key3 {
+key4 {
+key5 {
+key6 {
+key7 {
+key8 {
+key9 {
+key10 {
+key11 {
+key12 {
+key13 {
+key14 {
+key15 {
+key16 {
+key17 {
+}}}}}}}}}}}}}}}}}
+
diff --git a/tools/bootconfig/samples/exp-good-nested-brace.bconf b/tools/bootconfig/samples/exp-good-nested-brace.bconf
new file mode 100644 (file)
index 0000000..19e0f51
--- /dev/null
@@ -0,0 +1 @@
+key1.key2.key3.key4.key5.key6.key7.key8.key9.key10.key11.key12.key13.key14.key15.key16;
diff --git a/tools/bootconfig/samples/good-nested-brace.bconf b/tools/bootconfig/samples/good-nested-brace.bconf
new file mode 100644 (file)
index 0000000..980d094
--- /dev/null
@@ -0,0 +1,18 @@
+key1 {
+key2 {
+key3 {
+key4 {
+key5 {
+key6 {
+key7 {
+key8 {
+key9 {
+key10 {
+key11 {
+key12 {
+key13 {
+key14 {
+key15 {
+key16 {
+}}}}}}}}}}}}}}}}
+
index be9bd18b1d56211a19c31fedce116edd7f41b043..fc69f815ce4af0e2ce83a1d07afa61ce3a7e541a 100755 (executable)
@@ -171,6 +171,15 @@ $BOOTCONF $INITRD > $OUTFILE
 xfail grep -q 'val[[:space:]]' $OUTFILE
 xpass grep -q 'val2[[:space:]]' $OUTFILE
 
+echo "Showing correct line:column of no closing brace"
+cat > $TEMPCONF << EOF
+foo {
+bar {
+}
+EOF
+$BOOTCONF -a $TEMPCONF $INITRD 2> $OUTFILE
+xpass grep -q "1:1" $OUTFILE
+
 echo "=== expected failure cases ==="
 for i in samples/bad-* ; do
   xfail $BOOTCONF -a $i $INITRD