Re: [dpdk-dev] [PATCH v19 7/7] app/test: add dmadev API test
From: Walsh, Conor <hidden>
Date: 2021-09-03 15:38:33
This is a tradeoff point. If we changed the log level of dmadev, it is difficult to know where the test case fails. So I prefer add more meaningful information, at least print out the function name. And V19 add format function name in log default, so the rte_dmadev's log will show like: rte_dmadev_configure(): Invalid dev_id=64 rte_dmadev_configure(): Device 4 configure zero vchans rte_dmadev_configure(): Device 4 configure too many vchans rte_dmadev_configure(): Device 4 don't support silent test_dmadev_configure Passed rte_dmadev_vchan_setup(): Invalid dev_id=64 rte_dmadev_vchan_setup(): Device 4 number of descriptors invalid rte_dmadev_vchan_setup(): Device 4 vchan out range! rte_dmadev_vchan_setup(): Device 4 direction invalid! rte_dmadev_vchan_setup(): Device 4 direction invalid! rte_dmadev_vchan_setup(): Device 4 don't support mem2dev transfer rte_dmadev_vchan_setup(): Device 4 don't support dev2mem transfer rte_dmadev_vchan_setup(): Device 4 don't support dev2dev transfer rte_dmadev_vchan_setup(): Device 4 number of descriptors invalid rte_dmadev_vchan_setup(): Device 4 number of descriptors invalid rte_dmadev_vchan_setup(): Device 4 source port type invalid rte_dmadev_vchan_setup(): Device 4 destination port type invalid
I thought it would be cleaner, could you suppress the output only before and re-enable after negative testing? It's a lot of output to print to a user, in the driver tests extra information is only printed in the case of an error or failure. The line of code shown below will only suppress output from the dmadev lib not EAL or test. I don’t have a very strong opinion either way, I wanted to improve usability. With or without this change/cleanup: Reviewed-by: Conor Walsh <redacted>
On 2021/9/2 22:11, Walsh, Conor wrote:quoted
Hi Chengwen, The output from the API tests is not very straightforward to interpret if youare not familiar with these tests.quoted
Could we change the log level of the dmadev library before and after theAPI tests using something similar toquoted
The code I have included inline below?quoted
+static int +testsuite_setup(uint16_t dev_id) +{ + test_dev_id = dev_id; + invalid_dev_id = RTE_DMADEV_MAX_DEVS; + + src = rte_malloc("dmadev_test_src", TEST_MEMCPY_SIZE, 0); + if (src == NULL) + return -ENOMEM; + dst = rte_malloc("dmadev_test_dst", TEST_MEMCPY_SIZE, 0); + if (dst == NULL) + return -ENOMEM;/* Set dmadev log level to critical to suppress unnecessary outputduring API tests. */quoted
rte_log_set_level_pattern("lib.dmadev", RTE_LOG_CRIT);quoted
+ + total = 0; + passed = 0; + failed = 0; + + return 0; +} + +static void +testsuite_teardown(void) +{ + rte_free(src); + rte_free(dst); + /* Ensure the dmadev is stopped. */ + rte_dmadev_stop(test_dev_id);rte_log_set_level_pattern("lib.dmadev", RTE_LOG_INFO);quoted
+}This change would bring your output down from: ### Test dmadev infrastructure using skeleton driver test_dmadev_get_dev_id Passed test_dmadev_is_valid_dev Passed test_dmadev_count Passed Invalid dev_id=64 test_dmadev_info_get Passed Invalid dev_id=64 Device 1 configure zero vchans Device 1 configure too many vchans Device 1 don't support silent test_dmadev_configure Passed Invalid dev_id=64 Device 1 number of descriptors invalid Device 1 vchan out range! Device 1 direction invalid! Device 1 direction invalid! Device 1 don't support mem2dev transfer Device 1 don't support dev2mem transfer Device 1 don't support dev2dev transfer Device 1 number of descriptors invalid Device 1 number of descriptors invalid Device 1 source port type invalid Device 1 destination port type invalid test_dmadev_vchan_setup Passed Invalid dev_id=64 Invalid dev_id=64 Device 1 must be stopped to allow configuration Device 1 must be stopped to allow configuration test_dmadev_start_stop Passed Invalid dev_id=64 Invalid dev_id=64 Invalid dev_id=64 Device 1 vchan 1 out of range Device 1 vchan 1 out of range test_dmadev_stats Passed test_dmadev_completed Passed test_dmadev_completed_status Passed Device 1 already stopped Total tests : 10 Passed : 10 Failed : 0 skeldma_remove(): Remove dma_skeleton dmadev To: ### Test dmadev infrastructure using skeleton driver test_dmadev_get_dev_id Passed test_dmadev_is_valid_dev Passed test_dmadev_count Passed test_dmadev_info_get Passed test_dmadev_configure Passed test_dmadev_vchan_setup Passed test_dmadev_start_stop Passed test_dmadev_stats Passed test_dmadev_completed Passed test_dmadev_completed_status Passed Total tests : 10 Passed : 10 Failed : 0 skeldma_remove(): Remove dma_skeleton dmadev Thanks, Conor. .