Describe the problem
After the new feature to run other main()-like functions as a subprocess, flit bisect is broken when doing symbol bisect over the test file itself. This is because we get the error that the main function has already been registered. This happens due to both of the object files have the same static object being built, so the registration happens twice.
Suggested Fix
Allow for registration to happen more than once. Just require that if it is called more than once, that it maps the same name to the same function pointer.
While we're at it, we could put the same robustness into the registration of flit tests.
Alternative approaches:
Somehow fix it so that the test only gets registered once. A few potential approaches:
have the user call flit::registerTest() instead of FLIT_REGISTER_TEST() and ensure it is called only once.
find an alternative implementation of FLIT_REGISTER_TEST() that does not require a static variable.
change symbol bisect to ensure only one of the static variables exist in the final executable.
I personally don't like any of these alternatives very much. They are feasible, but I believe they provide little to no value and are more difficult to implement.
A clear and concise description of any alternative solutions or features you've
considered.
Bug Report
Describe the problem After the new feature to run other
main()
-like functions as a subprocess,flit bisect
is broken when doing symbol bisect over the test file itself. This is because we get the error that the main function has already been registered. This happens due to both of the object files have the same static object being built, so the registration happens twice.Suggested Fix Allow for registration to happen more than once. Just require that if it is called more than once, that it maps the same name to the same function pointer.
While we're at it, we could put the same robustness into the registration of flit tests.
Alternative approaches: Somehow fix it so that the test only gets registered once. A few potential approaches:
flit::registerTest()
instead ofFLIT_REGISTER_TEST()
and ensure it is called only once.FLIT_REGISTER_TEST()
that does not require a static variable.I personally don't like any of these alternatives very much. They are feasible, but I believe they provide little to no value and are more difficult to implement.
A clear and concise description of any alternative solutions or features you've considered.