tools/bootconfig: Add testcase for tailing space
authorMasami Hiramatsu <mhiramat@kernel.org>
Mon, 21 Sep 2020 09:45:11 +0000 (18:45 +0900)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 22 Sep 2020 01:57:12 +0000 (21:57 -0400)
Add testcases for removing/keeping tailing space
in the value.

Link: https://lkml.kernel.org/r/160068151151.1088739.3469541807296024227.stgit@devnote2
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
tools/bootconfig/test-bootconfig.sh

index 95eec768b503ad8a6ff5a82d2413979b7ce8ca31..d295e406a756ede11baae579189deca328636174 100755 (executable)
@@ -149,6 +149,19 @@ xpass $BOOTCONF -a $TEMPCONF $INITRD
 $BOOTCONF $INITRD > $OUTFILE
 xpass grep -q "bar" $OUTFILE
 
+
+echo "Remove/keep tailing spaces"
+cat > $TEMPCONF << EOF
+foo = val     # comment
+bar = "val2 " # comment
+EOF
+echo > $INITRD
+
+xpass $BOOTCONF -a $TEMPCONF $INITRD
+$BOOTCONF $INITRD > $OUTFILE
+xfail grep -q val[[:space:]] $OUTFILE
+xpass grep -q val2[[:space:]] $OUTFILE
+
 echo "=== expected failure cases ==="
 for i in samples/bad-* ; do
   xfail $BOOTCONF -a $i $INITRD