Skip to content
benlongstaff edited this page Nov 15, 2010 · 4 revisions

Tips

If you get an error like

[ben.longstaff@moby tests]$ saru-run-test single broken_test.py 
saru_bug.py : FAILED
==MESSAGE==
saru-run-test : execution of test failed with error code 127
==STDERR==
: No such file or directory

then you can just run the file in python to get more output

python26 broken_test.py

saru-run-test : file does not contain any saru test information

All of the saru headers must occur at the top of the file before anything else

Error Code 127 : No such file or directory

If you edited your file in windows its possible that it added a \r character at the end of the line. You can check this by running your script at the command line as

./broken_test.py

if the output looks like

[ben.longstaff@moby tests]$ ./broken_test.py : No such file or directory

You can fix this by opening the file in vim and typing

:set ff=unix

then save the file again.

C++ GDB debugging

If to run your test you typed

saru-run-test single test1.cpp

you can run the test in gdb by typing

gdb ./.saru/bin/test1.cpp.test

and run gdb as per normal.

NOTE: If you change your source code you need to run saru-run-test single test1.cpp again and reload the file in GDB for your changes to be applied to your debugging session.

C++ Valgrind

valgrind ./.saru/bin/test1.cpp.test

C++ Delta

If you have a large code base and a difficult bug to track down, Delta is a good tool for reducing your code base. Tutorial and a roadmap for using delta debugging Also see

Notes You need a test for interestingness (shell script) Add the delta tools to your path export PATH=~/delta-2006.08.03/:$PATH run multi delta giving it the test for interestingness and the file to modify

multidelta -level=0 ./delta_script.bash src/server.cpp

When it finishes you need to rebuild the binary and check that it still breaks in the right place, as the script just checks for interestingness, not the point at which the interestingness occurs. The repeat with levels 1 to 5 (ish), then you can manually remove any bits of junk that delta missed and check that it still fails correctly.

If there are included libraries you can then copy the library source into the server.cpp file and update the makefile to remove the library from the objects list. If it no longer segfaults then its a compiler issue.

Clone this wiki locally