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

common: core_log_set/get_threshold MT unit tests (part 2) #6038

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

janekmi
Copy link
Contributor

@janekmi janekmi commented Mar 6, 2024

  • make core_log_threshold_mt a dedicated test
  • keep Core_log_threshold available only via API
  • add _core_log_get_threshold_internal() calls

Ref: #6035


This change is Reviewable

@janekmi janekmi 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 6, 2024
@janekmi janekmi requested review from grom72 and osalyk March 6, 2024 13:35
Copy link
Contributor

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

a discussion (no related file):
Shall we mock ut_log_function or log_default_function


Copy link

codecov bot commented Mar 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.09%. Comparing base (bf09701) to head (e06c162).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6038      +/-   ##
==========================================
+ Coverage   70.08%   70.09%   +0.01%     
==========================================
  Files         133      133              
  Lines       19563    19560       -3     
  Branches     3262     3261       -1     
==========================================
  Hits        13711    13711              
+ Misses       5852     5849       -3     

Copy link
Contributor Author

@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 8 of 9 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @grom72 and @osalyk)

a discussion (no related file):

Previously, grom72 (Tomasz Gromadzki) wrote…

Shall we mock ut_log_function or log_default_function

I would argue it is unnecessary:

  1. It would significantly complicate the implementation.
  2. Made no difference whether the logging message is or is not further processed. The key thing is to hit the condition below.
  3. I just assured no other function will touch the Core_log_threshold[] directly.

Copy link
Contributor Author

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

Copy link
Contributor Author

@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 r4, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @grom72 and @osalyk)

a discussion (no related file):

Previously, janekmi (Jan Michalski) wrote…

I would argue it is unnecessary:

  1. It would significantly complicate the implementation.
  2. Made no difference whether the logging message is or is not further processed. The key thing is to hit the condition below.
  3. I just assured no other function will touch the Core_log_threshold[] directly.

Considering what we discussed offline, it is no longer relevant.


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 7 of 9 files at r1, 1 of 3 files at r2, 2 of 3 files at r3, 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @grom72)

Copy link
Contributor Author

@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 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @grom72)

Copy link
Contributor Author

@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 3 of 3 files at r7, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @grom72)

Copy link
Contributor Author

@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 2 of 2 files at r8, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @grom72)

Copy link
Contributor Author

@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 r9, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @grom72)

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 2 files at r6, 2 of 3 files at r7, 1 of 2 files at r8, 1 of 1 files at r9, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @grom72)

Copy link
Contributor

@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 3 files at r2, 1 of 2 files at r6, 1 of 3 files at r7, 1 of 2 files at r8, 1 of 1 files at r9, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @janekmi)


src/core/log_internal.h line 93 at r9 (raw file):

_Atomic
#endif /* ATOMIC_OPERATIONS_SUPPORTED */
uintptr_t Core_log_function;

What has happened here?

Code quote:

/* pointer to the logging function */
extern
#ifdef ATOMIC_OPERATIONS_SUPPORTED
_Atomic
#endif /* ATOMIC_OPERATIONS_SUPPORTED */
uintptr_t Core_log_function;

src/test/core_log_threshold_mt/core_log_threshold_mt.c line 49 at r9 (raw file):

			CORE_LOG_LEVEL_MAX);
		int ret = core_log_set_threshold(ctx->threshold, level);
		UT_ASSERT(ret == 0 || ret == EAGAIN);

It will be useful to print info when EAGAIN is returned by the function.

Suggestion:

UT_ASSERT(ret == 0 || ret == EAGAIN);
if (ret == EAGAIN)
	UT_OUT( "ret == EAGAIN");

Copy link
Contributor Author

@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 3 files at r10.
Reviewable status: 9 of 11 files reviewed, 2 unresolved discussions (waiting on @grom72 and @osalyk)


src/core/log_internal.h line 93 at r9 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

What has happened here?

Done.

Copy link
Contributor Author

@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 2 of 3 files at r10, 1 of 1 files at r11, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @grom72)


src/test/core_log_threshold_mt/core_log_threshold_mt.c line 49 at r9 (raw file):

Previously, grom72 (Tomasz Gromadzki) wrote…

It will be useful to print info when EAGAIN is returned by the function.

Done.

Copy link
Contributor

@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.

:lgtm:

Reviewed 3 of 3 files at r10, 1 of 1 files at r11, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @janekmi)

@janekmi janekmi merged commit 849750e into pmem:master Mar 7, 2024
8 checks passed
- make core_log_threshold_mt a dedicated test
- keep Core_log_threshold available only via API
- add _core_log_get_threshold_internal() calls

Ref: pmem#6035

Signed-off-by: Jan Michalski <jan.michalski@intel.com>
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