Unit test: enable plugin dso logic to build and run unit tests.
This was disabled at some point. A few commits were made over this code without the unit tests being enabled so this was failing. So I had to make some changes to make sure it works.
Changes were made back in the days to enable this but it seems they weren't enough, this make sure all the unit tests are running(and eventually passing).
TL;DR : It build, runs and passed all autests, except OSX which I will be fixing in the near future. Also fixes a few coverity issues.
State of this PR :books:
It was a bit tricky to build, link and run all the tests due the nature of the remap plugin "subsystem", to achieve this I had to perform a couple of things/tricks.
ASAN :gun:
- Asan was complaining about
dlopenleaking, I did some tests where I was tracing alldlopen/dlcloseand they were all closed properly(you can calldlopenwithRTLD_NOLOADand check the return value to make sure it was a resident anymore. This seems not to be the first time that a "leak" is detected in thedlopen, so to mute this a suppress file was added for this. - Disable ORD violation caused by double definition inside a stub file ( :vomiting_face: )
- Also fixes a couple of leaks found by asan. :smile:
Coverity :man_dancing:
-
CID-1544442 -
CID-1544451 -
CID-1544433
OSX :man_facepalming:
It compiles the code, compiles the unit tests but it does not run them(3). I do not have OSX(I will arrange to have one) to fix the issue, although some attempts couldn't make it work:
Start 31: test_PluginFactory
29/135 Test #30: test_PluginDso .........................Subprocess aborted***Exception: 1.15 sec
dyld[70850]: symbol not found in flat namespace '_ET_DNS'
Start 32: test_RemapPluginInfo
30/135 Test #31: test_PluginFactory .....................Subprocess aborted***Exception: 0.68 sec
dyld[70853]: symbol not found in flat namespace '_ET_UDP'
Start 33: test_NextHopStrategyFactory
31/135 Test #32: test_RemapPluginInfo ...................Subprocess aborted***Exception: 0.40 sec
dyld[70854]: symbol not found in flat namespace '_ET_UDP'
Final Note :fist_oncoming:
We can discuss next week if we want to go ahead and merge this in or wait till I get OSX fixed.
fixes: https://github.com/apache/trafficserver/issues/11341
[approve ci osx]
[approve ci autest]
ping @vmamidi
NOTE
I had to add [[maybe_unused]] instad of our way /* ATS_UNUSED */ because the linker omits the symbols from the generated object in the later case, which makes the tests fail as it actually checks for the symbols.
Lets merge this and work from there since this is working on linux
and FreeBSD :rofl:
Cherry-picked to v10.0.x