bin: remove temporary files even on errors
Fixes #259. * bin/common_setup.cc: Register a cleanup_tmpfiles() via atexit. * tests/core/ltldo.test: Add a test case. * NEWS: Mention the bug.
This commit is contained in:
parent
5601806e24
commit
b6808115b9
3 changed files with 25 additions and 2 deletions
3
NEWS
3
NEWS
|
|
@ -70,6 +70,9 @@ New in spot 2.3.3.dev (not yet released)
|
|||
- the --help output of randaut and ltl2tgba was showing an
|
||||
unsupported %b stat.
|
||||
|
||||
- ltldo and ltlcross could leave temporary files behind when
|
||||
aborting on error.
|
||||
|
||||
Backward-incompatible changes:
|
||||
|
||||
- spot::acc_cond::mark_t::operator bool() has been marked as
|
||||
|
|
|
|||
|
|
@ -43,8 +43,16 @@ This is free software: you are free to change and redistribute it.\n\
|
|||
There is NO WARRANTY, to the extent permitted by law.\n", stream);
|
||||
}
|
||||
|
||||
// This is called on normal exit (i.e., when leaving
|
||||
// main or calling exit(), even via error()).
|
||||
static void atexit_cleanup()
|
||||
{
|
||||
spot::cleanup_tmpfiles();
|
||||
}
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
// This is called on abnormal exit, i.e. when the process is killed by
|
||||
// some signal.
|
||||
static void sig_handler(int sig)
|
||||
{
|
||||
spot::cleanup_tmpfiles();
|
||||
|
|
@ -92,6 +100,7 @@ setup(char** argv)
|
|||
|
||||
setup_default_output_format();
|
||||
setup_sig_handler();
|
||||
atexit(atexit_cleanup);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015, 2016 Laboratoire de Recherche et
|
||||
# Développement de l'Epita (LRDE).
|
||||
# Copyright (C) 2015-2017 Laboratoire de Recherche et Développement de
|
||||
# l'Epita (LRDE).
|
||||
#
|
||||
# This file is part of Spot, a model checking library.
|
||||
#
|
||||
|
|
@ -152,3 +152,14 @@ genltl --rv-counter=9 | ltldo ltl2tgba --stats='
|
|||
print("%[up]R + %[uc]R + %[sp]R + %[sc]R - %R\n");
|
||||
die if abs(%[up]R + %[uc]R + %[sp]R + %[sc]R - %R) > 0.02;' > code.pl
|
||||
perl code.pl
|
||||
|
||||
# ltldo should not leave temporary files behind itself on errors
|
||||
ltldo -f a 'ltl2dstar --ltl2nba=spin:ltl2tgba@-DS' && exit 2
|
||||
for i in lcr-*; do
|
||||
case $i in
|
||||
'lcr-*');;
|
||||
*)
|
||||
echo $i should not be here;
|
||||
exit 2;;
|
||||
esac
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue