aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2012-09-28 11:23:09 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2012-09-28 11:32:04 +0300
commitac1d6cbbcf5323d5db59886b98a24c45bafa64b8 (patch)
treef2a77092e072faa680b47d9d6d960e7214e46876
parentd902742081bc31a6eda274268da0178107e4abb4 (diff)
downloadeclat-ac1d6cbbcf5323d5db59886b98a24c45bafa64b8.tar.gz
eclat-ac1d6cbbcf5323d5db59886b98a24c45bafa64b8.tar.bz2
Improve testsuite. Reorganize directory structure.
* Makefile.am (SUBDIRS): Add etc (distuninstallcheck_listfiles): Ignore *.forlan files. * configure.ac: New options --split-format and --format-dir * etc/Makefile.am: New file. * etc/default.fln: New file. * etc/describe-instance-status.fln: New file. * etc/describe-instances.fln: New file. * etc/describe-tags.fln: New file. * etc/eclat.cfin: New file. * etc/flncat.c: New file. * etc/start-instances.fln: New file. * etc/stop-instances.fln: New file. * src/Makefile.am: Remove eclat.conf. It is built in /etc now. * src/eclat.conf: Remove. * src/cmdline.opt: Update. * src/config.c: New configuration statement "format-file". * src/eclat.c (format_file_option): New global. (main): Read format from format-file, if supplied. Expand keywords in its argument. * src/eclat.h (format_file_option): New extern. * tests/.gitignore: Update. * tests/Makefile.am: Add new files. * tests/describe-instance-status.at: New test case. * tests/describe-instances.at: New test case. * tests/describe-tags.at: New test case. * tests/dscrinststat.at: New test case. * tests/start-instances.at: New test case. * tests/stop-instances.at: New test case. * tests/testsuite.at (ECLAT_TEST_FORMAT): New macro. Include new test cases. * tests/trws.c: New file.
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac26
-rw-r--r--etc/.gitignore3
-rw-r--r--etc/Makefile.am60
-rw-r--r--etc/default.fln22
-rw-r--r--etc/describe-instance-status.fln36
-rw-r--r--etc/describe-instances.fln69
-rw-r--r--etc/describe-tags.fln24
-rw-r--r--etc/eclat.cfin32
-rw-r--r--etc/flncat.c94
-rw-r--r--etc/start-instances.fln23
-rw-r--r--etc/stop-instances.fln23
-rw-r--r--src/Makefile.am8
-rw-r--r--src/cmdline.opt2
-rw-r--r--src/config.c4
-rw-r--r--src/eclat.c72
-rw-r--r--src/eclat.conf165
-rw-r--r--src/eclat.h1
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/describe-instance-status.at154
-rw-r--r--tests/describe-instances.at274
-rw-r--r--tests/describe-tags.at68
-rw-r--r--tests/dscrinststat.at128
-rw-r--r--tests/start-instances.at38
-rw-r--r--tests/stop-instances.at39
-rw-r--r--tests/testsuite.at17
-rw-r--r--tests/trws.c46
28 files changed, 1245 insertions, 194 deletions
diff --git a/Makefile.am b/Makefile.am
index 171250b..d78d1f6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,7 +16,7 @@
16 16
17ACLOCAL_AMFLAGS = -I grecs/am 17ACLOCAL_AMFLAGS = -I grecs/am
18 18
19SUBDIRS = grecs lib src tests 19SUBDIRS = grecs lib src etc tests
20 20
21.PHONY: ChangeLog 21.PHONY: ChangeLog
22ChangeLog: 22ChangeLog:
@@ -25,4 +25,4 @@ ChangeLog:
25 awk -f $(top_srcdir)/grecs/build-aux/git2chg.awk > ChangeLog; \ 25 awk -f $(top_srcdir)/grecs/build-aux/git2chg.awk > ChangeLog; \
26 fi 26 fi
27 27
28distuninstallcheck_listfiles = find . -type f -not -name 'eclat.conf' -print 28distuninstallcheck_listfiles = find . -type f -not -name 'eclat.conf' -not -name '*.forlan' -print
diff --git a/configure.ac b/configure.ac
index 8f8ccfc..7c744ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,29 @@ AC_CHECK_LIB([expat], [XML_Parse],[],
63 63
64GRECS_SETUP([grecs],[tests getopt git2chg]) 64GRECS_SETUP([grecs],[tests getopt git2chg])
65 65
66#
67AC_SUBST(FORMATDIR)
68AC_ARG_ENABLE([split-format],
69 [AC_HELP_STRING([--enable-split-format],
70 [build split format files])],
71 [split_fmt=$enableval],
72 [split_fmt=no])
73
74if test $split_fmt = yes; then
75 FORMATDIR="\$(sysconfdir)/\$(PACKAGE)"
76else
77 FORMATDIR="\$(sysconfdir)"
78fi
79AM_CONDITIONAL([SPLIT_FORMATS],[test $split_fmt = yes])
80
81AC_ARG_WITH([format-dir],
82 [AC_HELP_STRING([--format-dir=DIR],
83 [install format files to that directory])],
84 [case $withval in
85 /*) FORMATDIR=$withval;;
86 *) FORMATDIR='$(prefix)/'$withval
87 esac])
88
66# Initialize the test suite. 89# Initialize the test suite.
67AC_CONFIG_TESTDIR(tests) 90AC_CONFIG_TESTDIR(tests)
68AC_CONFIG_FILES([tests/Makefile tests/atlocal]) 91AC_CONFIG_FILES([tests/Makefile tests/atlocal])
@@ -70,7 +93,8 @@ AM_MISSING_PROG([AUTOM4TE], [autom4te])
70 93
71AC_CONFIG_FILES([Makefile 94AC_CONFIG_FILES([Makefile
72 lib/Makefile 95 lib/Makefile
73 src/Makefile]) 96 src/Makefile
97 etc/Makefile])
74 98
75AC_OUTPUT 99AC_OUTPUT
76 100
diff --git a/etc/.gitignore b/etc/.gitignore
new file mode 100644
index 0000000..b22bf5d
--- /dev/null
+++ b/etc/.gitignore
@@ -0,0 +1,3 @@
1*.forlan
2eclat.conf
3flncat
diff --git a/etc/Makefile.am b/etc/Makefile.am
new file mode 100644
index 0000000..5eec565
--- /dev/null
+++ b/etc/Makefile.am
@@ -0,0 +1,60 @@
1# This file is part of Eclat
2# Copyright (C) 2012 Sergey Poznyakoff
3#
4# Eclat 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# Eclat 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 Eclat. If not, see <http://www.gnu.org/licenses/>.
16
17noinst_PROGRAMS = flncat
18
19FLNFILES=\
20 describe-instance-status.fln\
21 describe-instances.fln\
22 describe-tags.fln\
23 start-instances.fln\
24 stop-instances.fln
25
26EXTRA_DIST=$(FLNFILES) default.fln eclat.cfin
27
28noinst_SCRIPTS=eclat.conf
29CLEANFILES=eclat.conf
30SUFFIXES=.cfin .conf
31
32if SPLIT_FORMATS
33SUFFIXES += .forlan .fln
34.fln.forlan:
35 $(AM_V_GEN)$(abs_builddir)/flncat $< default.fln > $@
36formatdir = @FORMATDIR@
37noinst_SCRIPTS += $(FLNFILES:.fln=.forlan)
38CLEANFILES += $(FLNFILES:.fln=.forlan)
39FORMATNAME = $${command}
40else
41formatdir = @FORMATDIR@
42noinst_SCRIPTS += eclat.forlan
43CLEANFILES += eclat.forlan
44eclat.forlan: $(FLNFILES) default.fln
45 $(AM_V_GEN)(cd $(srcdir); $(abs_builddir)/flncat $(FLNFILES) default.fln) > eclat.forlan
46FORMATNAME = eclat
47endif
48
49.cfin.conf:
50 $(AM_V_GEN)sed 's^FORMATDIR^$(formatdir)^;s^FORMATNAME^$(FORMATNAME)^' $< > $@
51
52install-data-local:
53 @test -z "$(DESTDIR)$(sysconfdir)" || $(mkdir_p) "$(DESTDIR)$(sysconfdir)"
54 @if [ -r $(DESTDIR)$(sysconfdir)/eclat.conf ]; then :; \
55 else ${INSTALL} -m 644 $(top_srcdir)/src/eclat.conf \
56 $(DESTDIR)$(sysconfdir)/eclat.conf; \
57 for file in $(noinst_SCRIPTS); do \
58 ${INSTALL} -m 644 $$file $(DESTDIR)$(formatdir)/$$file; \
59 done; \
60 fi
diff --git a/etc/default.fln b/etc/default.fln
new file mode 100644
index 0000000..2e2f690
--- /dev/null
+++ b/etc/default.fln
@@ -0,0 +1,22 @@
1/* This file is part of Eclat.
2 Copyright (C) 2012 Sergey Poznyakoff.
3
4 Eclat 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 Eclat 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 Eclat. If not, see <http://www.gnu.org/licenses/>. */
16
17if (.Response.Errors)
18 error("Error: ",.Response.Errors.Error.Message,"\n");
19else {
20 error("Unrecognized response:\n");
21 dump(.);
22}
diff --git a/etc/describe-instance-status.fln b/etc/describe-instance-status.fln
new file mode 100644
index 0000000..85b88b3
--- /dev/null
+++ b/etc/describe-instance-status.fln
@@ -0,0 +1,36 @@
1/* This file is part of Eclat.
2 Copyright (C) 2012 Sergey Poznyakoff.
3
4 Eclat 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 Eclat 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 Eclat. If not, see <http://www.gnu.org/licenses/>. */
16
17if (.DescribeInstanceStatusResponse.instanceStatusSet) {
18 for (var in .DescribeInstanceStatusResponse.instanceStatusSet.item) {
19 print(var.instanceId,"\t",
20 var.availabilityZone,"\t",
21 var.instanceState.name);
22 if (var.instanceState.name[running]) {
23 print("\t",var.systemStatus.status);
24 for (detail in var.systemStatus.details.item) {
25 print("\tSys.",detail.name,"=",detail.status);
26 }
27 for (detail in var.instanceStatus.details.item) {
28 print("\tInst.",detail.name,"=",detail.status);
29 }
30 }
31 print("\n");
32 for (event in var.eventsSet.item) {
33 error(var.instanceId,"\t","Event: ", event.description,"\n");
34 }
35 }