Add tests for check-news
authorMichele Tartara <mtartara@google.com>
Thu, 13 Jun 2013 12:09:40 +0000 (14:09 +0200)
committerMichele Tartara <mtartara@google.com>
Fri, 14 Jun 2013 12:04:49 +0000 (14:04 +0200)
Unit tests verifying the behaviour of the check-news script are added.

This required adding a new make target, "autotools-check" directly called from
"commit-check", because the usual tests are executed in the build directory,
whereas these, being relative to the autotools, cannot be executed there because
the files of the autotools/ directory are not copied do not belong in the build
directory.

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>

Makefile.am
test/autotools/autotools-check-news.test [new file with mode: 0644]
test/data/NEWS_OK.txt [new file with mode: 0644]
test/data/NEWS_previous_unreleased.txt [new file with mode: 0644]

index a34391f..469daea 100644 (file)
@@ -103,6 +103,7 @@ DIRS = \
        test/data/htools \
        test/data/htools/rapi \
        test/hs/shelltests \
+       test/autotools \
        lib \
        lib/build \
        lib/client \
@@ -1020,6 +1021,7 @@ maninput = \
        $(mangen)
 
 TEST_FILES = \
+       test/autotools/autotools-check-news.test \
        test/data/htools/clean-nonzero-score.data \
        test/data/htools/common-suffix.data \
        test/data/htools/empty-cluster.data \
@@ -1095,6 +1097,8 @@ TEST_FILES = \
        test/data/kvm_0.9.1_help_boot_test.txt \
        test/data/kvm_1.0_help.txt \
        test/data/kvm_1.1.2_help.txt \
+       test/data/NEWS_OK.txt \
+       test/data/NEWS_previous_unreleased.txt \
        test/data/ovfdata/compr_disk.vmdk.gz \
        test/data/ovfdata/config.ini \
        test/data/ovfdata/corrupted_resources.ovf \
@@ -1142,6 +1146,7 @@ TEST_FILES = \
        test/py/gnt-cli.test \
        test/py/import-export_unittest-helper
 
+
 python_tests = \
        doc/examples/rapi_testutils.py \
        test/py/cfgupgrade_unittest.py \
@@ -1996,7 +2001,12 @@ live-test: all
          --srcdir=.. $(HPCEXCL) ; \
        hpc report --srcdir=.. live-test $(HPCEXCL)
 
-commit-check: distcheck lint apidoc
+commit-check: autotools-check distcheck lint apidoc
+
+autotools-check:
+       TESTDATA_DIR=./test/data shelltest $(SHELLTESTARGS) \
+  $(abs_top_srcdir)/test/autotools/*-*.test \
+  -- --hide-successes
 
 .PHONY: gitignore-check
 gitignore-check:
diff --git a/test/autotools/autotools-check-news.test b/test/autotools/autotools-check-news.test
new file mode 100644 (file)
index 0000000..50d27de
--- /dev/null
@@ -0,0 +1,16 @@
+# Test a correct NEWS file against a stable release
+RELEASE=2.6.2 ./autotools/check-news < $TESTDATA_DIR/NEWS_OK.txt
+>>>= 0
+
+# Test a correct NEWS file against an alpha release
+RELEASE=2.8.0~alpha ./autotools/check-news < $TESTDATA_DIR/NEWS_OK.txt
+>>>= 0
+
+# Test a NEWS file with previous unreleased versions against a stable release
+RELEASE=2.6.2 ./autotools/check-news < $TESTDATA_DIR/NEWS_previous_unreleased.txt
+>>>2/Unreleased version after current release 2.6.2/
+>>>= !0
+
+# Test a NEWS file with previous unreleased versions against an alpha release
+RELEASE=2.8.0~alpha ./autotools/check-news < $TESTDATA_DIR/NEWS_previous_unreleased.txt
+>>>= 0
diff --git a/test/data/NEWS_OK.txt b/test/data/NEWS_OK.txt
new file mode 100644 (file)
index 0000000..922a15e
--- /dev/null
@@ -0,0 +1,80 @@
+News
+====
+
+
+Version 2.8.0 beta1
+-------------------
+
+*(unreleased)*
+
+Incompatible/important changes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- Stuff
+
+New features
+~~~~~~~~~~~~
+
+- More stuff
+
+
+Version 2.7.0 rc2
+-----------------
+
+*(Released Fri, 24 May 2013)*
+
+Incompatible/important changes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- Other stuff
+
+Since rc1:
+
+- Many bugfixes
+
+
+Version 2.7.0 rc1
+-----------------
+
+*(Released Fri, 3 May 2013)*
+
+- Things
+
+
+Version 2.7.0 beta1
+-------------------
+
+*(Released Wed, 6 Feb 2013)*
+
+This was the first beta release of the 2.7 series. All important changes
+are listed in the latest 2.7 entry.
+
+
+Version 2.6.2
+-------------
+
+*(Released Fri, 21 Dec 2012)*
+
+Hic sunt pink bunnies.
+
+
+Version 2.6.1
+-------------
+
+*(Released Fri, 12 Oct 2012)*
+
+Team members come, team members go.
+
+
+Version 2.6.0
+-------------
+
+*(Released Fri, 27 Jul 2012)*
+
+Many things happened before this point.
+
+.. vim: set textwidth=72 syntax=rst :
+.. Local Variables:
+.. mode: rst
+.. fill-column: 72
+.. End:
diff --git a/test/data/NEWS_previous_unreleased.txt b/test/data/NEWS_previous_unreleased.txt
new file mode 100644 (file)
index 0000000..431e7aa
--- /dev/null
@@ -0,0 +1,80 @@
+News
+====
+
+
+Version 2.8.0 beta1
+-------------------
+
+*(unreleased)*
+
+Incompatible/important changes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- Stuff
+
+New features
+~~~~~~~~~~~~
+
+- More stuff
+
+
+Version 2.7.0 rc2
+-----------------
+
+*(Released Fri, 24 May 2013)*
+
+Incompatible/important changes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- Other stuff
+
+Since rc1:
+
+- Many bugfixes
+
+
+Version 2.7.0 rc1
+-----------------
+
+*(Released Fri, 3 May 2013)*
+
+- Things
+
+
+Version 2.7.0 beta1
+-------------------
+
+*(Released Wed, 6 Feb 2013)*
+
+This was the first beta release of the 2.7 series. All important changes
+are listed in the latest 2.7 entry.
+
+
+Version 2.6.2
+-------------
+
+*(Released Fri, 21 Dec 2012)*
+
+Hic sunt pink bunnies.
+
+
+Version 2.6.1
+-------------
+
+*(unreleased)*
+
+Team members come, team members go.
+
+
+Version 2.6.0
+-------------
+
+*(Released Fri, 27 Jul 2012)*
+
+Many things happened before this point.
+
+.. vim: set textwidth=72 syntax=rst :
+.. Local Variables:
+.. mode: rst
+.. fill-column: 72
+.. End: