From: Milian Wolff Date: Thu, 15 May 2014 20:32:34 +0000 (+0200) Subject: Move test files and compile them in debug mode. X-Git-Tag: submit/tizen/20180620.112952^2~554 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa3f3e83d7279057cf600eea729e59b862b74c31;p=sdk%2Ftools%2Fheaptrack.git Move test files and compile them in debug mode. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bdb94e..a938053 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,6 @@ target_link_libraries(mallocinfo dumpmallocinfo) add_library(malloctrace SHARED malloctrace.cpp) target_link_libraries(malloctrace -ldl -lunwind) -add_executable(test_c test.c) -add_executable(test_cpp test.cpp) - install(TARGETS mallocinfo RUNTIME DESTINATION bin) + +add_subdirectory(tests) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..12574a4 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,4 @@ +set(CMAKE_BUILD_TYPE Debug) + +add_executable(test_c test.c) +add_executable(test_cpp test.cpp) diff --git a/test.c b/tests/test.c similarity index 100% rename from test.c rename to tests/test.c diff --git a/test.cpp b/tests/test.cpp similarity index 79% rename from test.cpp rename to tests/test.cpp index 6e57cf9..db52e6b 100644 --- a/test.cpp +++ b/tests/test.cpp @@ -13,6 +13,23 @@ struct Foo { int* i; }; +void asdf() +{ + int* i = new int; + printf("i in asdf: %p\n", i); + delete i; +} + +void bar() +{ + asdf(); +} + +void laaa() +{ + bar(); +} + static Foo foo; int main() @@ -47,5 +64,10 @@ int main() printf("posix_memalign: %p\n", buf); free(buf); + for (int i = 0; i < 10; ++i) { + laaa(); + } + laaa(); + return 0; }