IntelRealSense / realsense_mipi_platform_driver

Intel® RealSense™ camera driver for GMSL* interface
GNU General Public License v2.0
19 stars 15 forks source link

basic test for validating fw version #214

Closed Arun-Prasad-V closed 4 months ago

Arun-Prasad-V commented 4 months ago

Tracked by LRS-1119

Nir-Az commented 4 months ago

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

Arun-Prasad-V commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

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 commented 4 months ago

@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