Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#3827 closed enhancement (duplicate)

include config.h in .cc unit test files

Reported by: fdupont Owned by: UnAssigned
Priority: low Milestone: Kea0.9.2-beta
Component: Unclassified 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

The idea is simply: add (when it is not yet) a #include <config.h> after the head/copyright comment in all unit test .cc files.

The rationale is from this test comment:
To compile your *tests* that use the gtest shared library, add

-DGTEST_LINKED_AS_SHARED_LIBRARY=1

to the compiler flags.

Note: while the above steps aren't technically necessary today when
using some compilers (e.g. GCC), they may become necessary in the
future, if we decide to improve the speed of loading the library (see
http://gcc.gnu.org/wiki/Visibility for details). Therefore you are
recommended to always add the above flags when using Google Test as a
shared library. Otherwise a future release of Google Test may break
your build script.

IMHO this kind of things should go in the config.h file so it has to be included. Note if test doesn't use visibility stuff (perhaps because test developments stopped) the reasoning still applies and not only for Windows DLLs.

Anyway I propose the address this in two phases: first collect comments, second propose a patch for all files where the win32 branch required to add such include. Note an alternative could be to just apply this to all unit test files (i.e., files including <gtest/gtest.h> .

Subtickets

Change History (5)

comment:1 Changed 5 years ago by fdupont

  • Owner set to UnAssigned
  • Status changed from new to reviewing

Asking for comments.

comment:2 Changed 5 years ago by fdupont

Because of #3845 (aka c++11) changed into: for all files *.cc files including gtest.h include first config.h .

comment:3 Changed 5 years ago by fdupont

Merged into #3845...

comment:4 Changed 5 years ago by fdupont

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

comment:5 Changed 5 years ago by tomek

  • Milestone changed from Kea-proposed to Kea0.9.2
Note: See TracTickets for help on using tickets.