• Oran Agra's avatar
    tests/valgrind: don't use debug restart (#7404) · 69ade873
    Oran Agra authored
    * tests/valgrind: don't use debug restart
    
    DEBUG REATART causes two issues:
    1. it uses execve which replaces the original process and valgrind doesn't
       have a chance to check for errors, so leaks go unreported.
    2. valgrind report invalid calls to close() which we're unable to resolve.
    
    So now the tests use restart_server mechanism in the tests, that terminates
    the old server and starts a new one, new PID, but same stdout, stderr.
    
    since the stderr can contain two or more valgrind report, it is not enough
    to just check for the absence of leaks, we also need to check for some known
    errors, we do both, and fail if we either find an error, or can't find a
    report saying there are no leaks.
    
    other changes:
    - when killing a server that was already terminated we check for leaks too.
    - adding DEBUG LEAK which was used to test it.
    - adding --trace-children to valgrind, although no longer needed.
    - since the stdout contains two or more runs, we need slightly different way
      of checking if the new process is up (explicitly looking for the new PID)
    - move the code that handles --wait-server to happen earlier (before
      watching the startup message in the log), and serve the restarted server too.
    
    * squashme - CR fixes
    69ade873
debug.c 64.5 KB