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: CORE_LOG_* UT #6031

Merged
merged 2 commits into from
Feb 29, 2024
Merged

test: CORE_LOG_* UT #6031

merged 2 commits into from
Feb 29, 2024

Conversation

grom72
Copy link
Contributor

@grom72 grom72 commented Feb 27, 2024

This change is Reviewable

@grom72 grom72 added sprint goal This pull request is part of the ongoing sprint no changelog Add to skip the changelog check on your pull request labels Feb 27, 2024
@grom72 grom72 requested a review from janekmi February 27, 2024 18:08
@grom72 grom72 force-pushed the CORE_LOG-ut branch 2 times, most recently from 4930699 to 5ec8588 Compare February 28, 2024 07:59
Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, 5 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 32 unresolved discussions (waiting on @grom72)


src/test/core_log_internal/core_log_internal.c line 34 at r2 (raw file):

	Core_log_abort_no_of_calls++;
}
FUNC_MOCK_END
  1. It seems a forward declaration is enough. Does not have to be extern.
  2. You do not have to FUNC_MOCK() your own function.

Suggestion:

/*
 * Prevent abort() from CORE_LOG_FATAL()
 * Use mock_abort() instead.
 * Use mock_abort() mock to monitor usage of the abort() function
 * inside CORE_LOG_FATAL();
 */
#define abort() mock_abort()
void mock_abort(void);

/* mock_abort() - mock for abort() function in CORE_LOG_FATAL() */
static int Core_log_abort_no_of_calls = 0;

void
mock_abort(void)
{
	Core_log_abort_no_of_calls++;
}

src/test/core_log_internal/core_log_internal.c line 38 at r2 (raw file):

/* core_log() - mock */
static int Core_log_no_of_calls = 0;
static struct core_log_context {

The name is redundant in this case.

Suggestion:

static struct {

src/test/core_log_internal/core_log_internal.c line 52 at r2 (raw file):

