summaryrefslogtreecommitdiffabout
path: root/tests
authorSergey Poznyakoff <gray@gnu.org>2019-05-23 10:08:08 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-05-23 10:08:08 (GMT)
commitbd19f38853dad5a89abada6ee5e7a23c65173894 (patch) (unidiff)
tree57b53cdceeb69db1bb51e8df48eb4f007c6ecb97 /tests
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') (more/less context) (ignore whitespace changes)
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/atlocal.in6
-rw-r--r--tests/cyclic.at114
-rw-r--r--tests/testsuite.at2
4 files changed, 122 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5ef3796..6c387cb 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -41,6 +41,7 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
41TESTSUITE_AT = \ 41TESTSUITE_AT = \
42 testsuite.at\ 42 testsuite.at\
43 control.at\ 43 control.at\
44 cyclic.at\
44 respawn.at\ 45 respawn.at\
45 redirect.at\ 46 redirect.at\
46 ret-exec.at\ 47 ret-exec.at\
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 2ba1462..9069bbd 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -1,6 +1,10 @@
1# @configure_input@ -*- shell-script -*- 1# @configure_input@ -*- shell-script -*-
2# Configurable variable values for GNU Pies test suite. 2# Configurable variable values for GNU Pies test suite.
3# Copyright (C) 2016-2017 Sergey Poznyakoff 3# Copyright (C) 2016-2019 Sergey Poznyakoff
4 4
5PATH=@abs_builddir@:@abs_top_builddir@/src:$srcdir:$PATH 5PATH=@abs_builddir@:@abs_top_builddir@/src:$srcdir:$PATH
6XFAILFILE=$abs_builddir/.badversion 6XFAILFILE=$abs_builddir/.badversion
7
8trimws() {
9 sed 's/[ ][ ]*$//'
10}
diff --git a/tests/cyclic.at b/tests/cyclic.at
new file mode 100644
index 0000000..27da22e
--- a/dev/null
+++ b/tests/cyclic.at
@@ -0,0 +1,114 @@
1# This file is part of GNU pies testsuite. -*- Autotest -*-
2# Copyright (C) 2019 Sergey Poznyakoff
3#
4# GNU pies is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 3, or (at your option)
7# any later version.
8#
9# GNU pies is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with GNU pies. If not, see <http://www.gnu.org/licenses/>.
16
17AT_SETUP([Detecting cyclic dependencies])
18AT_CHECK([
19PIES_XFAIL_CHECK
20# The following matrices describe the test.conf configuration file below.
21#
22# Dependency matrix:
23# 0 1 2 3 4 5 6 7
24# 0 X X
25# 1 X
26# 2 X
27# 3 X
28# 4 X
29# 5
30# 6 X
31# 7
32#
33# Transitive closure:
34# 0 1 2 3 4 5 6 7
35# 0 X X X X X
36# 1 X
37# 2 X X X X X
38# 3 X X X X X
39# 4 X X X X X
40# 5
41# 6 X
42# 7
43#
44# Legend:
45# 0: a
46# 1: b
47# 2: c
48# 3: d
49# 4: e
50# 5: f
51# 6: g
52# 7: h
53
54AT_DATA([test.conf],
55[component a {
56 command "a";
57 prerequisites (b,d);
58}
59
60component b {
61 command "b";
62 prerequisites (b);
63}
64
65component c {
66 command "c";
67 prerequisites (e);
68}
69
70component d {
71 command "d";
72 prerequisites (c);
73}
74
75component e {
76 command "e";
77 prerequisites (a);
78}
79
80component f {
81 command "f";
82}
83
84component g {
85 command "g";
86 prerequisites (h);
87}
88
89component h {
90 command "h";
91}
92])
93
94pies --config-file test.conf --dump-depmap | trimws
95],
96[0],
97[Dependency map:
98 0 1 2
99 0
100 1 X
101 2
102
103Legend:
104 0: f
105 1: g
106 2: h
107],
108[pies: component a depends on itself
109pies: a -> d -> c -> e -> a
110pies: component b depends on itself
111pies: b -> b
112])
113
114AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 152b77f..7f4e7b8 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -58,6 +58,8 @@ AT_TESTED([pies])
58AT_BANNER([Initial]) 58AT_BANNER([Initial])
59m4_include([version.at]) 59m4_include([version.at])
60m4_include([control.at]) 60m4_include([control.at])
61AT_BANNER([Dependencies])
62m4_include([cyclic.at])
61AT_BANNER([Components]) 63AT_BANNER([Components])
62m4_include([respawn.at]) 64m4_include([respawn.at])
63m4_include([redirect.at]) 65m4_include([redirect.at])

Return to:

Send suggestions and report system problems to the System administrator.