Menu

#433 Non-portable "echo" in self-tests

1.3.0
closed-fixed
Erik
None
5
2015-10-03
2015-09-22
No

Building flac-1.3.1 on OS X 10.10, there is a lot of weird output during the self-test. The standard pattern is for example:

FLACTEST_LEVEL=2 FLACTEST_WITH_VALGRIND=no ./test_streams.sh
Generating streams...
Testing noise through pipes...
-n noise: encode via pipes...
-n decode via pipes...
-n compare...
OK

All those "-n" is because "echo -n" doesn't behave the way you want when used they way you use it. During ./configure there already is a test that determines the portable way to get echo supress its newline. Some platforms want 'echo -n ...' while others want 'echo ... \c', and the correct tokes are stored in ECHO_N and ECHO_T makefile variables. So just need to propagate the results to the test-suite scripts. Here are two one-liners to apply the necessary patches:

# propagate the autoconf tokens to the test scripts
perl -pi -e 's/(TESTS_ENVIRONMENT\s+=.*)/\1 ECHO_N="\@ECHO_N\@" ECHO_C="\@ECHO_C\@"/' test/Makefile.am
# convert the scripts to use the autoconf tokens
perl -pi -e 's/echo\s+-n\s+(".*")/echo \$ECHO_N \1 \$ECHO_C/' test/*.sh

Discussion

  • Erik

    Erik - 2015-10-03
    • status: open --> closed-fixed
    • assigned_to: Erik
     
  • Erik

    Erik - 2015-10-03

    Fixed in git.

     

Log in to post a comment.