	const char *message_format, ...)
FUNC_MOCK_RUN_DEFAULT {
	++Core_log_no_of_calls;

Please use either pre- or -post-incrementation consistently.


src/test/core_log_internal/core_log_internal.c line 72 at r2 (raw file):

"Test message long240Test message long260Test message long280" \
"Test message long300Test message long320Test message long340" \
"Test message long360Test message long380Test message long400    407"

Please indent nicely.

Suggestion:

#define CORE_LOG_UT_MESSAGE "Test message long 20Test message long 40" \
	"Test message long 60Test message long 80Test message long100" \
	"Test message long120Test message long140Test message long160" \
	"Test message long180Test message long200Test message long220" \
	"Test message long240Test message long260Test message long280" \
	"Test message long300Test message long320Test message long340" \
	"Test message long360Test message long380Test message long400    407"

src/test/core_log_internal/core_log_internal.c line 80 at r2 (raw file):

	strcpy(Core_log_context.message_format, MESSAGE_TO_TEST); \
	Core_log_context.errnum = NO_ERRNO; \
	Core_log_context.initialized = 1

Tabs.

Code quote:

	Core_log_abort_no_of_calls = 0; \
	Core_log_context.file_name = __FILE__; \
	Core_log_context.function_name = __func__; \
	strcpy(Core_log_context.message_format, MESSAGE_TO_TEST); \
	Core_log_context.errnum = NO_ERRNO; \
	Core_log_context.initialized = 1

src/test/core_log_internal/core_log_internal.c line 82 at r2 (raw file):

	Core_log_context.initialized = 1

#define CONCAT2(A, B) A##B

Suggestion:

#define CORE_LOG(LEVEL) CORE_LOG_##LEVEL

src/test/core_log_internal/core_log_internal.c line 83 at r2 (raw file):

#define CONCAT2(A, B) A##B
#define CONCAT3(A, B, C) A##B##C

Suggestion:

#define CORE_LOG_W_ERRNO(LEVEL) CORE_LOG_##LEVEL##_W_ERRNO

src/test/core_log_internal/core_log_internal.c line 92 at r2 (raw file):

#define TEST_STEP(STEP_LEVEL) \
	TEST_STEP_SETUP(STEP_LEVEL); CONCAT2(CORE_LOG_, STEP_LEVEL) \
	(CORE_LOG_UT_MESSAGE); \

Suggestion:

	TEST_STEP_SETUP(STEP_LEVEL); CORE_LOG(STEP_LEVEL)(CORE_LOG_UT_MESSAGE); \

src/test/core_log_internal/core_log_internal.c line 92 at r2 (raw file):

#define TEST_STEP(STEP_LEVEL) \
	TEST_STEP_SETUP(STEP_LEVEL); CONCAT2(CORE_LOG_, STEP_LEVEL) \
	(CORE_LOG_UT_MESSAGE); \

Tabs.

Code quote:

	TEST_STEP_SETUP(STEP_LEVEL); CONCAT2(CORE_LOG_, STEP_LEVEL) \
	(CORE_LOG_UT_MESSAGE); \

src/test/core_log_internal/core_log_internal.c line 99 at r2 (raw file):

	Core_log_context.errnum = ERRNUM; \
	Core_log_context.line_no = __LINE__;\
	CONCAT3(CORE_LOG_, STEP_LEVEL, _W_ERRNO) (CORE_LOG_UT_MESSAGE)

Suggestion:

CORE_LOG_W_ERRNO(STEP_LEVEL)(CORE_LOG_UT_MESSAGE)

src/test/core_log_internal/core_log_internal.c line 103 at r2 (raw file):

/* tests */
static int
test_CORE_LOG_INTERNAL(const struct test_case *tc, int argc, char *argv[])

It would be nice for tests to follow as closely as possible the names of the macros their testing.

Suggestion:

test_CORE_LOG_X

src/test/core_log_internal/core_log_internal.c line 112 at r2 (raw file):

	TEST_STEP(NOTICE);
	TEST_STEP(HARK);
	TEST_STEP(ERROR);

Suggestion:

	TEST_STEP(HARK);
	UT_ASSERTeq(Core_log_abort_no_of_calls, 0);
	TEST_STEP(FATAL);
	UT_ASSERTeq(Core_log_abort_no_of_calls, 1);
	TEST_STEP(ERROR);
	TEST_STEP(WARNING);
	TEST_STEP(NOTICE);

src/test/core_log_internal/core_log_internal.c line 112 at r2 (raw file):

	TEST_STEP(NOTICE);
	TEST_STEP(HARK);
	TEST_STEP(ERROR);

Tabs.

Code quote:

	TEST_STEP(FATAL);
	UT_ASSERTeq(Core_log_abort_no_of_calls, 1);
	TEST_STEP(ERROR);
	TEST_STEP(WARNING);
	TEST_STEP(NOTICE);
	TEST_STEP(HARK);
	TEST_STEP(ERROR);

src/test/core_log_internal/core_log_internal.c line 118 at r2 (raw file):

static int
test_CORE_LOG_INTERNAL_LAST_MESSAGE(const struct test_case *tc, int argc,

Suggestion:

test_CORE_LOG_ERROR_LAST

src/test/core_log_internal/core_log_internal.c line 129 at r2 (raw file):

	return NO_ARGS_CONSUMED;
}

#define DUMMY_ERRNO 0xf00d


src/test/core_log_internal/core_log_internal.c line 131 at r2 (raw file):

static int
test_CORE_LOG_INTERNAL_LAST_MESSAGE_W_ERRNO(const struct test_case *tc, \

Suggestion:

test_CORE_LOG_ERROR_W_ERRNO_LAST

src/test/core_log_internal/core_log_internal.c line 146 at r2 (raw file):

	}
	errno = 0;
	return NO_ARGS_CONSUMED;

I think we can get away with a single dummy errno. No need for a loop.

Suggestion:

	errno = DUMMY_ERRNO;
	Core_log_no_of_calls = 0;
	Core_log_context.errnum = DUMMY_ERRNO;
	Core_log_context.level = CORE_LOG_LEVEL_ERROR_LAST;
	Core_log_context.line_no = __LINE__ + 1;
	CORE_LOG_ERROR_W_ERRNO_LAST(CORE_LOG_UT_MESSAGE);
	UT_ASSERTeq(errno, DUMMY_ERRNO);
	UT_ASSERTeq(Core_log_no_of_calls, 1);

	errno = 0;
	return NO_ARGS_CONSUMED;

src/test/core_log_internal/core_log_internal.c line 146 at r2 (raw file):

	}
	errno = 0;
	return NO_ARGS_CONSUMED;

Tabs.

Code quote:

