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

logging: fix dictionary logging and added pytest #72829

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

dcpleung
Copy link
Member

@dcpleung dcpleung commented May 15, 2024

(See individual commits for details.)

@dcpleung dcpleung force-pushed the logging/dictionary_pytest branch 9 times, most recently from c65c143 to eb97730 Compare May 20, 2024 16:30
@dcpleung dcpleung marked this pull request as ready for review May 23, 2024 20:27
@dcpleung

This comment was marked as outdated.

Fix the dictionary database not being generated under some
situations even though CONFIG_LOG_DICTIONARY_DB_TARGET is
disabled. For example, build and run through QEMU via
west build -t run.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
If logging packages need to be created at runtime, the format
strings need to be in memory for the packaging code to know
what to be packed. So prevent stripping the logging string
section if CONFIG_LOG_ALWAYS_RUNTIME is enabled.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This extracts the DataTypes class into its own file. This is in
preparation to add a new version of parser which can reuse this
class.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Printing long long requires alignment on 64-bit before parsing
the actual argument. Or else the parser would be looking at
some unrelated bits. So fix it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
... and put them into the LogParser class file instead of
the verisoned parser. This is in preparation for introducing
a new parser version.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Python does not really support long long double, so %llx cannot
be formatted correctly, so we replace it with a simple %lx.
There is another variant %#llx and we also need replace it to
%#lx.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
The package_len has been extended from 10 bits to 11 bits
in the log message header. So the format for dictionary
logging also needs to be updated.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
pylint keeps failing and complaining about arg_data_type is
used before assignment. So assign it to None to silence
the warning.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This is in preparation for introducing pytest to test the output
of dictionary logging. Code is the same, but the testcase.yaml
is trimmed to only those that can be tested.

Note that a copy is made instead of moving the whole sample over
is simply due to various documentation having references to
the sample. Since RST files under tests/ are not parsed for
zephyr:code-sample:<name>, the linking would have been vanished.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Add pytest to test the output of dictionary logging to make sure
the encoded logs can be decoded back into strings, and to also
make sure the decoded logs have the expected strings.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
@dcpleung dcpleung changed the title samples: logging/dictionary: enable pytest to test output logging: fix dictionary logging and added pytest May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System area: Logging Release Notes To be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants