Opened 9 years ago

Closed 9 years ago

#273 closed defect (fixed)

passing NULL to non-pointer argument 3 for some unit tests

Reported by: jreed Owned by: each
Priority: medium Milestone: 06. 4th Incremental Release
Component: data source Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity:
Sub-Project: Feature Depending on Ticket:
Estimated Difficulty: Add Hours to Ticket:
Total Hours: Internal?:

Description

#192 caused build failures on my NetBSD with g++ (GCC) 4.1.3

g++ -DHAVE_CONFIG_H -I. -I../../../../../src/lib/datasrc/tests -I../../../..  -I../../../../../src/lib -I../../../../src/lib  -I../../../../src/lib/dns -I../../../../../src/lib/dns  -DTEST_DATA_DIR=\"../../../../../src/lib/datasrc/tests/testdata\" -I/usr/pkg/include -I/usr/pkg/include -I../../../../../ext/asio -DASIO_DISABLE_KQUEUE=1 -Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -Werror -fPIC -g -MT run_unittests-datasrc_unittest.o -MD -MP -MF .deps/run_unittests-datasrc_unittest.Tpo -c -o run_unittests-datasrc_unittest.o `test -f 'datasrc_unittest.cc' || echo '../../../../../src/lib/datasrc/tests/'`datasrc_unittest.cc
cc1plus: warnings being treated as errors
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc: In member function 'virtual void<unnamed>::DataSrcMatchTest_matchWithWrongClass_Test::TestBody()':
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc:991: warning: passing NULL to non-pointer argument 3 of 'static testing::AssertionResult testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, T2*) [with T1 = long int, T2 = const isc::dns::Name]'
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc:992: warning: passing NULL to non-pointer argument 3 of 'static testing::AssertionResult testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, T2*) [with T1 = long int, T2 = const isc::datasrc::DataSrc]'
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc: In member function 'virtual void<unnamed>::DataSrcMatchTest_updateWithWrongClass_Test::TestBody()':
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc:1007: warning: passing NULL to non-pointer argument 3 of 'static testing::AssertionResult testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, T2*) [with T1 = long int, T2 = const isc::dns::Name]'
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc:1008: warning: passing NULL to non-pointer argument 3 of 'static testing::AssertionResult testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, T2*) [with T1 = long int, T2 = const isc::datasrc::DataSrc]'
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc:1012: warning: passing NULL to non-pointer argument 3 of 'static testing::AssertionResult testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, T2*) [with T1 = long int, T2 = const isc::dns::Name]'
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc:1013: warning: passing NULL to non-pointer argument 3 of 'static testing::AssertionResult testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, T2*) [with T1 = long int, T2 = const isc::datasrc::DataSrc]'
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc: In member function 'virtual void<unnamed>::DataSrcMatchTest_initialUpdateWithNoMatch_Test::TestBody()':
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc:1049: warning: passing NULL to non-pointer argument 3 of 'static testing::AssertionResult testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, T2*) [with T1 = long int, T2 = const isc::dns::Name]'
../../../../../src/lib/datasrc/tests/datasrc_unittest.cc:1050: warning: passing NULL to non-pointer argument 3 of 'static testing::AssertionResult testing::internal::EqHelper<true>::Compare(const char*, const char*, const T1&, T2*) [with T1 = long int, T2 = const isc::datasrc::DataSrc]'
*** Error code 1

Evan shared some ideas and I patched a few files. (More errors than above). Attached is the patch. Please review.

Subtickets

Attachments (1)

273.diff (4.1 KB) - added by jreed 9 years ago.

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by jreed

comment:1 in reply to: ↑ description Changed 9 years ago by jinmei

  • Component changed from Unclassified to data source
  • Milestone set to 06. 4th Incremental Release
  • Owner set to each
  • Status changed from new to reviewing

Replying to jreed:

Evan shared some ideas and I patched a few files. (More errors than above). Attached is the patch. Please review.

I don't think replacing EXPECT_EQ with EXPECT_{TRUE,FALSE} is a good idea because the latter is less informative on failure. Besides, regarding a pointer value as boolean is itself not a good practice.

Actually, we already encoutered this problem and fixed in a cleaner way, but somehow it seemed to be reverted (e.g. in r2383). We should revive them, and apply the same sense of change to other cases.

Giving it back to Evan.

comment:2 Changed 9 years ago by each

  • Resolution set to fixed
  • Status changed from reviewing to closed

Thanks Jinmei, I didn't realize we'd seen this before, and apparently missed the static_cast changes when I was merging to trunk. I put back the static_cast that had been there before, and duplicated it in two new tests that also needed it.

Checked in in r2394. Since this is pre-existing code I'm not going to bother with review.

comment:3 follow-up: Changed 9 years ago by jreed

  • Resolution fixed deleted
  • Status changed from closed to reopened

This was closed, but my patch also covered src/lib/datasrc/tests/sqlite3_unittest.cc and src/lib/datasrc/tests/static_unittest.cc. I can do the same fix there if okay. I am re-opening this.

comment:4 in reply to: ↑ 3 Changed 9 years ago by each

  • Resolution set to fixed
  • Status changed from reopened to closed

This was closed, but my patch also covered src/lib/datasrc/tests/sqlite3_unittest.cc and src/lib/datasrc/tests/static_unittest.cc. I can do the same fix there if okay. I am re-opening this.

Oops sorry about that, I thought it was only the one file... teach me to read the whole ticket next time. I've made the change and committed it.

Note: See TracTickets for help on using tickets.