avocado-framework / avocado

Avocado is a set of tools and libraries to help with automated testing. One can call it a test framework with benefits. Native tests are written in Python and they follow the unittest pattern, but any executable can serve as a test.
https://avocado-framework.github.io/
Other
345 stars 343 forks source link

Suggest to remove the console output of `lsmod` and `modinfo` in loaded_module_info function #6027

Open meinaLi opened 2 months ago

meinaLi commented 2 months ago

Is your feature request related to a problem? Please describe. In avocado/utils/linux_modules.py, the loaded_module_info function will print out the result of commands lsmod and modinfo. When I call unload_module function with loaded_module_info function in it, it causes this output to be printed into out debug log:

2024-09-12 23:17:03,190 libvirt          L1234 INFO | Refreshing pool
2024-09-12 23:17:03,254 process          L0658 INFO | Running '/sbin/lsmod'
2024-09-12 23:17:03,265 process          L0470 DEBUG| [stdout] Module                  Size  Used by
2024-09-12 23:17:03,265 process          L0470 DEBUG| [stdout] scsi_debug            159744  0
2024-09-12 23:17:03,266 process          L0470 DEBUG| [stdout] ext4                 1187840  1
2024-09-12 23:17:03,266 process          L0470 DEBUG| [stdout] mbcache                16384  1 ext4
2024-09-12 23:17:03,266 process          L0470 DEBUG| [stdout] jbd2                  217088  1 ext4
2024-09-12 23:17:03,266 process          L0739 INFO | Command '/sbin/lsmod' finished with 0 after 0.011299452s
2024-09-12 23:17:03,266 process          L0470 DEBUG| [stdout] target_core_user       81920  0
2024-09-12 23:17:03,267 process          L0470 DEBUG| [stdout] uio                    32768  1 target_core_user
2024-09-12 23:17:03,267 process          L0470 DEBUG| [stdout] target_core_pscsi      32768  0
2024-09-12 23:17:03,267 process          L0470 DEBUG| [stdout] target_core_file       32768  2
2024-09-12 23:17:03,267 process          L0470 DEBUG| [stdout] target_core_iblock     36864  0
2024-09-12 23:17:03,267 process          L0470 DEBUG| [stdout] iscsi_target_mod      512000  5
2024-09-12 23:17:03,267 process          L0470 DEBUG| [stdout] target_core_mod       606208  13 target_core_file,target_core_iblock,iscsi_target_mod,target_core_pscsi,target_core_user
2024-09-12 23:17:03,268 process          L0470 DEBUG| [stdout] iscsi_tcp              32768  2
2024-09-12 23:17:03,268 process          L0470 DEBUG| [stdout] libiscsi_tcp           45056  1 iscsi_tcp
2024-09-12 23:17:03,268 process          L0470 DEBUG| [stdout] libiscsi               94208  2 libiscsi_tcp,iscsi_tcp
2024-09-12 23:17:03,268 process          L0470 DEBUG| [stdout] scsi_transport_iscsi   196608  4 libiscsi_tcp,iscsi_tcp,libiscsi
2024-09-12 23:17:03,268 process          L0470 DEBUG| [stdout] ib_core               557056  0
2024-09-12 23:17:03,268 process          L0470 DEBUG| [stdout] bluetooth            1101824  0
2024-09-12 23:17:03,268 process          L0470 DEBUG| [stdout] vhost_net              36864  0
2024-09-12 23:17:03,269 process          L0470 DEBUG| [stdout] tun                    73728  1 vhost_net
2024-09-12 23:17:03,269 process          L0470 DEBUG| [stdout] vhost                  69632  1 vhost_net
2024-09-12 23:17:03,269 process          L0470 DEBUG| [stdout] vhost_iotlb            16384  1 vhost
2024-09-12 23:17:03,269 process          L0470 DEBUG| [stdout] macvtap                12288  0
2024-09-12 23:17:03,269 process          L0470 DEBUG| [stdout] macvlan                36864  1 macvtap
2024-09-12 23:17:03,269 process          L0470 DEBUG| [stdout] tap                    32768  2 macvtap,vhost_net
2024-09-12 23:17:03,269 process          L0470 DEBUG| [stdout] rpcsec_gss_krb5        45056  0
2024-09-12 23:17:03,269 process          L0470 DEBUG| [stdout] auth_rpcgss           200704  1 rpcsec_gss_krb5
......

Actually the above output in our logs is unnecessary. It also makes our debug log too long and cannot effectively debug failures. Describe the solution you'd like I suggest we can update the output in loaded_module_info function to not print the output. But I'm not sure if this output need to be used in other component tests, so I raised this issue here for further discussion.