fix(tap tests): gate test_mysqlx_*-t under PROXYSQL40

test/tap/tests/Makefile's tests-cpp target uses `$(wildcard *-t.cpp)`
to pick up all test sources.  test_mysqlx_e2e_handshake-t.cpp,
test_mysqlx_e2e_routing-t.cpp, test_mysqlx_listener_smoke-t.cpp,
test_mysqlx_admin_tables-t.cpp and test_mysqlx_plugin_load-t.cpp all
reference chassis types (ProxySQL_PluginServices, mysqlx_config_store.h)
that only exist in the public headers under -DPROXYSQL40.

Under a plain v3.0 build (`unset PROXYSQLGENAI && unset PROXYSQL40 &&
make debug -j && make build_tap_test_debug -j`), the wildcard still
matched them, and the generic `%-t: %-t.cpp` recipe tried to compile
them -- producing 130+ `error:` lines (mysqlx_config_store.h not
found, Mysqlx::Datatypes::* conversion failures, ProxySQL_PluginServices
undeclared, etc.).  Reported by the user.

Fix: autodetect PROXYSQL40 via `nm libproxysql.a | grep -c
invoke_register_schemas_phase` (same probe the unit Makefile uses) and
filter out `test_mysqlx_*` from the wildcard when the chassis symbol is
absent.  Under PROXYSQL40 the wildcard is unmodified and all mysqlx
tests are built as before.

Verification:

* `unset PROXYSQLGENAI && unset PROXYSQL40 && make debug -j &&
  make build_tap_test_debug -j` -> 0 errors, builds complete.
  - proxysql binary built (122 MB)
  - ProxySQL_MySQLX_Plugin.so NOT built (skipped by top-level Makefile)
  - 51 unit tests built, 0 plugin/mysqlx unit tests, 0 mysqlx tests/
    tests -> chassis is completely invisible to v3.0.
ProtocolX
Rene Cannao 1 month ago
parent b65ba99118
commit f34dc4573a

@ -139,7 +139,21 @@ tests:
@echo "Removing empty .gcno files ..."
find -L . -type f -name '*.gcno' -empty -ls -delete
tests-cpp: $(patsubst %.cpp,%,$(wildcard *-t.cpp))
# test_mysqlx_*-t.cpp reference chassis/plugin types (ProxySQL_PluginServices,
# mysqlx_config_store.h from plugins/mysqlx/include) that only exist when
# libproxysql.a was built with -DPROXYSQL40. Autodetect the flag via a
# chassis-exclusive symbol in the static lib; under !PROXYSQL40 filter
# these tests out of the wildcard glob so plain v3.0/v3.1 `make debug`
# doesn't try to compile them.
LIBPROXYSQLAR := $(PROXYSQL_LDIR)/libproxysql.a
PROXYSQL40_DETECTED := $(shell nm $(LIBPROXYSQLAR) 2>/dev/null | grep -c invoke_register_schemas_phase)
ifeq ($(PROXYSQL40_DETECTED),0)
TESTS_CPP := $(filter-out test_mysqlx_%,$(patsubst %.cpp,%,$(wildcard *-t.cpp)))
else
TESTS_CPP := $(patsubst %.cpp,%,$(wildcard *-t.cpp))
endif
tests-cpp: $(TESTS_CPP)
tests-php: $(patsubst %,php-%,$(wildcard *-t.php))
tests-py: $(patsubst %,py-%,$(wildcard *-t.py))
tests-sh: $(patsubst %,sh-%,$(wildcard *-t.sh))

Loading…
Cancel
Save