| @@ -83,11 +83,12 @@ source/frontend/Makefile | |||||
| source/tests/ansi-pedantic-test_* | source/tests/ansi-pedantic-test_* | ||||
| source/tests/CarlaString | source/tests/CarlaString | ||||
| source/tests/CarlaUtils | source/tests/CarlaUtils | ||||
| source/tests/Exceptions | |||||
| source/tests/Print | |||||
| source/tests/RDF | source/tests/RDF | ||||
| source/tests/EngineEvents | source/tests/EngineEvents | ||||
| source/tests/PipeServer | source/tests/PipeServer | ||||
| source/tests/Print | |||||
| source/tests/RtLinkedList | source/tests/RtLinkedList | ||||
| source/tests/RtLinkedListGnu | source/tests/RtLinkedListGnu | ||||
| @@ -237,7 +237,7 @@ int main() | |||||
| assert(str5.rfind("haha!", &found) == str5.length()); | assert(str5.rfind("haha!", &found) == str5.length()); | ||||
| assert(! found); | assert(! found); | ||||
| printf("FINAL: \"%s\"\n", str5.buffer()); | |||||
| carla_stdout("FINAL: \"%s\"", str5.buffer()); | |||||
| // clear | // clear | ||||
| str.clear(); | str.clear(); | ||||
| @@ -1,5 +1,5 @@ | |||||
| /* | /* | ||||
| * Carla Tests | |||||
| * Carla Exception Tests | |||||
| * Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com> | * Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com> | ||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| @@ -18,6 +18,8 @@ | |||||
| #include "CarlaDefines.h" | #include "CarlaDefines.h" | ||||
| #include "CarlaUtils.hpp" | #include "CarlaUtils.hpp" | ||||
| // ----------------------------------------------------------------------- | |||||
| struct Struct1 { | struct Struct1 { | ||||
| Struct1() noexcept {} | Struct1() noexcept {} | ||||
| ~Struct1() noexcept {} | ~Struct1() noexcept {} | ||||
| @@ -31,33 +33,42 @@ struct Struct1 { | |||||
| struct Struct2 { | struct Struct2 { | ||||
| Struct2() { throw 2; } | Struct2() { throw 2; } | ||||
| ~Struct2() noexcept {} | ~Struct2() noexcept {} | ||||
| void throwHere() | |||||
| { | |||||
| throw 3; | |||||
| } | |||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | |||||
| int main() | int main() | ||||
| { | { | ||||
| carla_safe_assert("test here", __FILE__, __LINE__); | carla_safe_assert("test here", __FILE__, __LINE__); | ||||
| Struct1 a; | Struct1 a; | ||||
| Struct2* b = nullptr; | |||||
| Struct1* b; | |||||
| Struct2* c = nullptr; | |||||
| try { | try { | ||||
| a.throwHere(); | a.throwHere(); | ||||
| } CARLA_SAFE_EXCEPTION("Struct1 throw", carla_stdout("after text1 here");) | |||||
| } CARLA_SAFE_EXCEPTION("Struct1 a throw"); | |||||
| try { | try { | ||||
| b = new Struct2; | |||||
| } CARLA_SAFE_EXCEPTION("Struct2 throw", carla_stdout("after text2 here");) | |||||
| b = new Struct1; | |||||
| } CARLA_SAFE_EXCEPTION("Struct1 b throw constructor"); | |||||
| if (b != nullptr) | |||||
| { | |||||
| delete b; | |||||
| b = nullptr; | |||||
| } | |||||
| assert(b != nullptr); | |||||
| try { | |||||
| b->throwHere(); | |||||
| } CARLA_SAFE_EXCEPTION("Struct1 b throw runtime"); | |||||
| delete b; | |||||
| b = nullptr; | |||||
| try { | |||||
| c = new Struct2; | |||||
| } CARLA_SAFE_EXCEPTION("Struct2 c throw"); | |||||
| assert(c == nullptr); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| // ----------------------------------------------------------------------- | |||||
| @@ -40,10 +40,10 @@ endif | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| TARGETS = ansi-pedantic-test_c ansi-pedantic-test_c99 | TARGETS = ansi-pedantic-test_c ansi-pedantic-test_c99 | ||||
| TARGETS += CarlaString CarlaUtils RDF | |||||
| TARGETS += CarlaString CarlaUtils Exceptions Print RDF | |||||
| # ansi-pedantic-test_cxx ansi-pedantic-test_cxx11 | # ansi-pedantic-test_cxx ansi-pedantic-test_cxx11 | ||||
| # TARGETS += EngineEvents PipeServer Print RtLinkedList RtLinkedListGnu Utils | |||||
| # TARGETS += EngineEvents PipeServer RtLinkedList RtLinkedListGnu | |||||
| all: $(TARGETS) | all: $(TARGETS) | ||||
| @@ -73,6 +73,14 @@ CarlaUtils: CarlaUtils.cpp ../utils/*.hpp | |||||
| $(shell pkg-config --cflags --libs QtCore) -isystem /usr/include/qt4 | $(shell pkg-config --cflags --libs QtCore) -isystem /usr/include/qt4 | ||||
| valgrind --leak-check=full ./$@ | valgrind --leak-check=full ./$@ | ||||
| Exceptions: Exceptions.cpp | |||||
| $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ | |||||
| valgrind --leak-check=full ./$@ | |||||
| Print: Print.cpp ../utils/CarlaUtils.hpp | |||||
| $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ | |||||
| valgrind --leak-check=full ./$@ | |||||
| RDF: RDF.cpp ../modules/ladspa_rdf.hpp ../modules/lv2_rdf.hpp | RDF: RDF.cpp ../modules/ladspa_rdf.hpp ../modules/lv2_rdf.hpp | ||||
| $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ | $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ | ||||
| valgrind --leak-check=full ./$@ | valgrind --leak-check=full ./$@ | ||||
| @@ -81,7 +89,7 @@ RDF: RDF.cpp ../modules/ladspa_rdf.hpp ../modules/lv2_rdf.hpp | |||||
| ChildProcess: ChildProcess.cpp | ChildProcess: ChildProcess.cpp | ||||
| $(CXX) $< $(PEDANTIC_CXX_FLAGS) ../modules/juce_core.a -ldl -lpthread -lrt -o $@ | $(CXX) $< $(PEDANTIC_CXX_FLAGS) ../modules/juce_core.a -ldl -lpthread -lrt -o $@ | ||||
| # valgrind --leak-check=full ./$@ | |||||
| valgrind --leak-check=full ./$@ | |||||
| CarlaMutex: CarlaMutex.cpp ../utils/CarlaMutex.hpp | CarlaMutex: CarlaMutex.cpp ../utils/CarlaMutex.hpp | ||||
| $(CXX) $< -lpthread -o $@ | $(CXX) $< -lpthread -o $@ | ||||
| @@ -98,29 +106,21 @@ Engine: Engine.cpp | |||||
| env LD_LIBRARY_PATH=../backend valgrind --leak-check=full ./$@ | env LD_LIBRARY_PATH=../backend valgrind --leak-check=full ./$@ | ||||
| # ../modules/juce_audio_basics.a ../modules/juce_core.a \ | # ../modules/juce_audio_basics.a ../modules/juce_core.a \ | ||||
| Exception: Exception.cpp | |||||
| $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ | |||||
| # valgrind ./$@ | |||||
| EngineEvents: EngineEvents.cpp | EngineEvents: EngineEvents.cpp | ||||
| $(CXX) $< $(PEDANTIC_CXX_FLAGS) -L../backend -lcarla_standalone2 -o $@ | $(CXX) $< $(PEDANTIC_CXX_FLAGS) -L../backend -lcarla_standalone2 -o $@ | ||||
| env LD_LIBRARY_PATH=../backend valgrind ./$@ | env LD_LIBRARY_PATH=../backend valgrind ./$@ | ||||
| PipeServer: PipeServer.cpp ../utils/CarlaPipeUtils.hpp | PipeServer: PipeServer.cpp ../utils/CarlaPipeUtils.hpp | ||||
| $(CXX) $< $(PEDANTIC_CXX_FLAGS) -lpthread -o $@ | $(CXX) $< $(PEDANTIC_CXX_FLAGS) -lpthread -o $@ | ||||
| # valgrind ./$@ | |||||
| Print: Print.cpp ../utils/CarlaUtils.hpp | |||||
| $(CXX) $< $(PEDANTIC_CXX_FLAGS) -o $@ | |||||
| valgrind ./$@ | |||||
| valgrind --leak-check=full ./$@ | |||||
| RtLinkedList: RtLinkedList.cpp ../utils/LinkedList.hpp ../utils/RtLinkedList.hpp ../modules/rtmempool.a | RtLinkedList: RtLinkedList.cpp ../utils/LinkedList.hpp ../utils/RtLinkedList.hpp ../modules/rtmempool.a | ||||
| $(CXX) $< ../modules/rtmempool.a $(PEDANTIC_CXX_FLAGS) -lpthread -o $@ | $(CXX) $< ../modules/rtmempool.a $(PEDANTIC_CXX_FLAGS) -lpthread -o $@ | ||||
| valgrind ./$@ | |||||
| valgrind --leak-check=full ./$@ | |||||
| RtLinkedListGnu: RtLinkedList.cpp ../utils/LinkedList.hpp ../utils/RtLinkedList.hpp ../modules/rtmempool.a | RtLinkedListGnu: RtLinkedList.cpp ../utils/LinkedList.hpp ../utils/RtLinkedList.hpp ../modules/rtmempool.a | ||||
| $(CXX) $< ../modules/rtmempool.a $(GNU_CXX_FLAGS) -lpthread -o $@ | $(CXX) $< ../modules/rtmempool.a $(GNU_CXX_FLAGS) -lpthread -o $@ | ||||
| valgrind ./$@ | |||||
| valgrind --leak-check=full ./$@ | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| @@ -132,11 +132,6 @@ Rewire.cpp.o: Rewire.cpp | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| ../modules/%.a: | |||||
| $(MAKE) -C ../modules $* | |||||
| # -------------------------------------------------------------- | |||||
| clean: | clean: | ||||
| rm -f *.o $(TARGETS) | rm -f *.o $(TARGETS) | ||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * Carla Tests | |||||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||||
| * Carla Print Tests | |||||
| * Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -17,6 +17,8 @@ | |||||
| #include "CarlaUtils.hpp" | #include "CarlaUtils.hpp" | ||||
| // ----------------------------------------------------------------------- | |||||
| int main() | int main() | ||||
| { | { | ||||
| carla_debug("DEBUG"); | carla_debug("DEBUG"); | ||||
| @@ -25,3 +27,5 @@ int main() | |||||
| carla_stderr2("STDERR2"); | carla_stderr2("STDERR2"); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| // ----------------------------------------------------------------------- | |||||
| @@ -1,6 +1,6 @@ | |||||
| /* | /* | ||||
| * Carla Tests | * Carla Tests | ||||
| * Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||||
| * Copyright (C) 2013-2014 Filipe Coelho <falktx@falktx.com> | |||||
| * | * | ||||
| * This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
| * modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
| @@ -68,7 +68,7 @@ struct PostRtEvents { | |||||
| { | { | ||||
| if (mutex.tryLock()) | if (mutex.tryLock()) | ||||
| { | { | ||||
| dataPendingRT.spliceAppend(data); | |||||
| dataPendingRT.spliceAppendTo(data); | |||||
| mutex.unlock(); | mutex.unlock(); | ||||
| } | } | ||||
| } | } | ||||
| @@ -91,7 +91,7 @@ void run5Tests() | |||||
| postRtEvents.mutex.unlock(); | postRtEvents.mutex.unlock(); | ||||
| printf("Post-Rt Event Count: %i\n", k); | |||||
| carla_stdout("Post-Rt Event Count: %i", k); | |||||
| assert(k == 5); | assert(k == 5); | ||||
| // data should be empty now | // data should be empty now | ||||
| @@ -105,7 +105,7 @@ void run5Tests() | |||||
| { | { | ||||
| const MyData& my(allMyData[i]); | const MyData& my(allMyData[i]); | ||||
| printf("Got data: %i %s\n", my.id, my.str.buffer()); | |||||
| carla_stdout("Got data: %i %s", my.id, my.str.buffer()); | |||||
| } | } | ||||
| } | } | ||||
| @@ -143,7 +143,7 @@ int main() | |||||
| { | { | ||||
| const MyData& my(it.getValue()); | const MyData& my(it.getValue()); | ||||
| printf("FOR DATA!!!: %i %s\n", my.id, my.str.buffer()); | |||||
| carla_stdout("FOR DATA!!!: %i %s", my.id, my.str.buffer()); | |||||
| if (my.id == 1) | if (my.id == 1) | ||||
| { | { | ||||
| @@ -65,8 +65,7 @@ public: | |||||
| try { | try { | ||||
| dfilename = carla_strdup(filename); | dfilename = carla_strdup(filename); | ||||
| } | |||||
| CARLA_SAFE_EXCEPTION_RETURN("LibCounter::open", nullptr); | |||||
| } CARLA_SAFE_EXCEPTION_RETURN("LibCounter::open", nullptr); | |||||
| const CarlaMutexLocker cml(fMutex); | const CarlaMutexLocker cml(fMutex); | ||||