	for (int i = 0; i < 256; i++) {
		errno = i;
		Core_log_no_of_calls = 0;
		Core_log_context.errnum = i;
		Core_log_context.level = CORE_LOG_LEVEL_ERROR_LAST;
		Core_log_context.line_no = __LINE__ + 1;
		CORE_LOG_ERROR_W_ERRNO_LAST(CORE_LOG_UT_MESSAGE);
		UT_ASSERTeq(errno, i);
		UT_ASSERTeq(Core_log_no_of_calls, 1);
	}
	errno = 0;
	return NO_ARGS_CONSUMED;

src/test/core_log_internal/core_log_internal.c line 150 at r2 (raw file):

static int
test_CORE_LOG_INTERNAL_W_ERRNO(const struct test_case *tc,

Suggestion:

test_CORE_LOG_X_W_ERRNO

src/test/core_log_internal/core_log_internal.c line 165 at r2 (raw file):

		UT_ASSERTeq(errno, i);
		UT_ASSERTeq(Core_log_abort_no_of_calls, 1);
	}

Can we get away with just a single DUMMY_ERRNO pass instead of a loop?

Code quote:

	for (int i = 0; i < 256; i++) {
		errno = i;
		Core_log_abort_no_of_calls = 0;
		TEST_STEP_W_ERRNO(FATAL, i);
		UT_ASSERTeq(Core_log_abort_no_of_calls, 1);
		UT_ASSERTeq(errno, i);
		TEST_STEP_W_ERRNO(ERROR, i);
		UT_ASSERTeq(errno, i);
		TEST_STEP_W_ERRNO(WARNING, i);
		UT_ASSERTeq(errno, i);
		UT_ASSERTeq(Core_log_abort_no_of_calls, 1);
	}

src/test/core_log_internal/core_log_internal.c line 165 at r2 (raw file):

		UT_ASSERTeq(errno, i);
		UT_ASSERTeq(Core_log_abort_no_of_calls, 1);
	}

Tabs.

Code quote:

	for (int i = 0; i < 256; i++) {
		errno = i;
		Core_log_abort_no_of_calls = 0;
		TEST_STEP_W_ERRNO(FATAL, i);
		UT_ASSERTeq(Core_log_abort_no_of_calls, 1);
		UT_ASSERTeq(errno, i);
		TEST_STEP_W_ERRNO(ERROR, i);
		UT_ASSERTeq(errno, i);
		TEST_STEP_W_ERRNO(WARNING, i);
		UT_ASSERTeq(errno, i);
		UT_ASSERTeq(Core_log_abort_no_of_calls, 1);
	}

src/test/core_log_internal/core_log_internal.c line 181 at r2 (raw file):

#define CORE_LOG_TRESHOLD_STEP_ALL(FATAL_PASS, ERROR_PASS, WARNING_PASS, \
	NOTICE_PASS, HARK_PASS) \

The natural order, please.

Code quote:

#define CORE_LOG_TRESHOLD_STEP_ALL(FATAL_PASS, ERROR_PASS, WARNING_PASS, \
	NOTICE_PASS, HARK_PASS) \

src/test/core_log_internal/core_log_internal.c line 188 at r2 (raw file):

	CORE_LOG_TRESHOLD_STEP(WARNING, 0, WARNING_PASS); \
	CORE_LOG_TRESHOLD_STEP(NOTICE, 0, NOTICE_PASS); \
	CORE_LOG_TRESHOLD_STEP(HARK, 0, HARK_PASS)

Please apply the natural order.

Code quote:

	Core_log_abort_no_of_calls = 0; \
	CORE_LOG_TRESHOLD_STEP(FATAL, 1, FATAL_PASS); \
	Core_log_abort_no_of_calls = 0; \
	CORE_LOG_TRESHOLD_STEP(ERROR, 0, ERROR_PASS); \
	CORE_LOG_TRESHOLD_STEP(WARNING, 0, WARNING_PASS); \
	CORE_LOG_TRESHOLD_STEP(NOTICE, 0, NOTICE_PASS); \
	CORE_LOG_TRESHOLD_STEP(HARK, 0, HARK_PASS)

src/test/core_log_internal/core_log_internal.c line 188 at r2 (raw file):

	CORE_LOG_TRESHOLD_STEP(WARNING, 0, WARNING_PASS); \
	CORE_LOG_TRESHOLD_STEP(NOTICE, 0, NOTICE_PASS); \
	CORE_LOG_TRESHOLD_STEP(HARK, 0, HARK_PASS)

Tabs.

