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

lscpu: Add option --json #68

Merged
merged 2 commits into from
Feb 8, 2025
Merged

lscpu: Add option --json #68

merged 2 commits into from
Feb 8, 2025

Conversation

howjmay
Copy link
Contributor

@howjmay howjmay commented Jul 24, 2024

closes #15

@howjmay howjmay force-pushed the lscpu-json branch 3 times, most recently from 6f167ca to 06097ab Compare July 24, 2024 20:58
@sylvestre
Copy link
Contributor

please add tests to make sure we don't regress
thanks

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (6d3f21f) to head (adaf45f).
Report is 8 commits behind head on main.

Additional details and impacted files
@@    Coverage Diff     @@
##   main   #68   +/-   ##
==========================
==========================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@howjmay howjmay force-pushed the lscpu-json branch 2 times, most recently from 12928c3 to 7300355 Compare July 25, 2024 06:47
@howjmay
Copy link
Contributor Author

howjmay commented Jul 25, 2024

@sylvestre test added

@howjmay howjmay force-pushed the lscpu-json branch 2 times, most recently from 31eac3d to b897808 Compare July 25, 2024 06:50
@howjmay
Copy link
Contributor Author

howjmay commented Jul 28, 2024

@sylvestre Anything I should improve to this PR?

Copy link
Contributor

@sylvestre sylvestre left a comment

Choose a reason for hiding this comment

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

sorry, forgot to press submit


#[test]
#[ignore]
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
}

#[test]
fn test_json() {
Copy link
Contributor

Choose a reason for hiding this comment

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

please verify a bit more the format
at least some of these:

{
   "lscpu": [
      {
         "field": "Architecture :",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

i don't see what has been changed ? sorry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah sorry I fixed the implementation only. I have no idea how to test the format here. The result varies on different platform. Not sure how can I implement a uniform interface for testing it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @sylvestre any suggestions?

@howjmay howjmay force-pushed the lscpu-json branch 2 times, most recently from ad65885 to fc7bf39 Compare July 29, 2024 07:26
@cakebaker
Copy link
Contributor

cakebaker commented Feb 6, 2025

I fixed the merge conflicts, rewrote test_json() to (hopefully) address the review feedback, and disabled test_hex() (I removed some of the hex functionality while fixing the merge conflicts because the functionality was incorrect)

@cakebaker cakebaker requested a review from sylvestre February 6, 2025 15:21
@cakebaker
Copy link
Contributor

Changes since last push:

@sylvestre sylvestre merged commit 3eec3ab into uutils:main Feb 8, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

lscpu: Add option --json
3 participants