aboutsummaryrefslogtreecommitdiff
path: root/tests/cyclic.at
blob: 2d580a0b7fc25dfe18ccf625311ecde89d74f317 (plain)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# This file is part of GNU pies testsuite. -*- autotest -*-
# Copyright (C) 2019-2021 Sergey Poznyakoff
#
# GNU pies 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, or (at your option)
# any later version.
#
# GNU pies 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 GNU pies.  If not, see <http://www.gnu.org/licenses/>.

AT_SETUP([Detecting cyclic dependencies])

AT_CHECK([
PIES_XFAIL_CHECK
# The following matrices describe the test.conf configuration file below.
#
# Dependency matrix:
#     0  1  2  3  4  5  6  7
#  0     X     X             
#  1     X                   
#  2              X          
#  3        X                
#  4  X                      
#  5                         
#  6                       X 
#  7                         
# 
# Transitive closure:
#     0  1  2  3  4  5  6  7
#  0  X  X  X  X  X          
#  1     X                   
#  2  X  X  X  X  X          
#  3  X  X  X  X  X          
#  4  X  X  X  X  X          
#  5                         
#  6                       X 
#  7                         
# 
# Legend:
#  0: a
#  1: b
#  2: c
#  3: d
#  4: e
#  5: f
#  6: g
#  7: h

AT_DATA([test.conf],
[component a {
   command "a";
   prerequisites (b,d);
}

component b {
   command "b";
   prerequisites (b);
}

component c {
   command "c";
   prerequisites (e);
}

component d {
   command "d";
   prerequisites (c);
}

component e {
   command "e";
   prerequisites (a);
}

component f {
   command "f";
}

component g {
   command "g";
   prerequisites (h);
}

component h {
   command "h";
}
])

pies --config-file test.conf --dump-depmap | trimws
],
[0],
[Dependency map:
    0  1  2
 0
 1        X
 2

Legend:
 0: f
 1: g
 2: h
],
[pies: cyclic dependencies detected:
pies: a -> d -> c -> e -> a
pies: b -> b
])

AT_CHECK([
AT_DATA([test.conf],[
component a {
	command "a";
	prerequisites (b,c);
}
component b {
	command "b";
	prerequisites (c);
}
component c {
	command "c";
	prerequisites (d);
}
component d {
	command "d";
	prerequisites (a);
}
])
pies --config-file test.conf --dump-depmap | trimws
],
[0],
[No components defined
],
[pies: cyclic dependencies detected:
pies: a -> c -> d -> a
pies: a -> b -> c -> d -> a
])

AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.