Commit 4d4c5d80 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz

ltl2tgba, randaut: better error reporting

* src/bin/ltl2tgba.cc, src/bin/randaut.cc: Catch exceptions
in main loop.
* src/tgbatest/ltl2tgba.test, src/tgbatest/randaut.test: Test
errors with unknown --dot argument.
parent 5497bef3
......@@ -60,7 +60,7 @@ static const argp_option options[] =
/**************************************************/
{ "%f", 0, 0, OPTION_DOC | OPTION_NO_USAGE,
"the formula, in Spot's syntax", 4 },
/**************************************************/
/**************************************************/
{ 0, 0, 0, 0, "Miscellaneous options:", -1 },
{ "extra-options", 'x', "OPTS", 0,
"fine-tuning options (see spot-x (7))", 0 },
......@@ -182,7 +182,14 @@ main(int argc, char** argv)
trans.set_level(level);
trans_processor processor(trans);
if (processor.run())
return 2;
try
{
if (processor.run())
return 2;
}
catch (const std::runtime_error& e)
{
error(2, 0, "%s", e.what());
}
return 0;
}
......@@ -298,8 +298,15 @@ main(int argc, char** argv)
auto runtime = sw.stop();
printer.print(aut, nullptr,
opt_seed_str, automaton_num, runtime, nullptr);
try
{
printer.print(aut, nullptr,
opt_seed_str, automaton_num, runtime, nullptr);
}
catch (const std::runtime_error& e)
{
error(2, 0, "%s", e.what());
}
++automaton_num;
if (opt_automata > 0 && automaton_num >= opt_automata)
......
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire
# de Recherche et Développement de l'Epita (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
# département Systèmes Répartis Coopératifs (SRC), Université Pierre
# et Marie Curie.
......@@ -201,3 +201,7 @@ grep 'states: 4$' stdout
../../bin/ltlfilt -r -f '!{{a;b}[*]}' --equivalent-to '!a | X!b'
../../bin/ltlfilt -f '{a[*];b[*]}' --equivalent-to 'a | b'
../../bin/ltlfilt -r -f '{a[*];b[*]}' --equivalent-to 'a | b'
# test unknown dot options
../../bin/ltl2tgba --dot=@ a 2>stderr && exit 1
grep 'ltl2tgba: unknown option.*@' stderr
......@@ -68,3 +68,6 @@ diff out expected
$randaut -n 5 --stats='name: "%F-%L-%s-%c-%e"' a >out2
diff out2 expected
$randaut -n 5 --dot=@ a 2>stderr && exit 1
grep 'randaut: unknown option.*@' stderr
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment