2016-05-12 4 views
0

Почему у Valgrind есть код выхода 1, когда исполняемый файл в тесте завершает работу с 0?Почему у Valgrind есть код выхода из 1, когда исполняемый файл под тестированием выходит с 0?

$ ./test 
Starting tests... 
ALL TESTS PASSED 
Tests run: 1 

$ valgrind --error-exitcode=123 test 
==27705== Memcheck, a memory error detector 
==27705== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. 
==27705== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info 
==27705== Command: test 
==27705== 
==27705== 
==27705== HEAP SUMMARY: 
==27705==  in use at exit: 0 bytes in 0 blocks 
==27705== total heap usage: 30 allocs, 30 frees, 3,681 bytes allocated 
==27705== 
==27705== All heap blocks were freed -- no leaks are possible 
==27705== 
==27705== For counts of detected and suppressed errors, rerun with: -v 
==27705== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) 
$ echo $? 
1 

ответ

0

Это работает:

$ valgrind --error-exitcode=123 ./test 
==27764== Memcheck, a memory error detector 
==27764== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. 
==27764== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info 
==27764== Command: ./test 
==27764== 
Starting tests... 
ALL TESTS PASSED 
Tests run: 1 
==27764== 
==27764== HEAP SUMMARY: 
==27764==  in use at exit: 0 bytes in 0 blocks 
==27764== total heap usage: 0 allocs, 0 frees, 0 bytes allocated 
==27764== 
==27764== All heap blocks were freed -- no leaks are possible 
==27764== 
==27764== For counts of detected and suppressed errors, rerun with: -v 
==27764== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) 

2016-05-12T07:51:35Z [email protected]:~/vr2200-platform/pmu (master) 
$ echo $? 
0 

Причина была исполняемая на пути также называется "тест", который вернулся 1.