sonic-swss icon indicating copy to clipboard operation
sonic-swss copied to clipboard

Add argument parsing to mock_tests to enable SWSS debugs

Open mikemallin opened this issue 1 year ago • 1 comments

NOTE: This depends on the changes in https://github.com/sonic-net/sonic-swss-common/pull/914

What I did Added new program options to the SWSS Mock Tests to enable dumping SWSS debugs:

Supported logging options:                                                         
  --help                                Display program help
  -l [ --swss-log-level ] arg (=NOTICE) Sets the SWSS logging level. Supported 
                                        levels are: EMERG, ALERT, CRIT, ERROR, 
                                        WARN, NOTICE, INFO, DEBUG
  --swss-log-output arg (=SYSLOG)       Sends SWSS logs to the desired output 
                                        stream. Supported locations are: 
                                        SYSLOG, STDOUT, STDERR

Why I did it

  • Debugging without the logs is painful

How I verified it

  • ./tests --help:
Supported logging options:     
  --help                                Display program help
  -l [ --swss-log-level ] arg (=NOTICE) Sets the SWSS logging level. Supported 
                                        levels are: EMERG, ALERT, CRIT, ERROR, 
                                        WARN, NOTICE, INFO, DEBUG           
  --swss-log-output arg (=SYSLOG)       Sends SWSS logs to the desired output 
                                        stream. Supported locations are: 
                                        SYSLOG, STDOUT, STDERR

This program contains tests written using Google Test. You can use the
following command line flags to control its behavior:

<snip>
  • ./tests --swss-log-level DEBUG --swss-log-output STDOUT --gtest_filter=RouteOrch*:
NOTICE:- doTask: Route 10.10.10.10/32: resize ipv to match alsv, 0 -> 1.
NOTICE:- doTask: Route 10.10.10.10/32: set the empty nexthop ip to zero.
  INFO:- create_entry: EntityBulker.create_entry 1, 1, 1

  WARN:- doTask: Route 192.168.0.1/32 is received on non L3 VNI 5000
  INFO:- flush_creating_entries: EntityBulker.flush creating_entries 1

  INFO:- increaseRouterIntfsRefCount: Router interface Ethernet0 ref count is increased to 5
  INFO:- addRoutePost: Post create route 10.10.10.10/32 with next hop(s) 0.0.0.0@Ethernet0
  INFO:- isMuxNexthops: No mux nexthop found
NOTICE:- uninitialize: begin
NOTICE:- uninitialize: stopping threads
NOTICE:- stopUnittestThread: begin
NOTICE:- unittestChannelThreadProc: exit VS unittest channel thread
NOTICE:- stopUnittestThread: end
NOTICE:- stopFdbAgingThread: begin
NOTICE:- fdbAgingThreadProc: end
[Thread 0x7ffff5d89700 (LWP 47996) exited]
NOTICE:- stopFdbAgingThread: end
NOTICE:- stopEventQueueThread: begin
NOTICE:- processQueueEvent: received EVENT_TYPE_END_THREAD, will process all messages and end
[Thread 0x7ffff658a700 (LWP 47997) exited]
NOTICE:- stopEventQueueThread: end
[Thread 0x7ffff6d8b700 (LWP 47995) exited]
NOTICE:- ~SwitchState: begin
NOTICE:- ~SwitchState: switch oid:0x2100000000
NOTICE:- ~SwitchState: end
NOTICE:- uninitialize: end                                                                                                        

mikemallin avatar Sep 08 '24 15:09 mikemallin

Thank you @siqbal1986 ! Would you be able to approve https://github.com/sonic-net/sonic-swss-common/pull/914 as well? This change depends on it.

mikemallin avatar Sep 11 '24 14:09 mikemallin