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/>.
|
|
|
|
|
2016-06-07 15:42:27 +05:30
|
|
|
GMOCK_DIR=googletest
|
2013-03-22 16:25:55 +05:30
|
|
|
GMOCK_INCLUDES=\
|
2016-06-07 15:42:27 +05:30
|
|
|
-I$(GMOCK_DIR)/googlemock/include \
|
|
|
|
-I$(GMOCK_DIR)/googletest/include
|
2013-03-22 16:25:55 +05:30
|
|
|
|
2013-06-25 18:48:38 +05:30
|
|
|
GMOCK_FLAGS=\
|
|
|
|
-Wno-unused-local-typedefs
|
|
|
|
|
2013-03-22 16:25:55 +05:30
|
|
|
GMOCK_LIBS=\
|
2014-07-29 16:04:26 +05:30
|
|
|
-Llib -lpdata -lgmock -lpthread -laio
|
2013-03-22 16:25:55 +05:30
|
|
|
|
2013-03-22 17:40:51 +05:30
|
|
|
GMOCK_DEPS=\
|
2016-06-07 15:42:27 +05:30
|
|
|
$(wildcard $(GMOCK_DIR)/googlemock/include/*.h) \
|
|
|
|
$(wildcard $(GMOCK_DIR)/googlemock/src/*.cc) \
|
|
|
|
$(wildcard $(GMOCK_DIR)/googletest/include/*.h) \
|
|
|
|
$(wildcard $(GMOCK_DIR)/googletest/src/*.cc)
|
2013-03-22 17:40:51 +05:30
|
|
|
|
|
|
|
lib/libgmock.a: $(GMOCK_DEPS)
|
2013-03-22 21:11:13 +05:30
|
|
|
@echo " [CXX] gtest"
|
2016-06-07 15:42:27 +05:30
|
|
|
$(V)g++ $(GMOCK_INCLUDES) -I$(GMOCK_DIR)/googletest -c $(GMOCK_DIR)/googletest/src/gtest-all.cc
|
2013-03-22 21:11:13 +05:30
|
|
|
@echo " [CXX] gmock"
|
2016-06-07 15:42:27 +05:30
|
|
|
$(V)g++ $(GMOCK_INCLUDES) -I$(GMOCK_DIR)/googlemock -c $(GMOCK_DIR)/googlemock/src/gmock-all.cc
|
2013-03-22 21:18:43 +05:30
|
|
|
@echo " [AR] $<"
|
|
|
|
$(V)ar -rv lib/libgmock.a gtest-all.o gmock-all.o > /dev/null 2>&1
|
2013-03-22 16:25:55 +05:30
|
|
|
|
2013-03-25 18:26:03 +05:30
|
|
|
TEST_SOURCE=\
|
2013-03-22 17:34:38 +05:30
|
|
|
unit-tests/gmock_main.cc \
|
2013-04-26 20:25:45 +05:30
|
|
|
unit-tests/test_utils.cc \
|
2013-03-22 17:34:38 +05:30
|
|
|
\
|
2013-03-22 19:43:58 +05:30
|
|
|
unit-tests/array_block_t.cc \
|
2013-03-22 19:12:20 +05:30
|
|
|
unit-tests/array_t.cc \
|
2013-10-10 14:48:46 +05:30
|
|
|
unit-tests/base64_t.cc \
|
2013-03-22 20:13:15 +05:30
|
|
|
unit-tests/block_t.cc \
|
2014-07-29 16:04:26 +05:30
|
|
|
unit-tests/bitset_t.cc \
|
2013-03-22 20:27:46 +05:30
|
|
|
unit-tests/btree_t.cc \
|
2013-12-11 22:30:57 +05:30
|
|
|
unit-tests/btree_counter_t.cc \
|
2013-05-08 16:30:24 +05:30
|
|
|
unit-tests/btree_damage_visitor_t.cc \
|
2013-10-07 19:51:45 +05:30
|
|
|
unit-tests/cache_superblock_t.cc \
|
2016-05-07 16:17:40 +05:30
|
|
|
unit-tests/copier_t.cc \
|
2013-05-13 17:06:57 +05:30
|
|
|
unit-tests/damage_tracker_t.cc \
|
2013-03-22 20:38:52 +05:30
|
|
|
unit-tests/endian_t.cc \
|
2015-04-08 18:28:41 +05:30
|
|
|
unit-tests/error_state_t.cc \
|
2016-06-07 15:42:27 +05:30
|
|
|
unit-tests/io_engine_t.cc \
|
2016-05-07 16:17:40 +05:30
|
|
|
unit-tests/mem_pool_t.cc \
|
2013-05-24 18:00:17 +05:30
|
|
|
unit-tests/rmap_visitor_t.cc \
|
2015-09-03 17:32:29 +05:30
|
|
|
unit-tests/rolling_hash_t.cc \
|
2013-07-09 02:14:09 +05:30
|
|
|
unit-tests/run_set_t.cc \
|
2013-03-22 20:49:40 +05:30
|
|
|
unit-tests/space_map_t.cc \
|
2013-04-22 18:20:40 +05:30
|
|
|
unit-tests/span_iterator_t.cc \
|
2013-03-22 20:49:40 +05:30
|
|
|
unit-tests/transaction_manager_t.cc
|
2013-03-22 17:34:38 +05:30
|
|
|
|
2013-05-23 19:13:53 +05:30
|
|
|
# unit-tests/thin_metadata_t.cc \
|
|
|
|
|
2013-03-25 18:26:03 +05:30
|
|
|
TEST_OBJECTS=$(subst .cc,.gmo,$(TEST_SOURCE))
|
2013-03-22 21:11:13 +05:30
|
|
|
|
2013-03-22 17:34:38 +05:30
|
|
|
# .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] $<"
|
2017-03-13 19:32:11 +05:30
|
|
|
$(V) $(CXX) -c $(TEST_INCLUDES) $(CPPFLAGS) $(GMOCK_INCLUDES) $(CXXFLAGS) $(GMOCK_FLAGS) -o $@ $<
|
2013-06-27 14:47:38 +05:30
|
|
|
@echo " [DEP] $<"
|
2017-03-13 19:32:11 +05:30
|
|
|
$(V) $(CXX) -MM -MT $(subst .cc,.o,$<) $(TEST_INCLUDES) $(CPPFLAGS) $(GMOCK_INCLUDES) $(CXXFLAGS) $(GMOCK_FLAGS) $< > $*.$$$$; \
|
2013-06-27 17:12:52 +05:30
|
|
|
sed 's,\([^ :]*\)\.o[ :]*,\1.o \1.gmo $* : Makefile ,g' < $*.$$$$ > $*.d; \
|
2013-06-27 14:47:38 +05:30
|
|
|
$(RM) $*.$$$$
|
2013-03-22 17:34:38 +05:30
|
|
|
|
2013-03-25 18:26:03 +05:30
|
|
|
unit-tests/unit_tests: $(TEST_OBJECTS) lib/libgmock.a lib/libpdata.a
|
2013-03-22 21:18:43 +05:30
|
|
|
@echo " [LD] $<"
|
2013-07-15 02:40:28 +05:30
|
|
|
$(V)g++ $(CXXFLAGS) $(LDFLAGS) -o $@ $(TEST_OBJECTS) $(LIBS) $(GMOCK_LIBS) $(LIBEXPAT)
|
2013-03-22 21:11:13 +05:30
|
|
|
|
2016-05-09 09:05:19 +05:30
|
|
|
.PHONY: unit-test
|
2013-03-22 16:25:55 +05:30
|
|
|
|
2013-03-22 21:11:13 +05:30
|
|
|
unit-test: unit-tests/unit_tests
|
2013-06-25 18:48:38 +05:30
|
|
|
unit-tests/unit_tests
|