bin: fix handling for --output & --format with LTL outputs
* bin/common_output.cc: Set the output stream for LTL formats. * tests/core/serial.test: Add a test case about this issue that also improve the covering of the previous patch about saving file descriptors.
This commit is contained in:
parent
7f1a33cc61
commit
0923f8efe2
3 changed files with 18 additions and 1 deletions
3
NEWS
3
NEWS
|
|
@ -35,6 +35,9 @@ New in spot 2.11.5.dev (not yet released)
|
||||||
where thousands of different filenames can be created failed with
|
where thousands of different filenames can be created failed with
|
||||||
"Too many open files". (Issue #534)
|
"Too many open files". (Issue #534)
|
||||||
|
|
||||||
|
- Using --format=... on a tool that output formulas would force
|
||||||
|
the output on standard output, even when --output was given.
|
||||||
|
|
||||||
|
|
||||||
New in spot 2.11.5 (2023-04-20)
|
New in spot 2.11.5 (2023-04-20)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ namespace
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class formula_printer final: protected spot::formater
|
class formula_printer final: public spot::formater
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
formula_printer(std::ostream& os, const char* format)
|
formula_printer(std::ostream& os, const char* format)
|
||||||
|
|
@ -399,6 +399,7 @@ output_formula(std::ostream& out,
|
||||||
{
|
{
|
||||||
formula_with_location fl = { f, filename, linenum,
|
formula_with_location fl = { f, filename, linenum,
|
||||||
index, prefix, suffix };
|
index, prefix, suffix };
|
||||||
|
format->set_output(out);
|
||||||
format->print(fl, ptimer);
|
format->print(fl, ptimer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,3 +78,16 @@ test 2000 = `ls -l randaut-*.hoa | wc -l`
|
||||||
# likewise for LTL formulas
|
# likewise for LTL formulas
|
||||||
randltl 2 -n 2000 -o randltl-%l.ltl
|
randltl 2 -n 2000 -o randltl-%l.ltl
|
||||||
test 2000 = `ls -l randltl-*.ltl | wc -l`
|
test 2000 = `ls -l randltl-*.ltl | wc -l`
|
||||||
|
|
||||||
|
|
||||||
|
# Test the code path that works that has to reopen files
|
||||||
|
randltl -n100 --tree-size 1 26 --allow-dups -o '%f'.ltl --format=pass1
|
||||||
|
randltl -n100 --tree-size 1 26 --allow-dups -o '>>%f'.ltl --format=pass2
|
||||||
|
(uniq -c p1.ltl; uniq -c p20.ltl) | sed 's/^ *\([0-9][0-9]*\) */\1 /g' >out
|
||||||
|
cat >expected <<EOF
|
||||||
|
4 pass1
|
||||||
|
4 pass2
|
||||||
|
5 pass1
|
||||||
|
5 pass2
|
||||||
|
EOF
|
||||||
|
diff out expected
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue