Add unit test suites with initial successful dummy test (#781978)

Now 'make check' will additionally build and run the test suites in the
./tests directory.  Add initial always successful dummy test suite.
This is done using Automake support for testing.

    Automake Manual, 15 Support for test suites
    https://www.gnu.org/software/automake/manual/automake.html#Tests

./tests/Makefile.am takes some influence from the same file in the
minimal-gtest-autotools template project.
    654848ec01/tests/Makefile.am

Bug 781978 - Add Google Test C++ test framework
This commit is contained in:
Mike Fleetwood 2017-04-30 12:34:37 +01:00 committed by Curtis Gedak
parent 81b104928b
commit dceb293f15
5 changed files with 40 additions and 1 deletions

5
.gitignore vendored
View File

@ -43,5 +43,10 @@ missing
mkinstalldirs
omf.make
stamp-*
test-driver
testbuild.log
tests/*.log
tests/*.trs
tests/test-suite.log
tests/test_dummy
xmldocs.make

View File

@ -1,4 +1,4 @@
SUBDIRS = compose data doc include lib po src
SUBDIRS = compose data doc include lib po src tests
# Only build GParted help documentation when enabled. (Can be disabled
# with './configure --disable-doc').
if BUILD_HELP_DOC

View File

@ -383,6 +383,7 @@ lib/Makefile
lib/gtest/Makefile
src/Makefile
po/Makefile.in
tests/Makefile
])
AC_OUTPUT

19
tests/Makefile.am Normal file
View File

@ -0,0 +1,19 @@
AM_CPPFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib/gtest/include \
$(GTEST_CPPFLAGS)
AM_CXXFLAGS = -Wall $(GTEST_CXXFLAGS)
AM_LDFLAGS = $(GTEST_LDFLAGS)
LDADD = \
$(GTEST_LIBS) \
$(top_srcdir)/lib/gtest/lib/libgtest_main.la \
$(top_srcdir)/lib/gtest/lib/libgtest.la
# Programs to be built by "make check"
check_PROGRAMS = \
test_dummy
# Test cases to be run by "make check"
TESTS = $(check_PROGRAMS)
test_dummy_SOURCES = test_dummy.cc

14
tests/test_dummy.cc Normal file
View File

@ -0,0 +1,14 @@
/* Copyright (C) 2017 Mike Fleetwood
*
* Copying and distribution of this file, with or without modification,
* are permitted in any medium without royalty provided the copyright
* notice and this notice are preserved. This file is offered as-is,
* without any warranty.
*/
#include "gtest/gtest.h"
TEST( DummyTest, Success )
{
EXPECT_TRUE( true );
}