Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/bootconfig: Replace some echo with printf for more portability

Since echo is not portable, use printf instead. This fixes a wrong
test result formatting in some environment. (showing "\t\t[OK]")
Also this uses printf command for generating test data instead of
echo.

Link: https://lore.kernel.org/all/175211424942.2591046.5439447789303314213.stgit@mhiramat.tok.corp.google.com/

Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

+10 -10
+10 -10
tools/bootconfig/test-bootconfig.sh
··· 27 27 28 28 xpass() { # pass test command 29 29 echo "test case $NO ($*)... " 30 - if ! ($@ && echo "\t\t[OK]"); then 31 - echo "\t\t[NG]"; NG=$((NG + 1)) 30 + if ! ($@ && printf "\t\t[OK]\n"); then 31 + printf "\t\t[NG]\n"; NG=$((NG + 1)) 32 32 fi 33 33 NO=$((NO + 1)) 34 34 } 35 35 36 36 xfail() { # fail test command 37 37 echo "test case $NO ($*)... " 38 - if ! (! $@ && echo "\t\t[OK]"); then 39 - echo "\t\t[NG]"; NG=$((NG + 1)) 38 + if ! (! $@ && printf "\t\t[OK]\n"); then 39 + printf "\t\t[NG]\n"; NG=$((NG + 1)) 40 40 fi 41 41 NO=$((NO + 1)) 42 42 } ··· 48 48 xpass $BOOTCONF -d $INITRD 49 49 50 50 dd if=/dev/zero of=$INITRD bs=4096 count=1 51 - echo "key = value;" > $TEMPCONF 51 + printf "key = value;" > $TEMPCONF 52 52 bconf_size=$(wc -c < $TEMPCONF) 53 53 initrd_size=$(wc -c < $INITRD) 54 54 ··· 97 97 ' > $TEMPCONF 98 98 xpass $BOOTCONF -a $TEMPCONF $INITRD 99 99 100 - echo "badnode" >> $TEMPCONF 100 + printf "badnode\n" >> $TEMPCONF 101 101 xfail $BOOTCONF -a $TEMPCONF $INITRD 102 102 103 103 echo "Max filesize check" 104 104 105 105 # Max size is 32767 (including terminal byte) 106 - echo -n "data = \"" > $TEMPCONF 106 + printf "data = \"" > $TEMPCONF 107 107 dd if=/dev/urandom bs=768 count=32 | base64 -w0 >> $TEMPCONF 108 - echo "\"" >> $TEMPCONF 108 + printf "\"\n" >> $TEMPCONF 109 109 xfail $BOOTCONF -a $TEMPCONF $INITRD 110 110 111 111 dd if=$TEMPCONF of=$OUTFILE bs=1 count=32764 112 112 cp $OUTFILE $TEMPCONF 113 - echo "\"" >> $TEMPCONF # add 2 bytes + terminal ('\"\n\0') 113 + printf "\"\n" >> $TEMPCONF # add 2 bytes + terminal ('\"\n\0') 114 114 xpass $BOOTCONF -a $TEMPCONF $INITRD 115 115 116 116 echo "Adding same-key values" ··· 140 140 xpass grep -q "qux" $OUTFILE 141 141 142 142 echo "Double/single quotes test" 143 - echo "key = '\"string\"';" > $TEMPCONF 143 + printf "key = '\"string\"';" > $TEMPCONF 144 144 $BOOTCONF -a $TEMPCONF $INITRD 145 145 $BOOTCONF $INITRD > $TEMPCONF 146 146 cat $TEMPCONF