2024-05-14 18:47:33 +03:00
# Copyright (C) 2011-2024 Red Hat, Inc. All rights reserved.
2011-11-21 01:43:20 +04:00
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
2016-01-21 13:49:46 +03:00
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2011-11-21 01:43:20 +04:00
2018-12-15 03:55:11 +03:00
# NOTE: this Makefile only works as 'include' for toplevel Makefile
# which defined all top_* variables
2018-02-02 18:39:17 +03:00
UNIT_SOURCE = \
2018-07-09 11:37:39 +03:00
device_mapper/vdo/status.c \
\
2018-04-27 18:55:07 +03:00
test/unit/bcache_t.c \
2018-05-03 22:13:13 +03:00
test/unit/bcache_utils_t.c \
2018-04-27 18:55:07 +03:00
test/unit/bitset_t.c \
test/unit/config_t.c \
2024-05-14 18:47:33 +03:00
test/unit/dmhash_t.c \
2018-04-27 18:55:07 +03:00
test/unit/dmlist_t.c \
test/unit/dmstatus_t.c \
2018-12-14 23:50:09 +03:00
test/unit/framework.c \
2018-04-27 18:55:07 +03:00
test/unit/io_engine_t.c \
test/unit/matcher_t.c \
test/unit/percent_t.c \
2018-12-14 23:50:09 +03:00
test/unit/radix_tree_t.c \
2018-04-27 18:55:07 +03:00
test/unit/run.c \
2018-05-10 15:01:26 +03:00
test/unit/string_t.c \
test/unit/vdo_t.c
2018-04-26 13:59:39 +03:00
2018-09-20 16:35:45 +03:00
test/unit/radix_tree_t.o : test /unit /rt_case 1.c
2018-12-15 03:55:11 +03:00
UNIT_TARGET = test/unit/unit-test
2018-11-29 23:47:11 +03:00
UNIT_DEPENDS = $( UNIT_SOURCE:%.c= %.d)
UNIT_OBJECTS = $( UNIT_SOURCE:%.c= %.o)
CLEAN_TARGETS += $( UNIT_DEPENDS) $( UNIT_OBJECTS) \
$( UNIT_SOURCE:%.c= %.gcda) \
2018-11-30 14:55:22 +03:00
$( UNIT_SOURCE:%.c= %.gcno) \
2018-12-15 03:55:11 +03:00
$( UNIT_TARGET)
2018-02-02 18:39:17 +03:00
2021-04-08 20:44:53 +03:00
lib/liblvm-internal.a : lib
libdaemon/client/libdaemonclient.a : libdaemon
2018-12-15 03:55:11 +03:00
$(UNIT_TARGET) : $( UNIT_OBJECTS ) $( LVMINTERNAL_LIBS )
2024-04-08 14:10:16 +03:00
$( SHOW) " [LD] $@ "
2018-05-16 15:43:02 +03:00
$( Q) $( CC) $( CFLAGS) $( LDFLAGS) $( EXTRA_EXEC_LDFLAGS) \
2021-04-08 20:44:53 +03:00
-o $@ $+ $( LVMLIBS)
2015-11-27 12:54:57 +03:00
2021-04-08 20:44:53 +03:00
.PHONY : run -unit -test unit -test
2018-12-15 03:55:11 +03:00
unit-test : $( UNIT_TARGET )
run-unit-test : $( UNIT_TARGET )
@echo "Running unit tests"
2021-10-15 10:45:26 +03:00
test -n " $$ LVM_TEST_DIR " || LVM_TEST_DIR = $$ { TMPDIR:-/tmp} ; \
TESTDIR = $$ ( mktemp -d -t -p " $$ LVM_TEST_DIR " "LVMTEST.XXXXXXXXXX" ) ; \
cd " $$ TESTDIR " ; \
LD_LIBRARY_PATH = $( abs_top_builddir) /libdm:$( abs_top_builddir) /daemons/dmeventd $( abs_top_builddir) /$( UNIT_TARGET) run ; \
cd $$ OLDPWD ; \
$( RM) -r " $$ {TESTDIR:?} "
2018-04-26 13:59:39 +03:00
2024-05-14 17:54:00 +03:00
i f e q ( "$(USE_TRACKING)" , "yes" )
- i n c l u d e $( UNIT_DEPENDS )
2018-07-01 16:16:18 +03:00
e n d i f