From b29399a7a8ffa6b0fa18d1f250e21e9efcb1ff9f Mon Sep 17 00:00:00 2001 From: caikelun Date: Sun, 31 Jan 2016 17:51:14 +0800 Subject: [PATCH] Add an new make target for debug. Add some message in test/test.c. --- README.md | 18 ++++++++++-------- test/test.c | 8 +++++--- xmake.lua | 5 +++++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 4ed9817..6c20c25 100644 --- a/README.md +++ b/README.md @@ -107,12 +107,13 @@ Compile * Compile using homemade scripts and Makefiles: Configure : ./configure - Compile : make [build=r|prof|cover|asan|tsan|lsan|usan] + Compile : make [build=r|d|prof|cover|asan|tsan|lsan|usan] Clean : make clean Clean all : make distclean >>> OPTIONS <<< build = r (default) : compile with -O3 -fvisibility=hidden, then strip + build = d : compile with -O0 -g3 build = prof : compile with -O3 -g3 -pg build = cover : compile with -O0 -g3 --coverage build = asan : compile with -O0 -g3 -fsanitize=address @@ -123,13 +124,14 @@ Compile * Or, Compile using xmake: ( learn more about xmake: https://github.com/waruqi/xmake ) Compile : xmake - xmake f -c -m r; xmake -r - xmake f -c -m prof; xmake -r - xmake f -c -m cover; xmake -r - xmake f -c -m asan; xmake -r - xmake f -c -m tsan; xmake -r - xmake f -c -m lsan; xmake -r - xmake f -c -m usan; xmake -r + xmake f -c -m r ; xmake -r + xmake f -c -m d ; xmake -r + xmake f -c -m prof ; xmake -r + xmake f -c -m cover ; xmake -r + xmake f -c -m asan ; xmake -r + xmake f -c -m tsan ; xmake -r + xmake f -c -m lsan ; xmake -r + xmake f -c -m usan ; xmake -r Clean : xmake c Clean all : xmake c -a diff --git a/test/test.c b/test/test.c index 7de36ef..f5bf210 100644 --- a/test/test.c +++ b/test/test.c @@ -78,7 +78,7 @@ static void test_show_help(char *exe_pathname) printf("\n" \ "USAGE:\n" \ - " %s -h | -g [TEST-NAME] | -d [TEST-NAME]\n" \ + " %s -h | -g [TEST-NAME] | -d [TEST-NAME] | -q TEST-NAME\n" \ "\n" \ "DESCRIPTION:\n" \ " Run test specified by TEST-NAME, or all tests if without TEST-NAME.\n" \ @@ -86,7 +86,8 @@ static void test_show_help(char *exe_pathname) "OPTIONS:\n" \ " -h Show this help\n" \ " -g Run test via valgrind\n" \ - " -d Run test directly (without valgrind)\n" \ + " -d Run test directly (without valgrind, but still with a parent process)\n" \ + " -q Run test directly and quiet (without valgrind and parent process)\n" \ "\n" \ "available TEST-NAME:\n", basename(exe_pathname)); while(test_infos[++i].name) @@ -298,7 +299,8 @@ int main(int argc, char **argv) if(0 == strcmp(argv[1], "-g")) return test_run_valgrind_all(argv[0]); else if(0 == strcmp(argv[1], "-d")) - return test_run_directly_all(argv[0]); } + return test_run_directly_all(argv[0]); + } else if(argc == 3) { if(0 == strcmp(argv[1], "-g")) diff --git a/xmake.lua b/xmake.lua index 9dcf21f..3c23345 100644 --- a/xmake.lua +++ b/xmake.lua @@ -7,6 +7,11 @@ if modes("r") then set_strip("all") end +if modes("d") then + set_symbols("debug") + set_optimize("none") +end + if modes("prof") then set_symbols("debug") set_optimize("fastest")