Opened 3 years ago

Last modified 2 years ago

#3679 new defect

uncaught exceptions while logger initialization in unit tests

Reported by: wlodekwencel Owned by:
Priority: low Milestone: Outstanding Tasks
Component: tests Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

Coverity reported uncaught exceptions (all are the same) in files:
/src/lib/log/tests/run_unittests.cc
/src/lib/log/tests/run_unittests.cc
/src/bin/d2/tests/d2_unittests.cc
/src/bin/dhcp4/tests/dhcp4_unittests.cc
/src/bin/dhcp6/tests/dhcp6_unittests.cc

Coverity bug no. 1232299 1232300 1232301 1232302 1232306 1232307 1232308 1232309 1232310

Two types of exceptions:

22    ::testing::InitGoogleTest(&argc, argv);
  	fun_call_w_exception: Called function throws an exception of type UnknownLoggingDestination. [show details]
23    isc::log::initLogger();
24
25    int result = RUN_ALL_TESTS();
26
27    return result;
    ::testing::InitGoogleTest(&argc, argv);
23
24    // See the documentation of the KEA_* environment variables in
25    // src/lib/log/README for info on how to tweak logging
  	fun_call_w_exception: Called function throws an exception of type isc::InvalidOperation. [show details]
26    isc::log::initLogger();
27
28    int result = RUN_ALL_TESTS();
29
30    return (result);

Subtickets

Change History (3)

comment:1 Changed 3 years ago by tomek

  • Milestone changed from Kea-proposed to DHCP Outstanding Tasks

comment:2 Changed 3 years ago by sar

As of Feb 1 2015 (last Coverity run) there are 11 places where this occurs. Surrounding the initLogger() call with a proper try catch should clean them up.

There are also some in the logger test code but they may require more work.

Other thoughts from mail with Stpehen:

a) We can take the opportunity to make all (except the logging tests,
see below) of the "run_unittests.cc" files in the tree identical.

b) Wrapping the initLogger() call in a try/catch seems logical. The
later files call the isc::util::unittests::run_all() which includes the
try/catch wrapper. However adding the initLogger() call to that would
end up having the logging code calling the utilities code and the
utilities code calling the logging code - which seems messy.

c) You could also look at ticket #3605 when you do this work - renaming
initLogger() to avoid confusion.

comment:3 Changed 2 years ago by tomek

  • Milestone changed from DHCP Outstanding Tasks to Outstanding Tasks

Milestone renamed

Note: See TracTickets for help on using tickets.