Opened 7 months ago

Closed 7 months ago

#33641 closed defect (fixed)

Spurious coverity unreachable warning after all bugs are fatal test skip

Reported by: teor Owned by:
Priority: Medium Milestone: Tor: 0.4.4.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: 044-must, coverity, false-positive
Cc: Actual Points:
Parent ID: Points: 0.1
Reviewer: Sponsor:

Description

There's a spurious coverity warning about unreachable code, in tests that we're skipping when ALL_BUGS_ARE_FATAL is defined.

I guess we need to wrap those skips in #ifndef COVERITY.

** CID 1460753:  Control flow issues  (UNREACHABLE)
/src/test/test_dir.c: 4998 in test_dir_purpose_needs_anonymity_returns_true_by_default()


________________________________________________________________________________________________________
*** CID 1460753:  Control flow issues  (UNREACHABLE)
/src/test/test_dir.c: 4998 in test_dir_purpose_needs_anonymity_returns_true_by_default()
4992       (void)arg;
4993     
4994     #ifdef ALL_BUGS_ARE_FATAL
4995       tt_skip();
4996     #endif
4997     
   CID 1460753:  Control flow issues  (UNREACHABLE)
   This code cannot be reached: "tor_capture_bugs_(1);".
4998       tor_capture_bugs_(1);
4999       setup_full_capture_of_logs(LOG_WARN);
5000       tt_int_op(1, OP_EQ, purpose_needs_anonymity(0, 0, NULL));
5001       tt_int_op(1, OP_EQ, smartlist_len(tor_get_captured_bug_log_()));
5002       expect_single_log_msg_containing("Called with dir_purpose=0");
5003     

** CID 1460752:  Control flow issues  (UNREACHABLE)
/src/test/test_circuitbuild.c: 123 in test_new_route_len_unhandled_exit()


________________________________________________________________________________________________________
*** CID 1460752:  Control flow issues  (UNREACHABLE)
/src/test/test_circuitbuild.c: 123 in test_new_route_len_unhandled_exit()
117     #ifdef ALL_BUGS_ARE_FATAL
118       tt_skip();
119     #endif
120     
121       MOCK(count_acceptable_nodes, mock_count_acceptable_nodes);
122     
   CID 1460752:  Control flow issues  (UNREACHABLE)
   This code cannot be reached: "tor_capture_bugs_(1);".
123       tor_capture_bugs_(1);
124       setup_full_capture_of_logs(LOG_WARN);
125       r = new_route_len(CIRCUIT_PURPOSE_CONTROLLER, &dummy_ei, &dummy_nodes);
126       tt_int_op(DEFAULT_ROUTE_LEN + 1, OP_EQ, r);
127       tt_int_op(smartlist_len(tor_get_captured_bug_log_()), OP_EQ, 1);
128       tt_str_op(smartlist_get(tor_get_captured_bug_log_(), 0), OP_EQ,

Child Tickets

Change History (2)

comment:1 Changed 7 months ago by teor

Status: newneeds_review

See my PR:

No changes file required, not in any released version of tor.

comment:2 Changed 7 months ago by nickm

Resolution: fixed
Status: needs_reviewclosed

LGTM. Merged to master.

Note: See TracTickets for help on using tickets.