diff --git a/CMakeLists.txt b/CMakeLists.txt index 773a32a..ea94f16 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,10 +6,18 @@ project (LUPPP) set (Tutorial_VERSION_MAJOR 1) set (Tutorial_VERSION_MINOR 0) -#set(CMAKE_VERBOSE_MAKEFILE on) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +#option(BUILD_TESTS "Build test version" OFF) + +add_definitions( -DBUILD_TESTS ) +add_definitions( -DBUILD_COVERAGE_TEST ) + + +set(CMAKE_VERBOSE_MAKEFILE on) + +#set(CMAKE_FILES_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) add_subdirectory (src) diff --git a/run.sh b/run.sh index 395a1da..46d29fd 100755 --- a/run.sh +++ b/run.sh @@ -1,5 +1,4 @@ #!/bin/bash set -e -tup upd -xterm -e "sleep 1 && aj-snapshot -r .ajsnapshot" & build/luppp +xterm -e "sleep 1 && aj-snapshot -r .ajsnapshot" & bin/luppp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 920dd12..03969d5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,8 +18,17 @@ pkg_check_modules(SNDFILE sndfile) include_directories( ${SNDFILE_INCLUDE_DIRS} ) link_directories ( ${SNDFILE_LIBRARY_DIRS} ) +# Add flags +set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb") + +SET(GCC_COVERAGE_COMPILE_FLAGS "-fprofile-arcs -ftest-coverage") +SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}" ) + +#SET(GCC_COVERAGE_LINK_FLAGS "-lgcov") +#SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GCC_COVERAGE_LINK_FLAGS}" ) + # Add files -FILE(GLOB sources *.cxx avtk/*.cxx cjson/*.c controller/*.cxx dsp/*.cxx observer/*.cxx state/*.cxx) +FILE(GLOB sources *.cxx avtk/*.cxx cjson/*.c controller/*.cxx dsp/*.cxx observer/*.cxx state/*.cxx tests/*.cxx) add_executable (luppp ${sources} ) @@ -28,3 +37,5 @@ target_link_libraries( luppp ${JACK_LIBRARIES} ) target_link_libraries( luppp ${NTK_LIBRARIES} ) target_link_libraries( luppp ${CAIRO_LIBRARIES} ) target_link_libraries( luppp ${SNDFILE_LIBRARIES} ) + +target_link_libraries( luppp gcov) diff --git a/src/main.cxx b/src/main.cxx index 08c28b2..090ff7e 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -24,6 +24,17 @@ Jack* jack = 0; int main(int argc, char** argv) { + bool runTests = false; + bool stopAfterTest = false; + for(int i = 0; i < argc; i++) + { + if ( strcmp(argv[i], "-test" ) == 0 ) { + runTests = true; + } else if ( strcmp( argv[i], "-stopAfterTest") == 0 ) { + stopAfterTest = true; + } + } + // setup the environment AVOIDDENORMALS(); @@ -38,15 +49,21 @@ int main(int argc, char** argv) jack = new Jack(); #ifdef BUILD_TESTS - // test offline functionality - gui->getDiskWriter()->runTests(); - // test realtime functionality - jack->getGridLogic()->runTests(); - + if ( runTests ) + { + // test offline functionality + gui->getDiskWriter()->runTests(); + // test realtime functionality + jack->getGridLogic()->runTests(); + #ifdef BUILD_COVERAGE_TEST - LUPPP_NOTE("%s","Done testing, quitting!"); - return 0; + if ( stopAfterTest ) + { + LUPPP_NOTE("%s","Done testing, quitting!"); + return 0; + } #endif + } // FIXME: Reset the state of GUI / GridLogic here. Create a "new session"? #endif jack->activate(); diff --git a/src/tests/gridlogictests.cxx b/src/tests/gridlogictests.cxx index 9ef4e2f..e1b77fb 100644 --- a/src/tests/gridlogictests.cxx +++ b/src/tests/gridlogictests.cxx @@ -29,7 +29,7 @@ int GridLogic::runTests() jack->getGridLogic()->launchScene( s ); QUNIT_IS_TRUE( jack->getGridLogic()->getLaunchedScene() == s ); - /* + /// PAD STATE CHECKSfds // empty -> recording lc->init(); @@ -57,7 +57,7 @@ int GridLogic::runTests() QUNIT_IS_TRUE( lc->getState() == GridLogic::STATE_PLAY_QUEUED ); jack->getGridLogic()->bar(); QUNIT_IS_TRUE( lc->getState() == GridLogic::STATE_PLAYING ); - */ + return qunit.errors(); } diff --git a/test.sh b/test.sh index 9ae3813..5d6623a 100755 --- a/test.sh +++ b/test.sh @@ -16,6 +16,14 @@ #set -e +./bin/luppp -test -stopAfterTest + + + + +exit +##################################### + FILE=buildTest/build.success rm -f $(FILE)