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

basic test for validating fw version #214

Merged
merged 6 commits into from
Jul 23, 2024

Conversation

Arun-Prasad-V
Copy link

@Arun-Prasad-V Arun-Prasad-V commented Jul 4, 2024

Tracked by LRS-1119

@Arun-Prasad-V Arun-Prasad-V marked this pull request as ready for review July 9, 2024 06:34
test/run_ci.py Outdated Show resolved Hide resolved
@Nir-Az
Copy link
Collaborator

Nir-Az commented Jul 10, 2024

@Arun-Prasad-V can you please add some running command output screenshot?

@Arun-Prasad-V
Copy link
Author

Arun-Prasad-V commented Jul 10, 2024

The command line output looks like:

$ python3 run_ci.py
---Test Passed---
log path: /home/nvidia/realsense_mipi_platform_driver/test/logs
server took 1.0238373279571533 seconds

Below is the content of the pytest log generated at /home/nvidia/realsense_mipi_platform_driver/test/logs/D457_full.log:

writing pytestdebug information to /home/nvidia/realsense_mipi_platform_driver/test/pytestdebug.log
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-4.6.9, py-1.8.1, pluggy-0.13.0 -- /usr/bin/python2
using: pytest-4.6.9 pylib-1.8.1
rootdir: /home/nvidia/realsense_mipi_platform_driver/test
collected 1 item

test_fw_version.py fw version: 84869120
('fw_version: ', '0x50f0000')
.

- generated xml file: /home/nvidia/realsense_mipi_platform_driver/test/logs/D457_pytest.xml -
=========================== 1 passed in 0.10 seconds ===========================
wrote pytestdebug information to /home/nvidia/realsense_mipi_platform_driver/test/pytestdebug.log

@dmipx
Copy link
Contributor

dmipx commented Jul 10, 2024

test_fw_version.py fw version: 84869120
('fw_version: ', '0x50f0000')

Can we convert decimal value to hex so we can understand what was compared?
Another test can be compare v4l2-ctl value with version we read from dfu procedure

cat /dev/d4xx-dfu-0

@Arun-Prasad-V
Copy link
Author

Can we convert decimal value to hex so we can understand what was compared?

Printed the FW version in 5.x.x.x format.

Another test can be compare v4l2-ctl value with version we read from dfu procedure

Added this check as well in the same test


Sample output log:

writing pytestdebug information to /home/nvidia/realsense_mipi_platform_driver/test/pytestdebug.log
============================= test session starts ==============================
platform linux2 -- Python 2.7.18, pytest-4.6.9, py-1.8.1, pluggy-0.13.0 -- /usr/bin/python2
using: pytest-4.6.9 pylib-1.8.1
rootdir: /home/nvidia/realsense_mipi_platform_driver/test
collected 1 item

test_fw_version.py fw version: 84869120
('fw_version:', '5.15.0.0')
.

- generated xml file: /home/nvidia/realsense_mipi_platform_driver/test/logs/D457_pytest.xml -
=========================== 1 passed in 0.10 seconds ===========================
wrote pytestdebug information to /home/nvidia/realsense_mipi_platform_driver/test/pytestdebug.log

@Nir-Az
Copy link
Collaborator

Nir-Az commented Jul 11, 2024

Will the run_ci script output a test fail if this test will fail?

I prefer to see something like:
running test <test1> - pass
running test <test2> - fail
Summery, 1 / 2 tests passed
return error code != 0

@Arun-Prasad-V
Copy link
Author

Will the run_ci script output a test fail if this test will fail?

Updated the script to print test summary. Sample command line output:

$ python3 run_ci.py
===================== TEST SUMMARY ======================================
Total tests: 1 . Passed: 1 Failed: 0 Skipped: 0
=========================================================================
log path: /home/nvidia/realsense_mipi_platform_driver/test/logs
server took 1.0546281337738037 seconds

I prefer to see something like: running test <test1> - pass running test <test2> - fail

Such detailed logs are logged in /logs folder.
@Nir-Az, do you want them on console as well?

@Nir-Az
Copy link
Collaborator

Nir-Az commented Jul 18, 2024

Will the run_ci script output a test fail if this test will fail?

Updated the script to print test summary. Sample command line output:

$ python3 run_ci.py
===================== TEST SUMMARY ======================================
Total tests: 1 . Passed: 1 Failed: 0 Skipped: 0
=========================================================================
log path: /home/nvidia/realsense_mipi_platform_driver/test/logs
server took 1.0546281337738037 seconds

I prefer to see something like: running test <test1> - pass running test <test2> - fail

Such detailed logs are logged in /logs folder. @Nir-Az, do you want them on console as well?

If we can have it on consol it will be great.

@Arun-Prasad-V
Copy link
Author

@Nir-Az, updated the script, such that the pytest logs the status on console. It will print the testcase details and give the summary at end.

Sample console output:

$ python3 run_ci.py
================================================= test session starts ==================================================
platform linux2 -- Python 2.7.18, pytest-4.6.9, py-1.8.1, pluggy-0.13.0 -- /usr/bin/python2
cachedir: .pytest_cache
rootdir: /home/nvidia/realsense_mipi_platform_driver/test
collected 1 item

test_fw_version.py::test_fw_version[0] fw version: 84869120
('fw_version:', '5.15.0.0')
PASSED

---------- generated xml file: /home/nvidia/realsense_mipi_platform_driver/test/logs/D457_pytest.xml ----------
=============================================== 1 passed in 0.10 seconds ===============================================
server took 1.022791862487793 seconds

@Nir-Az Nir-Az merged commit 29c0bb4 into IntelRealSense:dev Jul 23, 2024
3 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