ltldo.test 2.66 KB
Newer Older
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2015 Laboratoire de Recherche et
# Développement de l'Epita (LRDE).
#
# This file is part of Spot, a model checking library.
#
# Spot is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Spot is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

. ./defs
set -e

ltldo=../../bin/ltldo
ltl2tgba=../../bin/ltl2tgba
genltl=../../bin/genltl

run 0 $ltldo -f a -f 'a&b' -t 'echo %f,%s' >output
cat >expected <<EOF
(a),(a)
(a) & (b),(a) && (b)
EOF
diff output expected

35
36
37
38
39
40
41
42
# Renaming
run 0 $ltldo -f a -f 'a&_b' -t 'echo %f,%s' >output
cat >expected <<EOF
(a),(a)
(p0) & (p1),(p0) && (p1)
EOF
diff output expected

Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
43
44
45
46
47
48
49
50
51
52
53
54
55

# Test timeouts.  This test should take 2*2 seconds.
$genltl --or-g=1..2 |
run 0 $ltldo -F- -t 'sleep 10; echo %f' -T1 -t 'sleep 10; echo %f' \
	     >output 2>stderr
test -z "`cat output`"
test 4 = `grep -c warning: stderr`

$genltl --and-gf=1..3 |
run 0 $ltldo "{tgba}$ltl2tgba %f -H >%H" "{ba}$ltl2tgba >%N %f -s" \
	     --stats="%T,%R,%f,%s,%t,%e" >output
cat output
cat >expected <<EOF
56
57
58
59
60
61
tgba,1,GFp1,1,2,2
ba,1,GFp1,2,4,4
tgba,2,GFp1 & GFp2,1,4,4
ba,2,GFp1 & GFp2,3,12,8
tgba,3,GFp1 & GFp2 & GFp3,1,8,8
ba,3,GFp1 & GFp2 & GFp3,4,32,13
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
62
EOF
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
diff output expected

# Renaming
run 0 $ltldo "$ltl2tgba -H %s>%H" -f GF_foo_ -H >output
cat output
# The HOA output uses _foo_ as atomic proposition, but the name shows
# that GFp0 was actually given to ltl2tgba.
cat >expected <<EOF
HOA: v1
name: "GFp0"
States: 1
Start: 0
AP: 1 "_foo_"
acc-name: Buchi
Acceptance: 1 Inf(0)
78
79
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
--BODY--
State: 0
[0] 0 {0}
[!0] 0
--END--
EOF
diff output expected

# But we can force the name in the output:
run 0 $ltldo "$ltl2tgba -H %s>%H" -f GF_foo_ -H --name=%f >output
cat output
cat >expected <<EOF
HOA: v1
name: "GF_foo_"
States: 1
Start: 0
AP: 1 "_foo_"
acc-name: Buchi
Acceptance: 1 Inf(0)
99
100
properties: trans-labels explicit-labels trans-acc complete
properties: deterministic
101
102
103
104
105
106
107
--BODY--
State: 0
[0] 0 {0}
[!0] 0
--END--
EOF
diff output expected
108
109
110
111
112

$ltldo ': %s; true>%O' -f GFa 2>stderr && exit 1
test $? = 2
grep 'error: command ".*" produced an empty output.' stderr
grep 'ltldo: aborting' stderr