thin-provisioning-tools/unit-tests/Makefile.in

116 lines
3.7 KiB
Makefile
Raw Normal View History

2011-12-21 17:00:50 +05:30
# Copyright (C) 2011 Red Hat, Inc. All rights reserved.
#
# This file is part of the thin-provisioning-tools source.
#
# thin-provisioning-tools 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 of
# the License, or (at your option) any later version.
#
# thin-provisioning-tools 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 thin-provisioning-tools. If not, see
# <http://www.gnu.org/licenses/>.
TEST_SOURCE=\
2013-02-01 17:30:49 +05:30
unit-tests/array_block_t.cc \
2013-03-13 18:58:03 +05:30
unit-tests/array_t.cc \
2013-03-14 18:43:18 +05:30
unit-tests/bitset_t.cc \
unit-tests/cache_t.cc \
unit-tests/block_t.cc \
unit-tests/btree_t.cc \
unit-tests/endian_t.cc \
2013-01-10 16:56:29 +05:30
unit-tests/space_map_t.cc \
unit-tests/transaction_manager_t.cc
2011-12-21 17:00:50 +05:30
TEST_PROGRAMS=$(subst .cc,,$(TEST_SOURCE))
unit-test: $(TEST_PROGRAMS)
2013-02-01 17:30:49 +05:30
r=0; for p in $(TEST_PROGRAMS); do echo Running $$p; ./$$p; [ $$? -ne 0 ] && r=1; done; exit $$r
2011-12-21 17:00:50 +05:30
.PHONY: unit-test
2013-03-13 18:58:03 +05:30
unit-tests/array_t: unit-tests/array_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2013-02-01 17:30:49 +05:30
unit-tests/array_block_t: unit-tests/array_block_t.o $(OBJECTS)
2013-01-29 17:05:37 +05:30
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2013-03-14 18:43:18 +05:30
unit-tests/bitset_t: unit-tests/bitset_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
unit-tests/block_t: unit-tests/block_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-12-21 17:00:50 +05:30
unit-tests/btree_t: unit-tests/btree_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-12-21 17:00:50 +05:30
unit-tests/cache_t: unit-tests/cache_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-12-21 17:00:50 +05:30
unit-tests/run_list_t: unit-tests/run_list_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-12-21 17:00:50 +05:30
unit-tests/space_map_t: unit-tests/space_map_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-12-21 17:00:50 +05:30
unit-tests/space_map_disk_t: unit-tests/space_map_disk_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-12-21 17:00:50 +05:30
unit-tests/transaction_manager_t: unit-tests/transaction_manager_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-12-21 17:00:50 +05:30
unit-tests/metadata_t: unit-tests/metadata_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-12-21 17:00:50 +05:30
unit-tests/endian_t: unit-tests/endian_t.o $(OBJECTS)
g++ $(CXXFLAGS) $(INCLUDES) -o $@ $+ $(LIBS) $(LIBEXPAT)
2011-12-21 17:00:50 +05:30
2013-03-22 16:25:55 +05:30
#----------------------------------------------------------------
# gmock tests
GMOCK_DIR=gmock-1.6.0/
GMOCK_INCLUDES=\
-Igmock-1.6.0/include \
-Igmock-1.6.0/gtest/include
GMOCK_LIBS=\
-Llib -lgmock -lpthread
2013-03-22 17:40:51 +05:30
GMOCK_DEPS=\
$(wildcard $(GMOCK_DIR)/include/*.h) \
$(wildcard $(GMOCK_DIR)/src/*.cc) \
$(wildcard $(GMOCK_DIR)/gtest/include/*.h) \
$(wildcard $(GMOCK_DIR)/gtest/src/*.cc)
lib/libgmock.a: $(GMOCK_DEPS)
2013-03-22 16:25:55 +05:30
g++ $(GMOCK_INCLUDES) -I$(GMOCK_DIR)/gtest -c $(GMOCK_DIR)/gtest/src/gtest-all.cc
g++ $(GMOCK_INCLUDES) -I$(GMOCK_DIR) -c $(GMOCK_DIR)/src/gmock-all.cc
ar -rv lib/libgmock.a gtest-all.o gmock-all.o
2013-03-22 17:34:38 +05:30
MOCK_SOURCE=\
unit-tests/gmock_main.cc \
\
unit-tests/buffer_t.cc
# .gmo files are plain .o files, only they've been built with gmock
# include paths.
.SUFFIXES: .gmo
%.gmo: %.cc
2013-03-22 17:49:31 +05:30
@echo " [CXX] $<"
$(V) $(CXX) -c $(INCLUDES) $(GMOCK_INCLUDES) $(CXXFLAGS) -o $@ $<
2013-03-22 17:34:38 +05:30
MOCK_OBJECTS=$(subst .cc,.gmo,$(MOCK_SOURCE))
2013-03-22 16:25:55 +05:30
2013-03-22 17:40:51 +05:30
unit-tests/gmock_tests: $(MOCK_OBJECTS) lib/libgmock.a
2013-03-22 17:49:31 +05:30
@echo " [LD] $<"
$(V) g++ $(CXXFLAGS) -o $@ $(MOCK_OBJECTS) $(LIBS) $(GMOCK_LIBS)
2013-03-22 16:25:55 +05:30
2011-12-21 17:00:50 +05:30
all: $(TEST_PROGRAMS)