[SERVER-25822] Prohibit linking unittest library into core mongodb binaries Created: 26/Aug/16  Updated: 12/Nov/20  Resolved: 12/Nov/20

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 4.9.0

Type: Improvement Priority: Major - P3
Reporter: Andy Schwerin Assignee: Daniel Moody
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-25520 unittest library should not be linked... Closed
related to SERVER-52807 libraries should inherit the AIB_COMP... Closed
Backwards Compatibility: Fully Compatible
Sprint: Dev Platform 2020-11-16
Participants:

 Description   

It should be an error detected at build-time to link the unittest library into the mongo shell, mongod or mongos.

I was thinking that we could add a symbol to the unittest library, and the same symbol to a library called "unittest_forbidden", and link "unittest_forbidden"
into mongo, mongos and mongod. That would at least achieve the goal.



 Comments   
Comment by Githook User [ 12/Nov/20 ]

Author:

{'name': 'Daniel Moody', 'email': 'daniel.moody@mongodb.com', 'username': 'dmoody256'}

Message: SERVER-25822 added callback to support preventing given components from linking together
Branch: master
https://github.com/mongodb/mongo/commit/84a7bc6af3f79a5e441cb037ed37395fabfc5f99

Comment by Andrew Morrow (Inactive) [ 22/Aug/20 ]

While the linker based approach would work, I think we can probably come up with something within libdeps.py itself. We already have the LIBDEPS_TAGS feature and we also now have AIB_COMPONENT and AIB_ROLE. It seems plausible that we could leverage those to achieve this. It would be nice to make more general declarations, such as "production code cannot depend on test code", or "embedded must not depend on networking" or "ephemeralForTest must not rely on WT". Potentially, such a facility could be used to help enforce layering violations as well.

Generated at Thu Feb 08 04:10:19 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.