1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

[device/bcache] stub a unit test

This commit is contained in:
Joe Thornber 2018-02-01 09:54:56 +00:00 committed by David Teigland
parent cb2c4542a6
commit 46867a45d2
6 changed files with 44 additions and 1 deletions

View File

@ -14,6 +14,7 @@
@top_srcdir@/lib/config/defaults.h
@top_srcdir@/lib/datastruct/btree.h
@top_srcdir@/lib/datastruct/str_list.h
@top_srcdir@/lib/device/bcache.h
@top_srcdir@/lib/device/dev-cache.h
@top_srcdir@/lib/device/dev-ext-udev-constants.h
@top_srcdir@/lib/device/dev-type.h

View File

@ -16,6 +16,7 @@
#define BCACHE_H
#include <stdint.h>
#include <stdbool.h>
#include "libdevmapper.h"

View File

@ -16,6 +16,7 @@ top_builddir = @top_builddir@
VPATH = $(srcdir)
UNITS = \
bcache_t.c \
bitset_t.c\
config_t.c\
dmlist_t.c\
@ -37,7 +38,7 @@ SOURCES = $(UNITS)
endif
ifeq ("$(TESTING)", "yes")
LDLIBS += -ldevmapper @CUNIT_LIBS@
LDLIBS += $(LVMINTERNAL_LIBS) -ldevmapper -laio @CUNIT_LIBS@
CFLAGS += @CUNIT_CFLAGS@
check: unit

38
test/unit/bcache_t.c Normal file
View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2018 Red Hat, Inc. All rights reserved.
*
* 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,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "units.h"
#include "bcache.h"
int bcache_init(void)
{
return 0;
}
int bcache_fini(void)
{
return 0;
}
static void test_create(void)
{
struct bcache *cache = bcache_create(8, 16);
CU_ASSERT_PTR_NOT_NULL(cache);
bcache_destroy(cache);
}
CU_TestInfo bcache_list[] = {
{ (char*)"create", test_create },
CU_TEST_INFO_NULL
};

View File

@ -13,6 +13,7 @@
.pTests = n##_list }
CU_SuiteInfo suites[] = {
USE(bcache),
USE(bitset),
USE(config),
USE(dmlist),

View File

@ -23,6 +23,7 @@
int n ## _init(void); \
int n ## _fini(void);
DECL(bcache);
DECL(bitset);
DECL(config);
DECL(dmlist);