Skip to content

Commit

Permalink
test: don't configure the log function for PMEMOBJ...
Browse files Browse the repository at this point in the history
... nor PMEMCORE.

Signed-off-by: Jan Michalski <jan.michalski@intel.com>
  • Loading branch information
janekmi committed Mar 8, 2024
1 parent bbf9c4f commit 3633bc9
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 78 deletions.
15 changes: 3 additions & 12 deletions src/test/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,11 @@ endif

ifeq ($(LIBPMEMCORE), y)
LIBPMEM=y
USE_LOG_PMEMCORE=y
OBJS += $(LIBS_DIR)/debug/libpmemcore.a
INCS += -I$(TOP)/src/core
endif

ifeq ($(LIBPMEMCORE), internal-nondebug)
USE_LOG_PMEMCORE=y
OBJS +=\
$(TOP)/src/nondebug/core/alloc.o\
$(TOP)/src/nondebug/core/fs_posix.o\
Expand All @@ -410,7 +408,6 @@ INCS += -I$(TOP)/src/core
endif

ifeq ($(LIBPMEMCORE), internal-debug)
USE_LOG_PMEMCORE=y
OBJS +=\
$(TOP)/src/debug/core/alloc.o\
$(TOP)/src/debug/core/fs_posix.o\
Expand Down Expand Up @@ -531,19 +528,13 @@ CFLAGS += -DFAULT_INJECTION=1
CXXFLAGS += -DFAULT_INJECTION=1
endif

ifeq ($(USE_LOG_PMEMCORE),y)
CFLAGS += -DUSE_LOG_PMEMCORE
endif

ifeq ($(USE_LOG_PMEMOBJ),y)
CFLAGS += -DUSE_LOG_PMEMOBJ
endif

# USE_LOG_PMEMCORE != y means the binary is built without directly linking with
# core units which are required by libut.a (ut_log.c to be exact).
# In case the binary is built with directly linking with core units it is
# assumed the following are among them already.
ifneq ($(USE_LOG_PMEMCORE),y)
# LIBPMEMCORE == '' means the binary is built without directly linking with
# core units which are required whenever test makes use of core utils.
ifeq ($(LIBPMEMCORE),)
OBJS += $(TOP)/src/debug/core/out.o
OBJS += $(TOP)/src/debug/core/last_error_msg.o
OBJS += $(TOP)/src/debug/core/log.o
Expand Down
3 changes: 1 addition & 2 deletions src/test/core_log/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
BUILD_STATIC_DEBUG=n
BUILD_STATIC_NONDEBUG=n

# 'internal' is required for proper mock integration
# 'debug' provides 'out_log()' required for 'ut_log_function()'
# required for proper mock integration
LIBPMEMCORE=internal-debug

include ../Makefile.inc
Expand Down
4 changes: 1 addition & 3 deletions src/test/core_log_default_function/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ OBJS = core_log_default_function.o
BUILD_STATIC_DEBUG=n
BUILD_STATIC_NONDEBUG=n

# 'internal' is required for proper mock integration
# 'debug' is required for debug version of core/log.o that provides
# implementation of 'out_log()' that is used by 'ut_log_function()'
# required for proper mock integration
LIBPMEMCORE=internal-debug

include ../Makefile.inc
Expand Down
3 changes: 0 additions & 3 deletions src/test/core_log_internal/core_log_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@ static struct test_case test_cases[] = {
#undef abort
extern void abort(void) __THROW __attribute__((__noreturn__));

#undef LOG_SET_PMEMCORE_FUNC
#define LOG_SET_PMEMCORE_FUNC

int
main(int argc, char *argv[])
{
Expand Down
3 changes: 0 additions & 3 deletions src/test/core_log_no_func/core_log_no_func.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ static struct test_case test_cases[] = {

#define NTESTS ARRAY_SIZE(test_cases)

#undef LOG_SET_PMEMCORE_FUNC
#define LOG_SET_PMEMCORE_FUNC

int
main(int argc, char *argv[])
{
Expand Down
2 changes: 1 addition & 1 deletion src/test/core_log_threshold_mt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ OBJS = core_log_threshold_mt.o
BUILD_STATIC_DEBUG=n
BUILD_STATIC_NONDEBUG=n

LIBPMEMCORE=nondebug
LIBPMEMCORE=y

include ../Makefile.inc
3 changes: 1 addition & 2 deletions src/test/unittest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ vpath %.h $(TOP)/src/core

TARGET_UT = libut.a
OBJS_UT = ut.o ut_alloc.o ut_file.o ut_pthread.o ut_signal.o ut_backtrace.o\
os_posix.o os_thread_posix.o util.o alloc.o rand.o ut_fh.o ut_mt.o\
ut_log.o
os_posix.o os_thread_posix.o util.o alloc.o rand.o ut_fh.o ut_mt.o

CFLAGS = -I$(TOP)/src/include
CFLAGS += -I$(TOP)/src/common
Expand Down
25 changes: 1 addition & 24 deletions src/test/unittest/unittest.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,32 +121,9 @@ void ut_err(const char *file, int line, const char *func,
const char *fmt, ...)
__attribute__((format(printf, 4, 5)));

void
ut_log_function(enum core_log_level level, const char *file_name,
const int line_no, const char *function_name,
const char *message);

#ifdef USE_LOG_PMEMCORE
#define LOG_SET_PMEMCORE_FUNC core_log_set_function(ut_log_function)
#else
#define LOG_SET_PMEMCORE_FUNC
#endif

#ifdef USE_LOG_PMEMOBJ
#define LOG_SET_PMEMOBJ_FUNC \
pmemobj_log_set_function((pmemobj_log_function *)ut_log_function)
#else
#define LOG_SET_PMEMOBJ_FUNC
#endif

/* indicate the start of the test */
#define START(argc, argv, ...)\
do {\
ut_start(__FILE__, __LINE__, __func__, argc, argv,\
__VA_ARGS__);\
LOG_SET_PMEMCORE_FUNC; \
LOG_SET_PMEMOBJ_FUNC; \
} while (0)
ut_start(__FILE__, __LINE__, __func__, argc, argv, __VA_ARGS__)

/* normal exit from test */
#define DONE(...)\
Expand Down
28 changes: 0 additions & 28 deletions src/test/unittest/ut_log.c

This file was deleted.

0 comments on commit 3633bc9

Please sign in to comment.