apache / arrow-adbc

Database connectivity API standard and libraries for Apache Arrow
https://arrow.apache.org/adbc/
Apache License 2.0
360 stars 89 forks source link

ci(c): Enable Meson tests in CI #1949

Closed WillAyd closed 2 months ago

WillAyd commented 3 months ago

There seems to be something strange with how the ADBC tests are structured and gtest is getting used with Meson, although all Meson does with the gtest dependency is include it as a source during compilation

There was an upstream PR that had the same issue shown in CI but with a supposedly different cause:

https://github.com/google/googletest/pull/4536

Haven't been able to boil this down to an MRE yet

WillAyd commented 3 months ago

OK so appears that the approach I had before to make shared libraries for the validation / util tests was not correct. Compiling with -Db_sanitize=address reveled an ODR violation:

==370804==ERROR: AddressSanitizer: odr-violation (0x5622170fde40):
  [1] size=8 'kElidedFramesMarker' ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:4968:19
  [2] size=8 'kElidedFramesMarker' ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:4968:19
These globals were registered at these points:
  [1]:
    #0 0x7f446d837928 in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:341
    #1 0x5622170123af in _sub_I_00099_1 (/home/willayd/clones/arrow-adbc/c/builddir/driver/sqlite/adbc-driver-sqlite-test+0x1313af)
    #2 0x7f446ca29eba in call_init ../csu/libc-start.c:145
    #3 0x7f446ca29eba in __libc_start_main_impl ../csu/libc-start.c:379

  [2]:
    #0 0x7f446d837928 in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:341
    #1 0x7f446d3aa898 in _sub_I_00099_1 (/home/willayd/clones/arrow-adbc/c/builddir/validation/libadbc_validation_util.so+0x1aa898)
    #2 0x7f446e2a747d in call_init elf/dl-init.c:70

==370804==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY: AddressSanitizer: odr-violation: global 'kElidedFramesMarker' at ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:4968:19
==370804==ABORTING

So the new configuration ends up making the adbc_validation_util library always STATIC (CMake does this as well) and instead of building an adbc_validation_lib, declares that as a dependency (also roughly equivalent to the OBJECT library the CMake configuration creates for that)