Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: don't configure the log function for PMEMOBJ nor PMEMCORE #6044

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/core/out.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ void out_init(const char *log_prefix, const char *log_level_var,
const char *log_file_var, int major_version,
int minor_version);
void out_fini(void);

#ifdef DEBUG
void out_log(const char *file, int line, const char *func, int level,
const char *fmt, ...) FORMAT_PRINTF(5, 6);
#endif

#ifdef __cplusplus
}
Expand Down
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
1 change: 1 addition & 0 deletions src/test/core_log/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


@g.require_granularity(g.ANY)
@t.require_valgrind_disabled('pmemcheck')
# The 'nondebug' build is chosen arbitrarily to ensure these tests are run only
# once. No dynamic libraries are used nor .static_* builds are available.
@t.require_build('nondebug')
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
1 change: 1 addition & 0 deletions src/test/core_log_default_function/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


@g.require_granularity(g.ANY)
@t.require_valgrind_disabled('pmemcheck')
# The 'debug' build is chosen arbitrarily to ensure these tests are run only
# once. No dynamic libraries are used nor .static_* builds are available.
@t.require_build('debug')
Expand Down
2 changes: 1 addition & 1 deletion src/test/core_log_function_mt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ OBJS = core_log_function_mt.o
BUILD_STATIC_DEBUG=n
BUILD_STATIC_NONDEBUG=n

LIBPMEMCORE=nondebug
LIBPMEMCORE=y

include ../Makefile.inc
1 change: 1 addition & 0 deletions src/test/core_log_function_mt/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


@g.require_granularity(g.ANY)
@t.require_valgrind_disabled('pmemcheck', 'memcheck')
# The 'nondebug' build is chosen arbitrarily to ensure these tests are run only
# once. No dynamic libraries are used nor .static_* builds are available.
@t.require_build('nondebug')
Expand Down
1 change: 1 addition & 0 deletions src/test/core_log_internal/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

@g.require_granularity(g.ANY)
@t.require_build('nondebug')
@t.require_valgrind_disabled('pmemcheck')
class CORE_LOG(t.BaseTest):
test_type = t.Short

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
1 change: 1 addition & 0 deletions src/test/core_log_max/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

@g.require_granularity(g.ANY)
@t.require_build('nondebug')
@t.require_valgrind_disabled('pmemcheck')
class CORE_LOG(t.BaseTest):
test_type = t.Short

Expand Down
1 change: 1 addition & 0 deletions src/test/core_log_no_func/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


@g.require_granularity(g.ANY)
@t.require_valgrind_disabled('pmemcheck')
# The 'nondebug' build is chosen arbitrarily to ensure these tests are run only
# once. No dynamic libraries are used nor .static_* builds are available.
@t.require_build('nondebug')
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
1 change: 1 addition & 0 deletions src/test/core_log_threshold_mt/TESTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

@g.require_granularity(g.ANY)
@t.require_build('nondebug')
@t.require_valgrind_disabled('pmemcheck', 'memcheck')
class CORE_LOG_MT(t.BaseTest):
test_type = t.Short

Expand Down
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.

Loading