Skip to content

Commit

Permalink
Add an new make target for debug.
Browse files Browse the repository at this point in the history
Add some message in test/test.c.
  • Loading branch information
caikelun committed Jan 31, 2016
1 parent 2b8e8ef commit b29399a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
18 changes: 10 additions & 8 deletions README.md
Expand Up @@ -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
Expand All @@ -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

Expand Down
8 changes: 5 additions & 3 deletions test/test.c
Expand Up @@ -78,15 +78,16 @@ 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" \
"\n" \
"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)
Expand Down Expand Up @@ -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"))
Expand Down
5 changes: 5 additions & 0 deletions xmake.lua
Expand Up @@ -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")
Expand Down

0 comments on commit b29399a

Please sign in to comment.