[pulseaudio-discuss] [PATCH] tests: make 'check' optional

rong deng dzrongg at gmail.com
Mon Aug 20 01:24:06 PDT 2012


ping.

2012/8/13 rong deng <dzrongg at gmail.com>:
> 2012/8/13 Deng Zhengrong <dzrongg at gmail.com>:
>> ---
>>  configure.ac    |   17 +++++++++++++++--
>>  src/Makefile.am |   14 ++++++++++++++
>>  2 files changed, 29 insertions(+), 2 deletions(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index ffb2a35..43ccf44 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -579,12 +579,23 @@ fi
>>
>>  AC_CHECK_HEADERS_ONCE([valgrind/memcheck.h])
>>
>> -#### check test framework ####
>> +#### check unit tests ####
>> +
>> +AC_ARG_ENABLE([tests],
>> +    AS_HELP_STRING([--disable-tests],[Disable unit tests]))
>> +
>> +AS_IF([test "x$enable_tests" != "xno"],
>> +    [PKG_CHECK_MODULES(LIBCHECK, [ check ], HAVE_LIBCHECK=1, HAVE_LIBCHECK=0)],
>> +    HAVE_LIBCHECK=0)
>>
>> -PKG_CHECK_MODULES(LIBCHECK, [ check ])
>>  AC_SUBST(LIBCHECK_CFLAGS)
>>  AC_SUBST(LIBCHECK_LIBS)
>>
>> +AS_IF([test "x$enable_tests" = "xyes" && test "x$HAVE_LIBCHECK" = "x0"],
>> +    [AC_MSG_ERROR([*** check library not found])])
>> +
>> +AM_CONDITIONAL([HAVE_TESTS], [test "x$HAVE_LIBCHECK" = x1])
>
> Note the above code that when HAVE_LIBCHECK is therer, HAVE_TESTS is
> 1, I don't want to use HAVE_TESTS in PKG_CHECK_MODULES() because I try
> to differentiate. and LIBCHECK_LIBS and LIBCHECK_CFLAGS are more clear
> than TESTS_LIBS and TESTS_CFLAGS.
>
>> +
>>  #### json parsing ####
>>
>>  PKG_CHECK_MODULES(LIBJSON, [ json >= 0.9 ])
>> @@ -1393,6 +1404,7 @@ AS_IF([test "x$HAVE_SIMPLEDB" = "x1"], ENABLE_SIMPLEDB=yes, ENABLE_SIMPLEDB=no)
>>  AS_IF([test "x$HAVE_ESOUND" = "x1"], ENABLE_ESOUND=yes, ENABLE_ESOUND=no)
>>  AS_IF([test "x$HAVE_ESOUND" = "x1" -a "x$USE_PER_USER_ESOUND_SOCKET" = "x1"], ENABLE_PER_USER_ESOUND_SOCKET=yes, ENABLE_PER_USER_ESOUND_SOCKET=no)
>>  AS_IF([test "x$HAVE_GCOV" = "x1"], ENABLE_GCOV=yes, ENABLE_GCOV=no)
>> +AS_IF([test "x$HAVE_LIBCHECK" = "x1"], ENABLE_TESTS=yes, ENABLE_TESTS=no)
>>  AS_IF([test "x$enable_legacy_database_entry_format" != "xno"], ENABLE_LEGACY_DATABASE_ENTRY_FORMAT=yes, ENABLE_LEGACY_DATABASE_ENTRY_FORMAT=no)
>>
>>  echo "
>> @@ -1440,6 +1452,7 @@ echo "
>>      Enable speex (resampler, AEC): ${ENABLE_SPEEX}
>>      Enable WebRTC echo canceller:  ${ENABLE_WEBRTC}
>>      Enable gcov coverage:          ${ENABLE_GCOV}
>> +    Enable unit tests:             ${ENABLE_TESTS}
>>      Database
>>        tdb:                         ${ENABLE_TDB}
>>        gdbm:                        ${ENABLE_GDBM}
>> diff --git a/src/Makefile.am b/src/Makefile.am
>> index 2f20df2..f7f8333 100644
>> --- a/src/Makefile.am
>> +++ b/src/Makefile.am
>> @@ -297,6 +297,7 @@ TESTS_norun += \
>>                 alsa-time-test
>>  endif
>>
>> +if HAVE_TESTS
>>  TESTS_ENVIRONMENT=MAKE_CHECK=1
>>  TESTS = $(TESTS_default)
>>
>> @@ -309,6 +310,19 @@ endif
>>  check-daemon: $(TESTS_daemon)
>>         PATH=$(builddir):${PATH} $(top_srcdir)/src/tests/test-daemon.sh $(TESTS_daemon)
>>
>> +else
>> +TESTS_ENVIRONMENT=
>> +TESTS =
>> +noinst_PROGRAMS =
>> +check_PROGRAMS =
>> +
>> +check-daemon:
>> +       @echo "Tests are disabled!"
>> +       @echo "Pass option \"--enable-tests\" to configure and install \"check\" library properly!"
>> +       false
>> +
>> +endif
>> +
>>  mainloop_test_SOURCES = tests/mainloop-test.c
>>  mainloop_test_CFLAGS = $(AM_CFLAGS) $(LIBCHECK_CFLAGS)
>>  mainloop_test_LDADD = $(AM_LDADD) libpulse.la libpulsecommon- at PA_MAJORMINOR@.la
>> --
>> 1.7.7.6
>>


More information about the pulseaudio-discuss mailing list