Code quote:

	NOTICE_PASS, HARK_PASS) \
	Core_log_abort_no_of_calls = 0; \
	CORE_LOG_TRESHOLD_STEP(FATAL, 1, FATAL_PASS); \
	Core_log_abort_no_of_calls = 0; \
	CORE_LOG_TRESHOLD_STEP(ERROR, 0, ERROR_PASS); \
	CORE_LOG_TRESHOLD_STEP(WARNING, 0, WARNING_PASS); \
	CORE_LOG_TRESHOLD_STEP(NOTICE, 0, NOTICE_PASS); \
	CORE_LOG_TRESHOLD_STEP(HARK, 0, HARK_PASS)

src/test/core_log_internal/core_log_internal.c line 191 at r2 (raw file):

static int
test_CORE_LOG_INTERNAL_TRESHOLD(const struct test_case *tc, int argc,

Suggestion:

test_CORE_LOG_TRESHOLD

src/test/core_log_internal/core_log_internal.c line 194 at r2 (raw file):

	char *argv[])
{
	TEST_SETUP(CORE_LOG_UT_MESSAGE);

Please write a comment on what threshold level and aux threshold level you expect initially.


src/test/core_log_internal/core_log_internal.c line 201 at r2 (raw file):

	CORE_LOG_TRESHOLD_STEP(WARNING, 0, 1);
	CORE_LOG_TRESHOLD_STEP(NOTICE, 0, 1);
	CORE_LOG_TRESHOLD_STEP(HARK, 0, 1);

Please keep them in the natural order.

Suggestion:

	CORE_LOG_TRESHOLD_STEP(HARK, 0, 1);
	Core_log_abort_no_of_calls = 0;	
	CORE_LOG_TRESHOLD_STEP(FATAL, 1, 1);
	Core_log_abort_no_of_calls = 0;
	CORE_LOG_TRESHOLD_STEP(ERROR, 0, 1);
	CORE_LOG_TRESHOLD_STEP(WARNING, 0, 1);
	CORE_LOG_TRESHOLD_STEP(NOTICE, 0, 1);

src/test/core_log_internal/core_log_internal.c line 201 at r2 (raw file):

	CORE_LOG_TRESHOLD_STEP(WARNING, 0, 1);
	CORE_LOG_TRESHOLD_STEP(NOTICE, 0, 1);
	CORE_LOG_TRESHOLD_STEP(HARK, 0, 1);

Why no INFO and DEBUG?


src/test/core_log_internal/core_log_internal.c line 201 at r2 (raw file):

	CORE_LOG_TRESHOLD_STEP(WARNING, 0, 1);
	CORE_LOG_TRESHOLD_STEP(NOTICE, 0, 1);
	CORE_LOG_TRESHOLD_STEP(HARK, 0, 1);

Tabs.

Code quote:

	Core_log_abort_no_of_calls = 0;
	CORE_LOG_TRESHOLD_STEP(FATAL, 1, 1);
	Core_log_abort_no_of_calls = 0;
	CORE_LOG_TRESHOLD_STEP(ERROR, 0, 1);
	CORE_LOG_TRESHOLD_STEP(WARNING, 0, 1);
	CORE_LOG_TRESHOLD_STEP(NOTICE, 0, 1);
	CORE_LOG_TRESHOLD_STEP(HARK, 0, 1);

src/test/core_log_internal/core_log_internal.c line 211 at r2 (raw file):

	CORE_LOG_TRESHOLD_STEP_ALL(1, 1, 1, 0, 1);
	core_log_set_threshold(CORE_LOG_THRESHOLD, CORE_LOG_LEVEL_NOTICE);
	CORE_LOG_TRESHOLD_STEP_ALL(1, 1, 1, 1, 1);

Why no INFO and DEBUG?


src/test/core_log_internal/core_log_internal.c line 239 at r2 (raw file):

	openlog("core_log", 0, 0);

	TEST_CASE_PROCESS(argc, argv, test_cases, NTESTS);

Tabs.


src/test/core_log_internal/core_log_internal.c line 240 at r2 (raw file):

	TEST_CASE_PROCESS(argc, argv, test_cases, NTESTS);
	closelog();

Suggestion:

	TEST_CASE_PROCESS(argc, argv, test_cases, NTESTS);

@grom72 grom72 force-pushed the CORE_LOG-ut branch 3 times, most recently from ead1537 to daca7d7 Compare February 28, 2024 12:52
Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 5 files at r4.
Reviewable status: 5 of 6 files reviewed, 32 unresolved discussions (waiting on @janekmi)


src/test/core_log_internal/core_log_internal.c line 34 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…
  1. It seems a forward declaration is enough. Does not have to be extern.
  2. You do not have to FUNC_MOCK() your own function.

Done.


src/test/core_log_internal/core_log_internal.c line 38 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

The name is redundant in this case.

Done.


src/test/core_log_internal/core_log_internal.c line 52 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Please use either pre- or -post-incrementation consistently.

Done.


src/test/core_log_internal/core_log_internal.c line 72 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Please indent nicely.

Done.


src/test/core_log_internal/core_log_internal.c line 80 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Tabs.

Where?


src/test/core_log_internal/core_log_internal.c line 82 at r2 (raw file):

	Core_log_context.initialized = 1

#define CONCAT2(A, B) A##B

Done.


src/test/core_log_internal/core_log_internal.c line 83 at r2 (raw file):

#define CONCAT2(A, B) A##B
#define CONCAT3(A, B, C) A##B##C

Done.


src/test/core_log_internal/core_log_internal.c line 92 at r2 (raw file):

#define TEST_STEP(STEP_LEVEL) \
	TEST_STEP_SETUP(STEP_LEVEL); CONCAT2(CORE_LOG_, STEP_LEVEL) \
	(CORE_LOG_UT_MESSAGE); \

Done.


src/test/core_log_internal/core_log_internal.c line 92 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Tabs.

Done.


src/test/core_log_internal/core_log_internal.c line 99 at r2 (raw file):

	Core_log_context.errnum = ERRNUM; \
	Core_log_context.line_no = __LINE__;\
	CONCAT3(CORE_LOG_, STEP_LEVEL, _W_ERRNO) (CORE_LOG_UT_MESSAGE)

Done.


src/test/core_log_internal/core_log_internal.c line 103 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

It would be nice for tests to follow as closely as possible the names of the macros their testing.

Done.


src/test/core_log_internal/core_log_internal.c line 112 at r2 (raw file):

	TEST_STEP(NOTICE);
	TEST_STEP(HARK);
	TEST_STEP(ERROR);

Done.


src/test/core_log_internal/core_log_internal.c line 112 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Tabs.

Where?


src/test/core_log_internal/core_log_internal.c line 118 at r2 (raw file):

static int
test_CORE_LOG_INTERNAL_LAST_MESSAGE(const struct test_case *tc, int argc,

Done.


src/test/core_log_internal/core_log_internal.c line 129 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

#define DUMMY_ERRNO 0xf00d

Done.


src/test/core_log_internal/core_log_internal.c line 131 at r2 (raw file):

static int
test_CORE_LOG_INTERNAL_LAST_MESSAGE_W_ERRNO(const struct test_case *tc, \

Done.


src/test/core_log_internal/core_log_internal.c line 146 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

I think we can get away with a single dummy errno. No need for a loop.

Done.


src/test/core_log_internal/core_log_internal.c line 146 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Tabs.

.


src/test/core_log_internal/core_log_internal.c line 150 at r2 (raw file):

static int
test_CORE_LOG_INTERNAL_W_ERRNO(const struct test_case *tc,

Done.


src/test/core_log_internal/core_log_internal.c line 165 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Can we get away with just a single DUMMY_ERRNO pass instead of a loop?

Done.


src/test/core_log_internal/core_log_internal.c line 165 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Tabs.

.


src/test/core_log_internal/core_log_internal.c line 181 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

The natural order, please.

Done.


src/test/core_log_internal/core_log_internal.c line 188 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Please apply the natural order.

Done.


src/test/core_log_internal/core_log_internal.c line 188 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Tabs.

.


src/test/core_log_internal/core_log_internal.c line 191 at r2 (raw file):

static int
test_CORE_LOG_INTERNAL_TRESHOLD(const struct test_case *tc, int argc,

Done.


src/test/core_log_internal/core_log_internal.c line 194 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Please write a comment on what threshold level and aux threshold level you expect initially.

Done.


src/test/core_log_internal/core_log_internal.c line 201 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Why no INFO and DEBUG?

Done.


src/test/core_log_internal/core_log_internal.c line 201 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Please keep them in the natural order.

Done.


src/test/core_log_internal/core_log_internal.c line 201 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Tabs.

.


src/test/core_log_internal/core_log_internal.c line 211 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Why no INFO and DEBUG?

Done.


src/test/core_log_internal/core_log_internal.c line 239 at r2 (raw file):

Previously, janekmi (Jan Michalski) wrote…

Tabs.

.


src/test/core_log_internal/core_log_internal.c line 240 at r2 (raw file):

	TEST_CASE_PROCESS(argc, argv, test_cases, NTESTS);
	closelog();

Done.

Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 5 files at r7, all commit messages.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @grom72)


src/test/core_log_internal/core_log_internal.c line 45 at r7 (raw file):

	int line_no;
	const char *function_name;
	char message_format[8196];

A hardcoded unnamed value.


src/test/core_log_internal/core_log_internal.c line 123 at r7 (raw file):

}

/* Test for CORE_LOG_ERROR_W_ERRNO_LAST() w/ errno */

Suggestion:

Test for CORE_LOG_ERROR_LAST()

src/test/core_log_internal/core_log_internal.c line 157 at r7 (raw file):

}

/* Test all macros with that passes errno */

Suggestion:

Test all macros that pass errno

src/test/core_log_internal/core_log_internal.c line 203 at r7 (raw file):

/* Test all possible tresholds */
static int
test_CORE_LOG_XYZ_TRESHOLD(const struct test_case *tc, int argc, char *argv[])

There is no XYZ in this case. 😆

Suggestion:

test_CORE_LOG_TRESHOLD

src/test/core_log_internal/core_log_internal.c line 227 at r7 (raw file):

 * Validate default threshold for release build
 * This test works properly only with nondebug build as long as
 * LIBPMEMCORE=internal-nondebug is set in the Makefile

Suggestion:

 * Validate the default threshold of the release build (no DEBUG set).

src/test/core_log_internal/core_log_internal.c line 230 at r7 (raw file):

 */
static int
test_CORE_LOG_XYZ_TRESHOLD_DEFAULT(const struct test_case *tc, int argc,

Suggestion:

test_CORE_LOG_TRESHOLD_DEFAULT

src/test/core_log_internal/TESTS.py line 12 at r7 (raw file):

@g.require_granularity(g.ANY)
@t.require_build('nondebug')

I would argue it is irrelevant in this case.

Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
@grom72 grom72 force-pushed the CORE_LOG-ut branch 2 times, most recently from 654d906 to 4f686a8 Compare February 29, 2024 08:50
Copy link
Contributor Author

@grom72 grom72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1, 3 of 5 files at r6, 5 of 5 files at r7, 2 of 2 files at r8, all commit messages.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @janekmi)


src/test/core_log_internal/core_log_internal.c line 45 at r7 (raw file):

Previously, janekmi (Jan Michalski) wrote…

A hardcoded unnamed value.

Done.


src/test/core_log_internal/core_log_internal.c line 123 at r7 (raw file):

}

/* Test for CORE_LOG_ERROR_W_ERRNO_LAST() w/ errno */

Done.


src/test/core_log_internal/core_log_internal.c line 157 at r7 (raw file):

}

