aboutsummaryrefslogtreecommitdiff
path: root/tests/cyclic.at
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-05-23 13:08:08 +0300
committerSergey Poznyakoff <gray@gnu.org>2019-05-23 13:08:08 +0300
commitbd19f38853dad5a89abada6ee5e7a23c65173894 (patch)
tree57b53cdceeb69db1bb51e8df48eb4f007c6ecb97 /tests/cyclic.at
parent3ad426f88d274535d7e04e12add72534034ac075 (diff)
downloadpies-bd19f38853dad5a89abada6ee5e7a23c65173894.tar.gz
pies-bd19f38853dad5a89abada6ee5e7a23c65173894.tar.bz2
Revise dependency handling. Correctly display cyclic dependencies.
* src/comp.c (component_log_dep): Remove. (report_cyclic_dependency): New function. (comp_array_remove): New function. (component_build_depmap): Remove erroneous components both from the component table and dependency map. (components_dump_depmap): Avoid trailing whitespace in the output. * src/depmap.c (depmap_clear_all): Remove. (depmap_remove): New function. * src/pies.h (CF_REMOVE): New flag. (depmap_clear_all): Remove prototype. (depmap_remove): New prototype. * tests/Makefile.am: Add new test. * tests/atlocal.in (trimws): New function. * tests/cyclic.at: New test. * tests/testsuite.at: Include new test.
Diffstat (limited to 'tests/cyclic.at')
-rw-r--r--tests/cyclic.at114
1 files changed, 114 insertions, 0 deletions
diff --git a/tests/cyclic.at b/tests/cyclic.at
new file mode 100644
index 0000000..27da22e
--- /dev/null
+++ b/tests/cyclic.at
@@ -0,0 +1,114 @@
+# This file is part of GNU pies testsuite. -*- Autotest -*-
+# Copyright (C) 2019 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: component a depends on itself
+pies: a -> d -> c -> e -> a
+pies: component b depends on itself
+pies: b -> b
+])
+
+AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.