Skip to content

Commit

Permalink
integrate gtest for a piecemeal conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
novas0x2a committed Jul 4, 2009
1 parent fd922a6 commit bcab7ca
Show file tree
Hide file tree
Showing 18 changed files with 64 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Expand Up @@ -101,7 +101,7 @@ all-headers:
grep '^#.*vw/' | sed -e 's#.*src/\(vw/[^"]\+\)".*#\1#' | sort -u

one-ctags-file:
ctags -R --languages=C,C++ --exclude='*thirdparty/*' --exclude='*tests/*' . --exclude='' thirdparty/cxxtest/cxxtest/TestSuite.h
ctags -R --languages=C,C++ --exclude='*thirdparty/*' --exclude='*tests/*' . --exclude='' thirdparty/cxxtest/cxxtest/TestSuite.h thirdparty/gtest

.PHONY: coverage push-coverage instantiate-all instantiate-skipped all-headers one-ctags-file

Expand Down
18 changes: 3 additions & 15 deletions config/rules.mak
Expand Up @@ -5,24 +5,12 @@
# __END_LICENSE__


########################################################################
# tests (using cxxtest)
########################################################################

SUFFIXES = .cxx

CXXTEST_DIR = $(top_srcdir)/thirdparty/cxxtest
CXXTEST_GEN = $(CXXTEST_DIR)/cxxtestgen.pl
CXXTEST_ARGS = --error-printer

TEST_CPPFLAGS = -I$(CXXTEST_DIR) -DTEST_SRCDIR="\"$(top_srcdir)/$(subdir)\""

.h.cxx:
$(CXXTEST_GEN) $(CXXTEST_ARGS) -o $@ $<

newtest:
@if test -z "$(NAME)"; then echo "run make NAME=TestName [MODULE=ModuleName] newtest"; else $(top_srcdir)/scripts/create-test.sh $(NAME) $(MODULE); fi

.PHONY: newtest

SUFFIXES = .totallyfakeplaceholder
include $(top_srcdir)/thirdparty/autotroll.mak

# vim: filetype=automake:
15 changes: 15 additions & 0 deletions config/tests.am
@@ -0,0 +1,15 @@
GTEST_DIR = $(top_srcdir)/thirdparty/gtest

libgtest_la_SOURCES = $(GTEST_DIR)/src/gtest-all.cc $(GTEST_DIR)/src/gtest_main.cc
# this empty assignment prevents AM_LDFLAGS from applying to libgtest
libgtest_la_LDFLAGS =

check_LTLIBRARIES = libgtest.la

AM_CPPFLAGS += -DTEST_SRCDIR="\"$(top_srcdir)/$(subdir)\"" -I$(GTEST_DIR) -I$(GTEST_DIR)/include -g
LDADD = libgtest.la

# This makes sure we're using the c++ linker
LINK = $(CXXLINK)

# vim: filetype=automake:
14 changes: 14 additions & 0 deletions config/tests_old.am
@@ -0,0 +1,14 @@
########################################################################
# tests (using cxxtest)
########################################################################

SUFFIXES += .cxx

CXXTEST_DIR = $(top_srcdir)/thirdparty/cxxtest
CXXTEST_GEN = $(CXXTEST_DIR)/cxxtestgen.pl
CXXTEST_ARGS = --error-printer

TEST_CPPFLAGS = -I$(CXXTEST_DIR) -DTEST_SRCDIR="\"$(top_srcdir)/$(subdir)\""

.h.cxx:
$(CXXTEST_GEN) $(CXXTEST_ARGS) -o $@ $<
1 change: 1 addition & 0 deletions src/vw/Camera/tests/Makefile.am
Expand Up @@ -40,3 +40,4 @@ EXTRA_DIST = $(TESTS:%=%.h) test.jpg
CLEANFILES = $(TESTS:%=%.cxx)

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/Cartography/tests/Makefile.am
Expand Up @@ -35,3 +35,4 @@ EXTRA_DIST = $(TESTS:%=%.h)
CLEANFILES = $(TESTS:%=%.cxx)

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/Core/tests/Makefile.am
Expand Up @@ -39,3 +39,4 @@ EXTRA_DIST = $(TESTS:%=%.h)
CLEANFILES = $(TESTS:%=%.cxx) log.txt

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/FileIO/tests/Makefile.am
Expand Up @@ -35,3 +35,4 @@ EXTRA_DIST = $(TESTS:%=%.h) rgb2x2.png rgb2x2.tif rgb2x2.jpg png16.png
CLEANFILES = $(TESTS:%=%.cxx) tmp.png tmp.tif rwtest.* test-png16.png

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/GPU/tests/Makefile.am
Expand Up @@ -39,3 +39,4 @@ EXTRA_DIST = $(TESTS:%=%.h) test_images/lighthouse-1000x1000.png
CLEANFILES = $(TESTS:%=%.cxx)

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/Geometry/tests/Makefile.am
Expand Up @@ -32,3 +32,4 @@ EXTRA_DIST = $(TESTS:%=%.h)
CLEANFILES = $(TESTS:%=%.cxx)

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/HDR/tests/Makefile.am
Expand Up @@ -31,3 +31,4 @@ EXTRA_DIST = $(TESTS:%=%.h)
CLEANFILES = $(TESTS:%=%.cxx)

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/Image/tests/Makefile.am
Expand Up @@ -48,3 +48,4 @@ EXTRA_DIST = $(TESTS:%=%.h)
CLEANFILES = $(TESTS:%=%.cxx)

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/InterestPoint/tests/Makefile.am
Expand Up @@ -33,3 +33,4 @@ EXTRA_DIST = $(TESTS:%=%.h) sub.png noisy_gradient_60.png
CLEANFILES = $(TESTS:%=%.cxx)

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/Math/tests/Makefile.am
Expand Up @@ -52,3 +52,4 @@ EXTRA_DIST = $(TESTS:%=%.h)
CLEANFILES = $(TESTS:%=%.cxx)

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/Mosaic/tests/Makefile.am
Expand Up @@ -29,3 +29,4 @@ EXTRA_DIST = $(TESTS:%=%.h)
CLEANFILES = $(TESTS:%=%.cxx)

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/Stereo/tests/Makefile.am
Expand Up @@ -33,3 +33,4 @@ EXTRA_DIST = $(TESTS:%=%.h)
CLEANFILES = $(TESTS:%=%.cxx)

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
1 change: 1 addition & 0 deletions src/vw/tests/Makefile.am
Expand Up @@ -32,3 +32,4 @@ EXTRA_DIST = $(TESTS:%=%.h) mural.png mural.jpg
CLEANFILES = $(TESTS:%=%.cxx) cropped.mural.* mural.tif

include $(top_srcdir)/config/rules.mak
include $(top_srcdir)/config/tests_old.am
18 changes: 18 additions & 0 deletions src/vw/tests/config_test.h
@@ -0,0 +1,18 @@
#ifndef __VW_TESTS_CONFIG_TEST_H__
#define __VW_TESTS_CONFIG_TEST_H__

#include <vw/config.h>

#if defined(VW_ENABLE_EXCEPTIONS) && (VW_ENABLE_EXCEPTIONS==1)
#define HAS_EXCEPTIONS(x) x
#else
#define HAS_EXCEPTIONS(x) DISABLED_ ## x
#endif

#if defined(VW_ENABLE_CONFIG_FILE) && (VW_ENABLE_CONFIG_FILE==1)
#define HAS_CONFIG_FILE(x) x
#else
#define HAS_CONFIG_FILE(x) DISABLED_ ## x
#endif

#endif

0 comments on commit bcab7ca

Please sign in to comment.