* tests/core/bdddict.cc: Trap SIGABORT so coverage works.

This commit is contained in:
Alexandre Duret-Lutz 2017-11-05 14:58:47 +01:00
parent ba5a89a620
commit d9f8c517fa

View file

@ -17,12 +17,42 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <signal.h>
#include <iostream> #include <iostream>
#include <spot/tl/parse.hh> #include <spot/tl/parse.hh>
#include <spot/twaalgos/translate.hh> #include <spot/twaalgos/translate.hh>
// assert_emptiness() calls abort() which prevents gcov from flushing
// its coverage data. So we convert SIGABRT as exit(1) whenever
// possible.
#if HAVE_SIGACTION
static void
sig_handler(int)
{
exit(1);
}
static void
setup_sig_handler()
{
struct sigaction sa;
sa.sa_handler = sig_handler;
sigemptyset(&sa.sa_mask);
sigaction(SIGABRT, &sa, nullptr);
}
#else
static void
setup_sig_handler()
{
}
#endif
int main() int main()
{ {
setup_sig_handler();
spot::formula f = spot::parse_formula("& & G p0 p1 p2"); spot::formula f = spot::parse_formula("& & G p0 p1 p2");
spot::translator trans; spot::translator trans;
spot::twa_graph_ptr aut = trans.run(f); spot::twa_graph_ptr aut = trans.run(f);