[patch] testsuite/testing.sh: removes obvious bashisms

Denys Vlasenko vda.linux at googlemail.com
Fri May 2 21:45:58 UTC 2008


On Friday 02 May 2008 16:26, Cristian Ionescu-Idbohrn wrote:
> > > > I don't have any problems with it. I just know that new-style
> > > Could you give an RL example?
> >
> > testsuite/pidof.tests
> 
> Thanks.  I was afraid but I didn't know why :)  What about:
> 
> -#testing "pidof -o %PPID" "pidof -o %PPID pidof.tests | grep -o -w $$" "" "" ""
> -testing "pidof -o %PPID NOP" "pidof -o %PPID -s init" "1\n" "" ""
> +#testing "pidof -o \045PPID" "pidof -o \045PPID pidof.tests | grep -o -w $$" "" "" ""
> +testing "pidof -o \045PPID NOP" "pidof -o \045PPID -s init" "1\n" "" ""
> 
> Is it too quirky (there's already one escaped sequence in there)?

You are proposing that starting from now test writers
should _also_ worry about having accidental %format
string in their strings escaped.

> > testsuite/uuencode.tests
> 
> Same here:
> 
> -"begin 644 bb_uuenc_test.out\nM5&AE(&9A<W0 at 9W)E>2!F;W@@:G5M<&5D(&]V97(@=&AE(&QA>GD at 8G)O=VX@\n%9&]G+ at H\`\n\`\nend\n" \
> +"begin 644 bb_uuenc_test.out\nM5&AE(&9A<W0 at 9W)E>2!F;W@@:G5M<&5D(&]V97(@=&AE(&QA>GD at 8G)O=VX@\n\0459&]G+ at H\`\n\`\nend\n" \
> 
> Wouldn't that work with printf?

Technically, yes. But I'd rather use this:

 export FAILCOUNT=0
 export SKIP=

+# Helper for helpers. Oh my...
+test x"$ECHO" = x"" && {
+       export ECHO="echo"
+       test x"`echo -ne`" = x"" || {
+               # Compile and use a replacement 'echo' which understands -e -n
+               ECHO="$PWD/echo-ne"
+               test -x "$ECHO" || {
+                       gcc -Os -o "$ECHO" ../scripts/echo.c || exit 1
+               }
+       }
+}
+
 # Helper functions

 optional()

Please check current svn - is it ok now?
--
vda



More information about the busybox mailing list