trafficserver icon indicating copy to clipboard operation
trafficserver copied to clipboard

Unit test: enable plugin dso logic to build and run unit tests.

Open brbzull0 opened this issue 1 year ago • 3 comments

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 dlopen leaking, I did some tests where I was tracing all dlopen/dlclose and they were all closed properly(you can call dlopen with RTLD_NOLOAD and 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 the dlopen, 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

brbzull0 avatar May 20 '24 13:05 brbzull0

[approve ci osx]

brbzull0 avatar May 23 '24 12:05 brbzull0

[approve ci autest]

brbzull0 avatar May 23 '24 12:05 brbzull0

ping @vmamidi

brbzull0 avatar Jun 19 '24 09:06 brbzull0

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.

brbzull0 avatar Jul 25 '24 14:07 brbzull0

Lets merge this and work from there since this is working on linux

and FreeBSD :rofl:

brbzull0 avatar Jul 25 '24 19:07 brbzull0

Cherry-picked to v10.0.x

cmcfarlen avatar Jul 26 '24 15:07 cmcfarlen