From 924406cf78a9ea356b09c6fef2e6c86b72c72be6 Mon Sep 17 00:00:00 2001 From: kpl Date: Sat, 31 Oct 2020 14:13:15 -0400 Subject: [PATCH] Updates for Pine64. Added all tests to cfg/main.cfg. --- Makefile.am | 18 ++++++++++-------- build/linux/debug/build.sh | 2 +- configure.ac | 14 +++++++------- src/cwtest/cfg/main.cfg | 30 +++++++++++++++++++++++++++++- src/cwtest/main.cpp | 14 ++++++++++---- 5 files changed, 57 insertions(+), 21 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9e7bba1..6029463 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,15 +17,15 @@ include_HEADERS = WS_DIR = $(HOME)/sdk/libwebsockets/build/out -AM_CPPFLAGS = -D _GNU_SOURCE -I.. -I$(srcdir)/src/libcw +AM_CPPFLAGS = -I.. -I$(srcdir)/src/libcw AM_CFLAGS = -Wno-multichar AM_CXXFLAGS = -Wno-multichar AM_LDFLAGS = # debug/release switches if DEBUG - AM_CFLAGS += -g - AM_CXXFLAGS += -g -Wall + AM_CFLAGS += -g + AM_CXXFLAGS += -g -Wall -fsanitize=undefined else AM_CFLAGS += -O3 AM_CXXFLAGS += -O3 @@ -62,16 +62,18 @@ endif include src/libcw/Makefile.am -libcw_la_SOURCES = $(libcwSRC) $(libcwHDR) -lib_LTLIBRARIES += libcw.la -include_HEADERS += $(libcwHDR) +#libcw_la_SOURCES = $(libcwSRC) $(libcwHDR) +#lib_LTLIBRARIES += libcw.la +#include_HEADERS += $(libcwHDR) -src_cwtest_cwtest_SOURCES = src/cwtest/main.cpp +src_cwtest_cwtest_SOURCES = $(libcwHDR) $(libcwSRC) src/cwtest/main.cpp # 1) autoconfig manual recommends setting direct referenes to non-3rd party libraries rather than using -L and -l # 2) -ldl is required for dlopen(),dlclose() ... -src_cwtest_cwtest_LDADD = libcw.la -lpthread -ldl +# src_cwtest_cwtest_LDADD = libcw.la -lpthread -ldl + +src_cwtest_cwtest_LDADD = -lpthread -ldl if cwFFTW src_cwtest_cwtest_LDADD += -lfftw3 -lfftw3f diff --git a/build/linux/debug/build.sh b/build/linux/debug/build.sh index 74c8774..480f096 100755 --- a/build/linux/debug/build.sh +++ b/build/linux/debug/build.sh @@ -15,7 +15,7 @@ cd ${curdir} # To enable websock: --enable-websock \ # To enable alsa: --enable-alsa \ -../../../configure --prefix=${curdir} --enable-debug --enable-alsa \ +../../../configure --prefix=${curdir} --enable-debug --enable-websock --enable-alsa \ CFLAGS="-g -Wall" \ CXXFLAGS="-g -Wall" \ CPPFLAGS="-I${HOME}/sdk/libwebsockets/build/out/include" \ diff --git a/configure.ac b/configure.ac index 189b6e5..a4036bb 100644 --- a/configure.ac +++ b/configure.ac @@ -5,9 +5,9 @@ AC_COPYRIGHT([Copyright (C) 2019-2020 Kevin Larke]) AC_INIT([cwtest],[1.0],[cwtest@larke.org]) +AC_CONFIG_SRCDIR([src/cwtest/main.cpp]) AC_CONFIG_AUX_DIR([build-aux]) # put aux files in build-aux AM_INIT_AUTOMAKE([1.9 -Wall foreign subdir-objects]) # subdir-objects needed for non-recursive make -AC_CONFIG_SRCDIR([src/cwtest/main.cpp]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIRS([m4]) @@ -61,8 +61,8 @@ AX_FUNC_OS_TYPE AX_FUNC_OS_64 # ac_cv_os_type is set by AX_FUNC_OS_TYPE -AM_CONDITIONAL([OS_LINUX],[test x"${ax_cv_os_type}" = xLinux]) -AM_CONDITIONAL([OS_OSX],[test x"${ax_cv_os_type}" = xDarwin]) +AM_CONDITIONAL([OS_LINUX],[test x"${ax_cv_os_type}" == xLinux]) +AM_CONDITIONAL([OS_OSX],[test x"${ax_cv_os_type}" == xDarwin]) echo "OS='${ax_cv_os_type}'" AM_CONDITIONAL([OS_64],[test x"${ax_cv_os_64}" == xx86_64]) @@ -82,7 +82,7 @@ AC_ARG_ENABLE([debug], echo "debug=${debug}" -AM_CONDITIONAL([DEBUG], [test x$debug = xtrue]) +AM_CONDITIONAL([DEBUG], [test x$debug == xtrue]) if test x$debug = xfalse; then AC_DEFINE([NDEBUG], 1,[Debugging off.]) @@ -103,7 +103,7 @@ if test x"$websock" = xtrue; then AC_CHECK_LIB([websockets],[lws_get_library_version],[AC_MSG_RESULT([The 'websockets' library was found.])],[AC_MSG_ERROR([The 'websockets' library was not found.])]) AC_DEFINE([cwWEBSOCK], 1,[Use libwebsock.]) fi -AM_CONDITIONAL([cwWEBSOCK], [test x$websock = xtrue]) +AM_CONDITIONAL([cwWEBSOCK], [test x$websock == xtrue]) echo "websock=${websock}" @@ -124,7 +124,7 @@ AC_CHECK_LIB([asound],[snd_asoundlib_version],[AC_MSG_RESULT([The 'ALSA' library AC_DEFINE([cwALSA], 1,[Use libalsa.]) fi -AM_CONDITIONAL([cwALSA], [test x$alsa = xtrue]) +AM_CONDITIONAL([cwALSA], [test x$alsa == xtrue]) echo "alsa=${alsa}" @@ -165,7 +165,7 @@ if test x"$web" = xtrue; then AC_DEFINE([cwWEB], 1,[Use libweb.]) fi -AM_CONDITIONAL([cwWEB], [test x$web = xtrue]) +AM_CONDITIONAL([cwWEB], [test x$web == xtrue]) echo "web=${web}" diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index 7293f4f..cbbdba0 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -20,7 +20,35 @@ numbCvt: {}, object: {}, time:{}, - threadTest: {}, + thread: {}, + spscBuf: {}, + spscQueueTmpl: {}, + + websockSrv: { + physRootDir: "~/src/cwtest/src/libcw/html/websockSrvTest", + dfltHtmlPageFn: "test_websocket.html", + }, + + serialSrv: {}, + midiDevice: {}, + textBuf: {}, + audioBuf: {}, + audioDev: {}, + audioDevAlsa: {}, + audioDevRpt: {}, + + socket: {}, + socketTcp: {}, + socketSrvUdp: {}, + socketSrvTcp: {}, + sockMgrTest: {}, + uiTest: {}, + socketMdns: {}, + dnssd: {}, + eucon: {}, + dirEntry: {}, + io: {}, + mtx: { diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index 0d81a9e..470b653 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -358,14 +358,20 @@ cw::rc_t dnsSdTest( const cw::object_t* cfg, const cw::object_t* args cw::rc_t euConTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::eucon::test(); } #if defined(cwWEBSOCK) -cw::rc_t websockSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::websockSrvTest(); } -cw::rc_t ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::io::test(); } +cw::rc_t websockSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::websockSrvTest(cfg); } cw::rc_t uiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::ui::test(); } +#if defined(cwALSA) +cw::rc_t ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::io::test(); } +#else +cw::rc_t _no_alsa_websock() { return cwLogError(cw::kResourceNotAvailableRC,"Websock or ALSA functionality not included in this build."); } +cw::rc_t ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_alsa_websock(); } + +#endif #else cw::rc_t _no_websock() { return cwLogError(cw::kResourceNotAvailableRC,"Websocket functionality not included in this build."); } cw::rc_t websockSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_websock(); } -cw::rc_t ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_websock(); } cw::rc_t uiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_websock(); } +cw::rc_t ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_websock(); } #endif @@ -697,9 +703,9 @@ int main( int argc, const char* argv[] ) const char* cfgFn = argc > 1 ? argv[1] : nullptr; const char* mode = argc > 2 ? argv[2] : nullptr; - cw::log::createGlobal(); + // if valid command line args were given and the cfg file was successfully read if( cfgFn != nullptr && mode != nullptr && objectFromFile( cfgFn, cfg ) == cw::kOkRC ) {