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: UT for core_log_set_function() #6047

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

grom72
Copy link
Contributor

@grom72 grom72 commented Mar 11, 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 Mar 11, 2024
@grom72 grom72 requested review from janekmi and osalyk March 11, 2024 20:11
Copy link

codecov bot commented Mar 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.07%. Comparing base (9819db6) to head (9a96de0).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6047   +/-   ##
=======================================
  Coverage   70.07%   70.07%           
=======================================
  Files         133      133           
  Lines       19563    19563           
  Branches     3261     3261           
=======================================
+ Hits        13708    13709    +1     
+ Misses       5855     5854    -1     

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 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @grom72 and @osalyk)


src/test/core_log/core_log.c line 206 at r1 (raw file):

/* Happy day scenario with custom logging function */
static int
test_set_custom_function(const struct test_case *tc, int argc, char *argv[])

This function is basically a copy of the test_happy_day() function. I recommend establishing test_happy_day_helper() with appropriate if-else statements allowing testing both test_happy_day and test_set_custom_function.

Code quote:

test_set_custom_function

src/test/core_log/core_log.c line 214 at r1 (raw file):

	 * disable MOCK as custom_log_function() may be called form
	 * core_log_set_function()
	 */

Suggestion:

	/*
	 * Disable the validation as custom_log_function() may be called form
	 * core_log_set_function().
	 */

src/test/core_log/core_log.c line 215 at r1 (raw file):

	 * core_log_set_function()
	 */
	FUNC_MOCK_RCOUNTER_SET(custom_log_function, 0);

Suggestion:

#define NOT_VALIDATED_CALL 0

FUNC_MOCK_RCOUNTER_SET(custom_log_function, NOT_VALIDATED_CALL);

src/test/core_log/core_log_common.c line 86 at r1 (raw file):

FUNC_MOCK_END

/* custom logging function MOCK used only in test_set_custom_function test */

I don't like this comment. Not much value and even less maintainability.

@grom72 grom72 force-pushed the core-log-set-function-ut branch 2 times, most recently from b65f124 to 858aa9d Compare March 11, 2024 22:04
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.

Reviewable status: 1 of 4 files reviewed, 3 unresolved discussions (waiting on @janekmi and @osalyk)


src/test/core_log/core_log.c line 214 at r1 (raw file):

	 * disable MOCK as custom_log_function() may be called form
	 * core_log_set_function()
	 */

Done.


src/test/core_log/core_log.c line 215 at r1 (raw file):

	 * core_log_set_function()
	 */
	FUNC_MOCK_RCOUNTER_SET(custom_log_function, 0);

Done.


src/test/core_log/core_log_common.c line 86 at r1 (raw file):

Previously, janekmi (Jan Michalski) wrote…

I don't like this comment. Not much value and even less maintainability.

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 3 of 3 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @osalyk)

Copy link
Contributor

@osalyk osalyk 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 1 of 4 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @grom72)

Signed-off-by: Tomasz Gromadzki <tomasz.gromadzki@intel.com>
Copy link
Contributor

@osalyk osalyk left a comment

Choose a reason for hiding this comment

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

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

@grom72 grom72 merged commit 3fda80e into pmem:master Mar 14, 2024
9 checks passed
@grom72 grom72 deleted the core-log-set-function-ut branch March 14, 2024 07:59
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.

3 participants