/* Test all macros with that passes errno */

Done.


src/test/core_log_internal/core_log_internal.c line 203 at r7 (raw file):

Previously, janekmi (Jan Michalski) wrote…

There is no XYZ in this case. 😆

Done.


src/test/core_log_internal/core_log_internal.c line 227 at r7 (raw file):

 * Validate default threshold for release build
 * This test works properly only with nondebug build as long as
 * LIBPMEMCORE=internal-nondebug is set in the Makefile

Done.


src/test/core_log_internal/core_log_internal.c line 230 at r7 (raw file):

 */
static int
test_CORE_LOG_XYZ_TRESHOLD_DEFAULT(const struct test_case *tc, int argc,

Done.


src/test/core_log_internal/TESTS.py line 12 at r7 (raw file):

Previously, janekmi (Jan Michalski) wrote…

I would argue it is irrelevant in this case.

Done.
;)

Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r8, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @grom72)

Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.06%. Comparing base (e0189cb) to head (4f686a8).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6031      +/-   ##
==========================================
+ Coverage   70.04%   70.06%   +0.01%     
==========================================
  Files         133      133              
  Lines       19563    19563              
  Branches     3263     3263              
==========================================
+ Hits        13703    13706       +3     
+ Misses       5860     5857       -3     

Copy link
Contributor

@janekmi janekmi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @grom72)

@janekmi janekmi merged commit a7232e9 into pmem:master Feb 29, 2024
8 checks passed
@grom72 grom72 deleted the CORE_LOG-ut branch February 29, 2024 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog Add to skip the changelog check on your pull request sprint goal This pull request is part of the ongoing sprint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants