diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-09-28 11:23:09 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2012-09-28 11:32:04 +0300 |
commit | ac1d6cbbcf5323d5db59886b98a24c45bafa64b8 (patch) | |
tree | f2a77092e072faa680b47d9d6d960e7214e46876 /tests | |
parent | d902742081bc31a6eda274268da0178107e4abb4 (diff) | |
download | eclat-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.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.gitignore | 1 | ||||
-rw-r--r-- | tests/Makefile.am | 6 | ||||
-rw-r--r-- | tests/describe-instance-status.at | 154 | ||||
-rw-r--r-- | tests/describe-instances.at | 274 | ||||
-rw-r--r-- | tests/describe-tags.at | 68 | ||||
-rw-r--r-- | tests/dscrinststat.at | 128 | ||||
-rw-r--r-- | tests/start-instances.at | 38 | ||||
-rw-r--r-- | tests/stop-instances.at | 39 | ||||
-rw-r--r-- | tests/testsuite.at | 17 | ||||
-rw-r--r-- | tests/trws.c | 46 |
10 files changed, 771 insertions, 0 deletions
diff --git a/tests/.gitignore b/tests/.gitignore index 8b76ee0..06ac629 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -6,5 +6,6 @@ testsuite.dir testsuite.log tforlan thmac +trws turlenc txml diff --git a/tests/Makefile.am b/tests/Makefile.am index 4af19e3..99c2ae6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -40,6 +40,9 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac ## ------------ ## TESTSUITE_AT = \ + describe-instance-status.at\ + describe-instances.at\ + describe-tags.at\ dump01.at\ dump02.at\ forlan01.at\ @@ -52,6 +55,8 @@ TESTSUITE_AT = \ print01.at\ print02.at\ print03.at\ + start-instances.at\ + stop-instances.at\ tagshairy.at\ testsuite.at\ urlenc01.at\ @@ -81,6 +86,7 @@ check-local: atconfig atlocal $(TESTSUITE) noinst_PROGRAMS = \ tforlan\ thmac\ + trws\ turlenc\ txml diff --git a/tests/describe-instance-status.at b/tests/describe-instance-status.at new file mode 100644 index 0000000..e01b5fc --- /dev/null +++ b/tests/describe-instance-status.at @@ -0,0 +1,154 @@ +# This file is part of Eclat -*- Autotest -*- +# Copyright (C) 2012 Sergey Poznyakoff +# +# Eclat 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. +# +# Eclat 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 Eclat. If not, see <http://www.gnu.org/licenses/>. + +ECLAT_TEST_FORMAT([DescribeInstanceStatus], +[DescribeInstanceStatus], +[describe-instance-status.fln], +[<DescribeInstanceStatusResponse xmlns='http://ec2.amazonaws.com/doc/2012-04-01/'> + <requestId>3be1508e-c444-4fef-89cc-0b1223c4f02f</requestId> + <instanceStatusSet> + <item> + <instanceId>i-283f9f47</instanceId> + <availabilityZone>us-east-1d</availabilityZone> + <instanceState> + <code>16</code> + <name>running</name> + </instanceState> + <systemStatus> + <status>impaired</status> + <details> + <item> + <name>reachability</name> + <status>failed</status> + <impairedSince>2012-03-27T16:10:46.000Z</impairedSince> + </item> + </details> + </systemStatus> + <instanceStatus> + <status>impaired</status> + <details> + <item> + <name>reachability</name> + <status>failed</status> + <impairedSince>2012-03-27T16:10:46.000Z</impairedSince> + </item> + </details> + </instanceStatus> + <eventsSet> + <item> + <code>instance-retirement</code> + <notBefore>2011-12-05T13:00:00+0000</notBefore> + <notAfter>2011-12-06T13:00:00+000</notAfter> + <description>The instance is running on degraded hardware</description> + </item> + </eventsSet> + </item> + <item> + <instanceId>i-d2e36dbd</instanceId> + <availabilityZone>us-east-1d</availabilityZone> + <instanceState> + <code>16</code> + <name>running</name> + </instanceState> + <systemStatus> + <status>ok</status> + <details> + <item> + <name>reachability</name> + <status>passed</status> + </item> + </details> + </systemStatus> + <instanceStatus> + <status>ok</status> + <details> + <item> + <name>reachability</name> + <status>passed</status> + </item> + </details> + </instanceStatus> + <eventsSet> + <item> + <code>instance-reboot</code> + <notBefore>2011-12-05T13:00:00+0000</notBefore> + <notAfter>2011-12-06T13:00:00+000</notAfter> + <description>The instance is scheduled for a reboot</description> + </item> + </eventsSet> + </item> + <item> + <instanceId>i-9fa454f1</instanceId> + <availabilityZone>us-east-1c</availabilityZone> + <instanceState> + <code>16</code> + <name>running</name> + </instanceState> + <systemStatus> + <status>ok</status> + <details> + <item> + <name>reachability</name> + <status>passed</status> + </item> + </details> + </systemStatus> + <instanceStatus> + <status>ok</status> + <details> + <item> + <name>reachability</name> + <status>passed</status> + </item> + </details> + </instanceStatus> + </item> + <item> + <instanceId>i-0ed2936e</instanceId> + <availabilityZone>us-east-1c</availabilityZone> + <instanceState> + <code>16</code> + <name>running</name> + </instanceState> + <systemStatus> + <status>ok</status> + <details> + <item> + <name>reachability</name> + <status>passed</status> + </item> + </details> + </systemStatus> + <instanceStatus> + <status>insufficient-data</status> + <details> + <item> + <name>reachability</name> + <status>insufficient-data</status> + </item> + </details> + </instanceStatus> + </item> + </instanceStatusSet> +</DescribeInstanceStatusResponse> +],[i-283f9f47 us-east-1d running impaired Sys.reachability=failed Inst.reachability=failed +i-d2e36dbd us-east-1d running ok Sys.reachability=passed Inst.reachability=passed +i-9fa454f1 us-east-1c running ok Sys.reachability=passed Inst.reachability=passed +i-0ed2936e us-east-1c running ok Sys.reachability=passed Inst.reachability=insufficient-data +], +[i-283f9f47 Event: "The instance is running on degraded hardware" +i-d2e36dbd Event: "The instance is scheduled for a reboot" +]) diff --git a/tests/describe-instances.at b/tests/describe-instances.at new file mode 100644 index 0000000..2c862c8 --- /dev/null +++ b/tests/describe-instances.at @@ -0,0 +1,274 @@ +# This file is part of Eclat -*- Autotest -*- +# Copyright (C) 2012 Sergey Poznyakoff +# +# Eclat 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. +# +# Eclat 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 Eclat. If not, see <http://www.gnu.org/licenses/>. + +ECLAT_TEST_FORMAT([DescribeInstances], +[DescribeInstances], +[describe-instances.fln], +[<DescribeInstancesResponse xmlns='http://ec2.amazonaws.com/doc/2012-08-15/'> + <requestId>fdcdcab1-ae5c-489e-9c33-4637c5dda355</requestId> + <reservationSet> + <item> + <reservationId>r-0ece705a</reservationId> + <ownerId>053230519467</ownerId> + <groupSet/> + <instancesSet> + <item> + <instanceId>i-7a00642e</instanceId> + <imageId>ami-1cd4924e</imageId> + <instanceState> + <code>16</code> + <name>running</name> + </instanceState> + <privateDnsName/> + <dnsName/> + <reason/> + <keyName>VPCKey</keyName> + <amiLaunchIndex>0</amiLaunchIndex> + <productCodes/> + <instanceType>c1.medium</instanceType> + <launchTime>2012-06-28T17:41:48.000Z</launchTime> + <placement> + <availabilityZone>ap-southeast-1b</availabilityZone> + <groupName/> + <tenancy>default</tenancy> + </placement> + <platform>windows</platform> + <monitoring> + <state>disabled</state> + </monitoring> + <subnetId>subnet-c53c87ac</subnetId> + <vpcId>vpc-cc3c87a5</vpcId> + <privateIpAddress>10.0.0.12</privateIpAddress> + <ipAddress>46.51.219.63</ipAddress> + <sourceDestCheck>true</sourceDestCheck> + <groupSet> + <item> + <groupId>sg-374b565b</groupId> + <groupName>quick-start-3</groupName> + </item> + </groupSet> + <architecture>x86_64</architecture> + <rootDeviceType>ebs</rootDeviceType> + <rootDeviceName>/dev/sda1</rootDeviceName> + <blockDeviceMapping> + <item> + <deviceName>/dev/sda1</deviceName> + <ebs> + <volumeId>vol-9e151bfc</volumeId> + <status>attached</status> + <attachTime>2012-06-28T17:42:05.000Z</attachTime> + <deleteOnTermination>true</deleteOnTermination> + </ebs> + </item> + </blockDeviceMapping> + <virtualizationType>hvm</virtualizationType> + <clientToken>JNlxa1340905307390</clientToken> + <tagSet> + <item> + <key>Name</key> + <value>SingleENI</value> + </item> + </tagSet> + <hypervisor>xen</hypervisor> + <networkInterfaceSet> + <item> + <networkInterfaceId>eni-d83388b1</networkInterfaceId> + <subnetId>subnet-c53c87ac</subnetId> + <vpcId>vpc-cc3c87a5</vpcId> + <description>Primary network interface</description> + <ownerId>053230519467</ownerId> + <status>in-use</status> + <privateIpAddress>10.0.0.12</privateIpAddress> + <sourceDestCheck>true</sourceDestCheck> + <groupSet> + <item> + <groupId>sg-374b565b</groupId> + <groupName>quick-start-3</groupName> + </item> + </groupSet> + <attachment> + <attachmentId>eni-attach-31b87358</attachmentId> + <deviceIndex>0</deviceIndex> + <status>attached</status> + <attachTime>2012-06-28T17:41:48.000Z</attachTime> + <deleteOnTermination>true</deleteOnTermination> + </attachment> + <association> + <publicIp>46.51.219.63</publicIp> + <ipOwnerId>053230519467</ipOwnerId> + </association> + <privateIpAddressesSet> + <item> + <privateIpAddress>10.0.0.12</privateIpAddress> + <primary>true</primary> + <association> + <publicIp>46.51.219.63</publicIp> + <ipOwnerId>053230519467</ipOwnerId> + </association> + </item> + <item> + <privateIpAddress>10.0.0.14</privateIpAddress> + <primary>false</primary> + <association> + <publicIp>46.51.221.177</publicIp> + <ipOwnerId>053230519467</ipOwnerId> + </association> + </item> + </privateIpAddressesSet> + </item> + </networkInterfaceSet> + </item> + </instancesSet> + </item> + <item> + <reservationId>r-58b30a0c</reservationId> + <ownerId>053230519467</ownerId> + <groupSet> + <item> + <groupId>sg-aa4170f8</groupId> + <groupName>quick-start-5</groupName> + </item> + </groupSet> + <instancesSet> + <item> + <instanceId>i-507f1804</instanceId> + <imageId>ami-70d49222</imageId> + <instanceState> + <code>16</code> + <name>running</name> + </instanceState> + <privateDnsName>ip-10-139-34-251.ap-southeast-1.compute.internal</privateDnsName> + <dnsName>ec2-122-248-233-255.ap-southeast-1.compute.amazonaws.com</dnsName> + <reason/> + <keyName>EC2Key</keyName> + <amiLaunchIndex>0</amiLaunchIndex> + <productCodes/> + <instanceType>t1.micro</instanceType> + <launchTime>2012-06-29T22:53:42.000Z</launchTime> + <placement> + <availabilityZone>ap-southeast-1a</availabilityZone> + <groupName/> + <tenancy>default</tenancy> + </placement> + <platform>windows</platform> + <monitoring> + <state>disabled</state> + </monitoring> + <privateIpAddress>10.139.34.251</privateIpAddress> + <ipAddress>122.248.233.255</ipAddress> + <groupSet> + <item> + <groupId>sg-aa4170f8</groupId> + <groupName>quick-start-5</groupName> + </item> + </groupSet> + <architecture>x86_64</architecture> + <rootDeviceType>ebs</rootDeviceType> + <rootDeviceName>/dev/sda1</rootDeviceName> + <blockDeviceMapping> + <item> + <deviceName>/dev/sda1</deviceName> + <ebs> + <volumeId>vol-a22b3ac0</volumeId> + <status>attached</status> + <attachTime>2012-06-29T22:54:02.000Z</attachTime> + <deleteOnTermination>true</deleteOnTermination> + </ebs> + </item> + </blockDeviceMapping> + <virtualizationType>hvm</virtualizationType> + <clientToken>clNwH1341010421443</clientToken> + <tagSet> + <item> + <key>Name</key> + <value>EC2 Instance</value> + </item> + </tagSet> + <hypervisor>xen</hypervisor> + <networkInterfaceSet/> + </item> + </instancesSet> + </item> + </reservationSet> +</DescribeInstancesResponse> +], +[Reservation ID: r-0ece705a +Owner ID: 053230519467 +Groups: + +Instance: i-7a00642e + Image ID: ami-1cd4924e + State: running + Kernel ID: + Architecture: x86_64 + Private DNS: + Public DNS: + Key: VPCKey + Type: c1.medium + Launch Time: 2012-06-28T17:41:48.000Z + Availability Zone: ap-southeast-1b + Group Name: + Tenancy: default + Private IP: 10.0.0.12 + Public IP: 46.51.219.63 + Groups: + sg-374b565b -- quick-start-3 + Root Device Type: ebs + Root Device Name: /dev/sda1 + Device mapping: + /dev/sda1 vol-9e151bfc attached 2012-06-28T17:42:05.000Z true + Virtualization: hvm + Tag Set: + Name=SingleENI + Hypervisor: xen + EBS Optimized: +End of instance + +Reservation ID: r-58b30a0c +Owner ID: 053230519467 +Groups: + sg-aa4170f8 quick-start-5 + +Instance: i-507f1804 + Image ID: ami-70d49222 + State: running + Kernel ID: + Architecture: x86_64 + Private DNS: ip-10-139-34-251.ap-southeast-1.compute.internal + Public DNS: ec2-122-248-233-255.ap-southeast-1.compute.amazonaws.com + Key: EC2Key + Type: t1.micro + Launch Time: 2012-06-29T22:53:42.000Z + Availability Zone: ap-southeast-1a + Group Name: + Tenancy: default + Private IP: 10.139.34.251 + Public IP: 122.248.233.255 + Groups: + sg-aa4170f8 -- quick-start-5 + Root Device Type: ebs + Root Device Name: /dev/sda1 + Device mapping: + /dev/sda1 vol-a22b3ac0 attached 2012-06-29T22:54:02.000Z true + Virtualization: hvm + Tag Set: + Name="EC2 Instance" + Hypervisor: xen + EBS Optimized: +End of instance + +]) + diff --git a/tests/describe-tags.at b/tests/describe-tags.at new file mode 100644 index 0000000..d91a6e7 --- /dev/null +++ b/tests/describe-tags.at @@ -0,0 +1,68 @@ +# This file is part of Eclat -*- Autotest -*- +# Copyright (C) 2012 Sergey Poznyakoff +# +# Eclat 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. +# +# Eclat 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 Eclat. If not, see <http://www.gnu.org/licenses/>. + +ECLAT_TEST_FORMAT([DescribeTags], +[DescribeTags], +[describe-tags.fln], +[<DescribeTagsResponse xmlns="http://ec2.amazonaws.com/doc/2012-08-15/"> + <requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId> + <tagSet> + <item> + <resourceId>ami-1a2b3c4d</resourceId> + <resourceType>image</resourceType> + <key>webserver</key> + <value/> + </item> + <item> + <resourceId>ami-1a2b3c4d</resourceId> + <resourceType>image</resourceType> + <key>stack</key> + <value>Production</value> + </item> + <item> + <resourceId>i-5f4e3d2a</resourceId> + <resourceType>instance</resourceType> + <key>webserver</key> + <value/> + </item> + <item> + <resourceId>i-5f4e3d2a</resourceId> + <resourceType>instance</resourceType> + <key>stack</key> + <value>Production</value> + </item> + <item> + <resourceId>i-12345678</resourceId> + <resourceType>instance</resourceType> + <key>database_server</key> + <value/> + </item> + <item> + <resourceId>i-12345678</resourceId> + <resourceType>instance</resourceType> + <key>stack</key> + <value>Test</value> + </item> + </tagSet> +</DescribeTagsResponse> +], +[ami-1a2b3c4d image webserver +ami-1a2b3c4d image stack Production +i-5f4e3d2a instance webserver +i-5f4e3d2a instance stack Production +i-12345678 instance database_server +i-12345678 instance stack Test +])
\ No newline at end of file diff --git a/tests/dscrinststat.at b/tests/dscrinststat.at new file mode 100644 index 0000000..de733c1 --- /dev/null +++ b/tests/dscrinststat.at @@ -0,0 +1,128 @@ +AT_DATA([result],[<DescribeInstanceStatusResponse xmlns='http://ec2.amazonaws.com/doc/2012-04-01/'> + <requestId>3be1508e-c444-4fef-89cc-0b1223c4f02f</requestId> + <instanceStatusSet> + <item> + <instanceId>i-283f9f47</instanceId> + <availabilityZone>us-east-1d</availabilityZone> + <instanceState> + <code>16</code> + <name>running</name> + </instanceState> + <systemStatus> + <status>impaired</status> + <details> + <item> + <name>reachability</name> + <status>failed</status> + <impairedSince>2012-03-27T16:10:46.000Z</impairedSince> + </item> + </details> + </systemStatus> + <instanceStatus> + <status>impaired</status> + <details> + <item> + <name>reachability</name> + <status>failed</status> + <impairedSince>2012-03-27T16:10:46.000Z</impairedSince> + </item> + </details> + </instanceStatus> + <eventsSet> + <code>instance-retirement</code> + <notBefore>2011-12-05T13:00:00+0000</notBefore> + <notAfter>2011-12-06T13:00:00+000</notAfter> + <description> + The instance is running on degraded hardware + </description> + </eventsSet> + </item> + <item> + <instanceId>i-d2e36dbd</instanceId> + <availabilityZone>us-east-1d</availabilityZone> + <instanceState> + <code>16</code> + <name>running</name> + </instanceState> + <systemStatus> + <status>ok</status> + <details> + <item> + <name>reachability</name> + <status>passed</status> + </item> + </details> + </systemStatus> + <instanceStatus> + <status>ok</status> + <details> + <item> + <name>reachability</name> + <status>passed</status> + </item> + </details> + </instanceStatus> + <eventsSet> + <code>instance-reboot</code> + <notBefore>2011-12-05T13:00:00+0000</notBefore> + <notAfter>2011-12-06T13:00:00+000</notAfter> + <description> + The instance is scheduled for a reboot + </description> + </eventsSet> + </item> + <item> + <instanceId>i-9fa454f1</instanceId> + <availabilityZone>us-east-1c</availabilityZone> + <instanceState> + <code>16</code> + <name>running</name> + </instanceState> + <systemStatus> + <status>ok</status> + <details> + <item> + <name>reachability</name> + <status>passed</status> + </item> + </details> + </systemStatus> + <instanceStatus> + <status>ok</status> + <details> + <item> + <name>reachability</name> + <status>passed</status> + </item> + </details> + </instanceStatus> + </item> + <item> + <instanceId>i-0ed2936e</instanceId> + <availabilityZone>us-east-1c</availabilityZone> + <instanceState> + <code>16</code> + <name>running</name> + </instanceState> + <systemStatus> + <status>ok</status> + <details> + <item> + <name>reachability</name> + <status>passed</status> + </item> + </details> + </systemStatus> + <instanceStatus> + <status>insufficient-data</status> + <details> + <item> + <name>reachability</name> + <status>insufficient-data</status> + </item> + </details> + </instanceStatus> + </item> + </instanceStatusSet> +</DescribeInstanceStatusResponse> +]) diff --git a/tests/start-instances.at b/tests/start-instances.at new file mode 100644 index 0000000..fec42c7 --- /dev/null +++ b/tests/start-instances.at @@ -0,0 +1,38 @@ +# This file is part of Eclat -*- Autotest -*- +# Copyright (C) 2012 Sergey Poznyakoff +# +# Eclat 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. +# +# Eclat 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 Eclat. If not, see <http://www.gnu.org/licenses/>. + +ECLAT_TEST_FORMAT([StartInstances], +[StartInstances], +[start-instances.fln], +[<StartInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2012-08-15/"> + <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> + <instancesSet> + <item> + <instanceId>i-10a64379</instanceId> + <currentState> + <code>0</code> + <name>pending</name> + </currentState> + <previousState> + <code>80</code> + <name>stopped</name> + </previousState> + </item> + </instancesSet> +</StartInstancesResponse> +], +[i-10a64379: stopped => pending +]) diff --git a/tests/stop-instances.at b/tests/stop-instances.at new file mode 100644 index 0000000..a2dcd45 --- /dev/null +++ b/tests/stop-instances.at @@ -0,0 +1,39 @@ +# This file is part of Eclat -*- Autotest -*- +# Copyright (C) 2012 Sergey Poznyakoff +# +# Eclat 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. +# +# Eclat 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 Eclat. If not, see <http://www.gnu.org/licenses/>. + +ECLAT_TEST_FORMAT([StopInstances], +[StopInstances], +[stop-instances.fln], +[<StopInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2012-08-15/"> + <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> + <instancesSet> + <item> + <instanceId>i-10a64379</instanceId> + <currentState> + <code>64</code> + <name>stopping</name> + </currentState> + <previousState> + <code>16</code> + <name>running</name> + </previousState> + </item> + </instancesSet> +</StopInstancesResponse> +], +[i-10a64379: running => stopping +]) + diff --git a/tests/testsuite.at b/tests/testsuite.at index 87a7f7c..55fe2d4 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -18,6 +18,16 @@ m4_version_prereq([2.52g]) m4_define([AT_SKIP_TEST],[exit 77]) +dnl ECLAT_TEST_FORMAT DESCR KW FILE INPUT OUTPUT STDERR +dnl $1 $2 $3 $4 $5 $6 +m4_define([ECLAT_TEST_FORMAT],[ +AT_SETUP([$1]) +AT_KEYWORDS([format dflfmt $2]) +AT_DATA([result],[$4]) +AT_CHECK([tforlan $[]abs_top_srcdir/etc/$3 result|trws],[0],[$5],[$6]) +AT_CLEANUP +]) + AT_INIT AT_BANNER([HMAC-SHA1]) m4_include(hmac01.at) @@ -42,4 +52,11 @@ m4_include([let.at]) m4_include([listall.at]) m4_include([tagshairy.at]) +AT_BANNER([Default formats]) +m4_include([describe-instance-status.at]) +m4_include([describe-instances.at]) +m4_include([describe-tags.at]) +m4_include([start-instances.at]) +m4_include([stop-instances.at]) + # End of testsuite.at diff --git a/tests/trws.c b/tests/trws.c new file mode 100644 index 0000000..d288759 --- /dev/null +++ b/tests/trws.c @@ -0,0 +1,46 @@ +/* This file is part of Eclat. + Copyright (C) 2012 Sergey Poznyakoff. + + Eclat 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. + + Eclat 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 Eclat. If not, see <http://www.gnu.org/licenses/>. */ + +/* This program filters out trailing whitespace from the input. */ + +#include <stdio.h> +#include <assert.h> + +int +main() +{ + char buf[512]; + size_t lev = 0; + int c; + + while ((c = getchar()) != EOF) { + if (c == ' ' || c == '\t') { + assert(lev < sizeof(buf)); + buf[lev++] = c; + continue; + } else if (c == '\n') + lev = 0; + else if (lev) { + fwrite(buf, lev, 1, stdout); + lev = 0; + } + putchar(c); + } + assert(!ferror(stdout)); + return 0; +} + + |