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

ledctl: add error message for missing devices #216

Merged
merged 3 commits into from
Apr 9, 2024

Conversation

mku514k
Copy link
Contributor

@mku514k mku514k commented Mar 28, 2024

Ledctl prints error message for not supported devices, but there is no such message for not existent or missing devices.

Add error message for missing devices for consistency.

@mku514k
Copy link
Contributor Author

mku514k commented Mar 28, 2024

Fixes #213

Copy link
Contributor

@mtkaczyk mtkaczyk left a comment

Choose a reason for hiding this comment

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

One comment and we need to test this and "not supported" errors beacuse they are most common negative scenarios for ledctl so:

  • Please add test for this error.
  • Please also add test for error in case if device is not supported.

src/ledctl/ledctl.c Show resolved Hide resolved
Ledctl prints error message for not supported devices, but there is no
such message for not existent or missing devices.

Add error message for missing devices for consistency.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
@mku514k mku514k force-pushed the mkus-unify-errors branch 2 times, most recently from b58ba4e to 9bb7923 Compare April 9, 2024 07:24
@mku514k mku514k requested a review from mtkaczyk April 9, 2024 07:26
Copy link
Contributor

@mtkaczyk mtkaczyk left a comment

Choose a reason for hiding this comment

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

Few new test related comments.
The change looks good, just small adjustments.

tests/ledctl/ledctl_cmd.py Outdated Show resolved Hide resolved
tests/ledctl/ledctl_cmd.py Outdated Show resolved Hide resolved
tests/ledctl/ledctl_cmd.py Outdated Show resolved Hide resolved
tests/ledctl/parameters_test.py Outdated Show resolved Hide resolved
tests/ledctl/parameters_test.py Outdated Show resolved Hide resolved
Add universal_newlines=True and shell=True for subprocess.run() call
in run_led_cmd(). With universal_newlines decoding to utf-8 is not
needed. Without shell param returncodes and some output lines are
omitted.

Change run_ledctl_cmd_decode() to run_ledctl_cmd_valid().
It returns stdout only, raise exception if non zero status is returned.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
Add tests for checking output for not existing and unsupported devices.

Add run_ledctl_cmd_not_valid() function for checking negative scenarios.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
@ktanska ktanska merged commit f258a02 into intel:master Apr 9, 2024
11 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.

None yet

3 participants