GNOME Bugzilla – Bug 699774
testing: convert NetworkManager's main function to a configurable application object
Last modified: 2020-11-12 14:29:05 UTC
NetworkManager's main function cannot be used by testing binaries. The actual main function should be as simple as possible: 1) Create an application object 2) Configure the application object (possibly passing argv to its method) 3) Initialize the application object 4) Run the application object That way you can create another binary as part of a testsuite that would replace (or amend) #2 with specific configuration. Also, between #3 and #4, you could access the object members to get to other NetworkManager components and install your own hooks (signal handlers) to check whether everything works as expected by the testsuite.
danw/norecurse (work-in-progress, part of bug 699504) builds everything except main.c as libNetworkManager.la, which the tests then link against. That's probably a good base for this.
I don't think we need this anymore. NM consists or a large number of singleton instances (NMPlatform, NMManager, NMPolicy, etc.) Some of these are actually tested in unit-tests (NMPlatform, NMConfig, NMRouteManager). Many are not. Sure, we should try to improve our unit tests. But IMO we don't need a more hook-able main() function. Vote for closing this one.
bugzilla.gnome.org is being shut down in favor of a GitLab instance. We are closing all old bug reports and feature requests in GNOME Bugzilla which have not seen updates for a long time. If you still use NetworkManager and if you still see this bug / want this feature in a recent and supported version of NetworkManager, then please feel free to report it at https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/ Thank you for creating this report and we are sorry it could not be implemented (workforce and time is unfortunately limited).