Updated for the latest version of doxygen. Allow to preserve test result and run doxygen if foreground.