ltldo.test 3.19 KB
Newer Older
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
1
2
#!/bin/sh
# -*- coding: utf-8 -*-
3
# Copyright (C) 2015, 2016 Laboratoire de Recherche et
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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

24
25
26
ltldo=ltldo
ltl2tgba=ltl2tgba
genltl=genltl
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
27
28
29

run 0 $ltldo -f a -f 'a&b' -t 'echo %f,%s' >output
cat >expected <<EOF
30
a,a
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
31
32
33
34
(a) & (b),(a) && (b)
EOF
diff output expected

35
36
37
# Renaming
run 0 $ltldo -f a -f 'a&_b' -t 'echo %f,%s' >output
cat >expected <<EOF
38
a,a
39
40
41
42
(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

# 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`

51
52
test "`echo 1,a,3,4 | ltldo -F-/2 ltl2tgba --stats='%<,%s,%>'`" = '1,2,3,4'

Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
53
54
55
56
57
$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
58
59
60
61
62
63
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
64
EOF
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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)
80
properties: trans-labels explicit-labels trans-acc complete
81
properties: deterministic stutter-invariant
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
--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)
101
properties: trans-labels explicit-labels trans-acc complete
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
properties: deterministic stutter-invariant
--BODY--
State: 0
[0] 0 {0}
[!0] 0
--END--
EOF
diff output expected

# Not trusting properties
run 0 $ltldo "$ltl2tgba -H %s>%H" -f GF_foo_ -H --trust-hoa=no >output
cat output
cat >expected <<EOF
HOA: v1
name: "GFp0"
States: 1
Start: 0
AP: 1 "_foo_"
acc-name: Buchi
Acceptance: 1 Inf(0)
properties: trans-labels explicit-labels trans-acc complete
123
properties: deterministic
124
125
126
127
128
129
130
--BODY--
State: 0
[0] 0 {0}
[!0] 0
--END--
EOF
diff output expected
131
132
133

$ltldo ': %s; true>%O' -f GFa 2>stderr && exit 1
test $? = 2
134
grep ':.*empty input' stderr
135
grep 'ltldo: aborting' stderr
136
137
138

$ltldo '{name} foo/bar/ltl2baextended' -f GFa 2>stderr && exit 1
grep 'error:.*foo/bar/ltl2baextended -f .*>.*' stderr