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

ras/hwinfo.py: fix false positive test-cases #2775

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

misanjumn
Copy link
Contributor

@misanjumn misanjumn commented Mar 18, 2024

ras/hwinfo.py: fix false positive test-cases

Added check to "--save-config SPEC" test to FAIL
when hwinfo fails to save the configuration file

Added check to "--show-config SPEC" test to CANCEL
when there is no saved configuration file present

Removed reduntant self.log(..) function wherever
necessary

Added "=all" to "--save-config" self.fail() message
to make it more meaningful

Signed-off-by: Misbah Anjum N [email protected]

@misanjumn
Copy link
Contributor Author

Without the patch:-

Status: False Positive
Commad: hwinfo --disk --save-config <UID>

Save Configuration:
  <UID>: failed

/home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_save: STARTED
/home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_save:  PASS (0.61 s)

Status: False Positive
Commad: hwinfo --disk --show-config <UID>

No config data: <UID>

/home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_show: STARTED
/home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_show:  PASS (0.69 s)

With the patch:-

Status: Fail
Commad: hwinfo --disk --save-config <UID>

Save Configuration:
  <UID>: failed

/home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_save: STARTED
/home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_save:  FAIL: hwinfo: --save-config UDI option failed (0.71 s)

Status: Cancel
Commad: hwinfo --disk --show-config <UID>

No config data: <UID>

/home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_show: STARTED
/home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_show:  CANCEL: hwinfo: --save-config UDI cancelled, no saved config present (0.68 s)

@misanjumn
Copy link
Contributor Author

misanjumn commented Mar 18, 2024

Reasoning

  1. Added Status: Fail
    For commad: hwinfo --disk --save-config <UID>

Reason:
If we are unable to create a configurative file for the device, the output will echo ": failed"
Hence the test is marked as FAIL in this case, eliminating False-Positive scenario
Otherwise, the test will PASS

  1. Added Status: Fail
    For commad: hwinfo --disk --show-config <UID>

Reason:
If there is no saved configuration file in /var/lib/hardware/uid, the output will echo "No config data: "
Hence the test is marked as CANCEL in this case, eliminating False-Positive scenario
Otherwise, the test will PASS

ras/hwinfo.py Outdated Show resolved Hide resolved
ras/hwinfo.py Show resolved Hide resolved
Added check to "--save-config SPEC" test to FAIL
when hwinfo fails to save the configuration file

Added check to "--show-config SPEC" test to CANCEL
when there is no saved configuration file present

Removed reduntant self.log(..) function wherever
necessary

Added "=all" to "--save-config" self.fail() message
to make it more meaningful

Signed-off-by: Misbah Anjum N <[email protected]>
@misanjumn
Copy link
Contributor Author

seems redundant as any way you logging same in self.fail

Hi Praveen,

As per your comments, I have also removed few more reduntant self.log functions in the program wherever necessary and verified the same by running the hwinfo.py file.

Thank you.

(01/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_list: STARTED
(01/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_list:  PASS (7.20 s)
(02/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_disk: STARTED
(02/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_disk:  PASS (0.57 s)
(03/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_save: STARTED
(03/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_save:  FAIL: hwinfo: --save-config UDI option failed (0.71 s)
(04/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_show: STARTED
(04/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_unique_id_show:  CANCEL: hwinfo: --save-config UDI cancelled, no saved config present (0.70 s)
(05/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_verbose_map: STARTED
(05/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_verbose_map:  PASS (0.68 s)
(06/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_log_file: STARTED
(06/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_log_file:  PASS (6.86 s)
(07/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_dump_0: STARTED
(07/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_dump_0:  PASS (0.46 s)
(08/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_dump_1: STARTED
(08/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_dump_1:  PASS (2476.43 s)
(09/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_version: STARTED
(09/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_version:  PASS (0.45 s)
(10/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_help: STARTED
(10/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_help:  PASS (0.45 s)
(11/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_debug: STARTED
(11/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_debug:  PASS (0.58 s)
(12/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_short_block: STARTED
(12/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_short_block:  PASS (0.59 s)
(13/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_save_config: STARTED
(13/13) /home/misanjumn/tests/tests/avocado-misc-tests/ras/hwinfo.py:Hwinfo.test_save_config:  FAIL: hwinfo: --save-config=all option failed (0.71 s)

@Naresh-ibm Naresh-ibm self-assigned this Mar 19, 2024
@PraveenPenguin PraveenPenguin merged commit 98e180c into avocado-framework-tests:master Mar 21, 2024
2 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.

3 participants