Skip to content

Commit

Permalink
Fix autotools test harness
Browse files Browse the repository at this point in the history
  • Loading branch information
mszabo-wikia committed Dec 22, 2024
1 parent efeaca4 commit c53f961
Show file tree
Hide file tree
Showing 17 changed files with 300 additions and 31 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ jobs:
run: |
mkdir -p "$(pwd)"/mcrouter-install/install
./mcrouter/scripts/install_ubuntu_24.04.sh "$(pwd)"/mcrouter-install mcrouter
- name: Test mcrouter
run: |
export INSTALL_DIR="$(pwd)"/mcrouter-install/install
export LD_LIBRARY_PATH="$INSTALL_DIR"/lib:"$LD_LIBRARY_PATH"
export LD_RUN_PATH="$INSTALL_DIR"/lib:"$LD_RUN_PATH"
export LDFLAGS="-L$INSTALL_DIR/lib $LDFLAGS"
export CPPFLAGS="-I$INSTALL_DIR/include $CPPFLAGS"
cd mcrouter
make check -s -j$(nproc)
6 changes: 6 additions & 0 deletions mcrouter/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ Makefile.in
/depcomp
/install-sh
/lib/carbon/gen-cpp2/
/lib/carbon/example/gen/gen-cpp2/
/lib/network/CaretSerializedMessage.h
/lib/network/McAsciiParser-gen.cpp
/lib/network/gen-cpp2/*
/lib/network/gen/gen-cpp2/
/lib/network/test/gen/gen-cpp2/
/lib/network/test/mock_mc_server
/lib/network/test/mock_mc_server_dual
/lib/network/test/mock_mc_thrift_server
/libtool
/m4/libtool.m4
/m4/ltoptions.m4
Expand All @@ -44,3 +49,4 @@ Makefile.in
*.o
*.a
*.la
*.lo
4 changes: 3 additions & 1 deletion mcrouter/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ AC_CHECK_FUNCS([gettimeofday \

LIBS="$LIBS $BOOST_LDFLAGS $BOOST_CONTEXT_LIB $BOOST_FILESYSTEM_LIB \
$BOOST_PROGRAM_OPTIONS_LIB $BOOST_SYSTEM_LIB $BOOST_REGEX_LIB \
$BOOST_THREAD_LIB -lpthread -pthread -ldl -lunwind \
$BOOST_THREAD_LIB -lfmt -lpthread -pthread -ldl -lunwind \
-lbz2 -llz4 -llzma -lsnappy -lzstd -latomic -lxxhash"

AM_PATH_PYTHON([2.6],, [:])
Expand All @@ -212,6 +212,7 @@ AC_CONFIG_FILES([Makefile
lib/Makefile
lib/test/Makefile
lib/carbon/Makefile
lib/carbon/example/gen/Makefile
lib/config/Makefile
lib/config/test/Makefile
lib/fbi/Makefile
Expand All @@ -220,6 +221,7 @@ AC_CONFIG_FILES([Makefile
lib/fbi/cpp/test/Makefile
lib/network/gen/Makefile
lib/network/test/Makefile
lib/network/test/gen/Makefile
routes/Makefile
routes/test/Makefile
test/Makefile
Expand Down
24 changes: 23 additions & 1 deletion mcrouter/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

SUBDIRS = carbon network/gen . config fbi network/test test
SUBDIRS = carbon network/gen carbon/example/gen . config fbi network/test test

noinst_LIBRARIES = libmcrouter.a

Expand All @@ -21,9 +21,13 @@ libmcrouter_a_SOURCES = \
CompressionCodecManager.cpp \
CompressionCodecManager.h \
Crc32HashFunc.h \
DynamicUtil.h \
DynamicUtil.cpp \
FailoverErrorsSettingsBase.cpp \
FailoverErrorsSettingsBase.h \
FailoverErrorsSettings.h \
FiberLocal.h \
FiberLocalInternal.cpp \
HashUtil.h \
IOBufUtil.cpp \
IOBufUtil.h \
Expand Down Expand Up @@ -87,16 +91,26 @@ libmcrouter_a_SOURCES = \
carbon/TypeList.h \
carbon/Util.h \
carbon/Variant.h \
carbon/connection/CarbonConnectionUtil.h \
carbon/connection/ExternalCarbonConnectionImpl.cpp \
carbon/connection/ExternalCarbonConnectionImpl.h \
carbon/connection/ExternalCarbonConnectionImpl-inl.h \
carbon/connection/InternalCarbonConnectionImpl.h \
carbon/connection/PooledCarbonConnectionImpl.h \
carbon/gen-cpp2/carbon_result_types.cpp \
carbon/gen-cpp2/carbon_result_types.h \
carbon/gen-cpp2/carbon_result_types.tcc \
carbon/gen-cpp2/carbon_result_data.cpp \
carbon/gen-cpp2/carbon_result_data.h \
carbon/gen-cpp2/carbon_result_metadata.cpp \
carbon/gen-cpp2/carbon_result_metadata.h \
carbon/gen-cpp2/carbon_types.cpp \
carbon/gen-cpp2/carbon_types.h \
carbon/gen-cpp2/carbon_types.tcc \
carbon/gen-cpp2/carbon_data.cpp \
carbon/gen-cpp2/carbon_data.h \
carbon/gen-cpp2/carbon_metadata.cpp \
carbon/gen-cpp2/carbon_metadata.h \
config/ConfigPreprocessor.cpp \
config/ConfigPreprocessor.h \
config/ImportResolverIf.h \
Expand Down Expand Up @@ -191,20 +205,28 @@ libmcrouter_a_SOURCES = \
network/gen/gen-cpp2/Common_types.tcc \
network/gen/gen-cpp2/Common_data.cpp \
network/gen/gen-cpp2/Common_data.h \
network/gen/gen-cpp2/Common_metadata.cpp \
network/gen/gen-cpp2/Common_metadata.h \
network/gen/gen-cpp2/Memcache.cpp \
network/gen/gen-cpp2/Memcache.h \
network/gen/gen-cpp2/MemcacheAsyncClient.cpp \
network/gen/gen-cpp2/MemcacheAsyncClient.h \
network/gen/gen-cpp2/MemcacheService_constants.cpp \
network/gen/gen-cpp2/MemcacheService_constants.h \
network/gen/gen-cpp2/MemcacheService_types.cpp \
network/gen/gen-cpp2/MemcacheService_types.h \
network/gen/gen-cpp2/MemcacheService_types.tcc \
network/gen/gen-cpp2/MemcacheService_metadata.cpp \
network/gen/gen-cpp2/MemcacheService_metadata.h \
network/gen/gen-cpp2/MemcacheService_data.cpp \
network/gen/gen-cpp2/MemcacheService_data.h \
network/gen/gen-cpp2/Memcache_types.cpp \
network/gen/gen-cpp2/Memcache_types.h \
network/gen/gen-cpp2/Memcache_types.tcc \
network/gen/gen-cpp2/Memcache_data.cpp \
network/gen/gen-cpp2/Memcache_data.h \
network/gen/gen-cpp2/Memcache_metadata.cpp \
network/gen/gen-cpp2/Memcache_metadata.h \
network/FizzContextProvider.cpp \
network/FizzContextProvider.h \
network/McAsciiParser-gen.cpp \
Expand Down
22 changes: 22 additions & 0 deletions mcrouter/lib/TestMain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#include <gtest/gtest.h>

#include <folly/init/Init.h>

/**
* Main entry point shared by several test suites
* in the mcrouter OSS build.
*/
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
folly::Init init(
&argc, &argv, folly::InitOptions{}.removeFlags(false).useGFlags(false));

return RUN_ALL_TESTS();
}
8 changes: 6 additions & 2 deletions mcrouter/lib/carbon/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ BUILT_SOURCES = \

gen-cpp2/carbon_result_types.cpp: gen-cpp2/carbon_result_types.h
gen-cpp2/carbon_result_types.h: gen-cpp2/carbon_result_types.tcc
gen-cpp2/carbon_result_types.tcc: gen-cpp2/carbon_result_data.cpp
gen-cpp2/carbon_result_types.tcc: gen-cpp2/carbon_result_metadata.cpp
gen-cpp2/carbon_result_metadata.cpp: gen-cpp2/carbon_result_metadata.h
gen-cpp2/carbon_result_metadata.h: gen-cpp2/carbon_result_data.cpp
gen-cpp2/carbon_result_data.cpp: gen-cpp2/carbon_result_data.h
gen-cpp2/carbon_result_data.h: carbon_result.thrift
@FBTHRIFT@ -gen mstch_cpp2:stack_arguments,sync_methods_return_try,include_prefix=mcrouter/lib/carbon/ carbon_result.thrift

gen-cpp2/carbon_types.cpp: gen-cpp2/carbon_types.h
gen-cpp2/carbon_types.h: gen-cpp2/carbon_types.tcc
gen-cpp2/carbon_types.tcc: gen-cpp2/carbon_data.cpp
gen-cpp2/carbon_types.tcc: gen-cpp2/carbon_metadata.cpp
gen-cpp2/carbon_metadata.cpp: gen-cpp2/carbon_metadata.h
gen-cpp2/carbon_metadata.h: gen-cpp2/carbon_data.cpp
gen-cpp2/carbon_data.cpp: gen-cpp2/carbon_data.h
gen-cpp2/carbon_data.h: carbon.thrift
@FBTHRIFT@ -gen mstch_cpp2:stack_arguments,sync_methods_return_try,include_prefix=mcrouter/lib/carbon/ -I $(INSTALL_DIR)/include/ carbon.thrift
25 changes: 25 additions & 0 deletions mcrouter/lib/carbon/example/gen/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
noinst_LIBRARIES = libcarbon_hello_goodbye.a

thrift_sources = \
gen-cpp2/HelloGoodbye_types.cpp \
gen-cpp2/HelloGoodbye_types.h \
gen-cpp2/HelloGoodbye_types.tcc \
gen-cpp2/HelloGoodbye_data.cpp \
gen-cpp2/HelloGoodbye_data.h

BUILT_SOURCES = $(thrift_sources)

gen-cpp2/HelloGoodbye_types.cpp: gen-cpp2/HelloGoodbye_types.h $(top_srcdir)/lib/network/gen/gen-cpp2/Common_types.h
gen-cpp2/HelloGoodbye_types.h: gen-cpp2/HelloGoodbye_types.tcc
gen-cpp2/HelloGoodbye_types.tcc: gen-cpp2/HelloGoodbye_data.cpp
gen-cpp2/HelloGoodbye_data.cpp: gen-cpp2/HelloGoodbye_data.h
gen-cpp2/HelloGoodbye_data.h: HelloGoodbye.thrift
@FBTHRIFT@ -gen mstch_cpp2:stack_arguments,sync_methods_return_try,deprecated_terse_writes,include_prefix=mcrouter/lib/carbon/example/gen/ -I $(top_srcdir)/.. -I $(INSTALL_DIR)/include/ HelloGoodbye.thrift

libcarbon_hello_goodbye_a_SOURCES = \
$(thrift_sources) \
HelloGoodbyeMessages.h \
HelloGoodbyeMessages-inl.h \
HelloGoodbyeMessagesThrift.cpp

libcarbon_hello_goodbye_a_CPPFLAGS = -I$(top_srcdir)/..
4 changes: 3 additions & 1 deletion mcrouter/lib/fbi/cpp/test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
check_PROGRAMS = mcrouter_fbi_cpp_test

mcrouter_fbi_cpp_test_SOURCES = \
main.cpp
main.cpp \
LowerBoundPrefixMapTest.cpp \
ObjectPoolTests.cpp

mcrouter_fbi_cpp_test_CPPFLAGS = \
-I$(top_srcdir)/.. \
Expand Down
16 changes: 13 additions & 3 deletions mcrouter/lib/network/gen/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ BUILT_SOURCES = \
gen-cpp2/Memcache_types.tcc \
gen-cpp2/Memcache_data.cpp \
gen-cpp2/Memcache_data.h \
gen-cpp2/Memcache.cpp \
gen-cpp2/Memcache.h \
gen-cpp2/MemcacheAsyncClient.cpp \
gen-cpp2/MemcacheAsyncClient.h \
gen-cpp2/MemcacheService_constants.cpp \
Expand All @@ -26,25 +28,33 @@ BUILT_SOURCES = \

gen-cpp2/Common_types.cpp: gen-cpp2/Common_types.h
gen-cpp2/Common_types.h: gen-cpp2/Common_types.tcc
gen-cpp2/Common_types.tcc: gen-cpp2/Common_data.cpp
gen-cpp2/Common_types.tcc: gen-cpp2/Common_metadata.cpp
gen-cpp2/Common_metadata.cpp: gen-cpp2/Common_metadata.h
gen-cpp2/Common_metadata.h: gen-cpp2/Common_data.cpp
gen-cpp2/Common_data.cpp: gen-cpp2/Common_data.h
gen-cpp2/Common_data.h: Common.thrift
@FBTHRIFT@ -gen mstch_cpp2:stack_arguments,sync_methods_return_try,deprecated_terse_writes,include_prefix=mcrouter/lib/network/gen -I $(top_srcdir)/.. -I $(INSTALL_DIR)/include/ Common.thrift

gen-cpp2/Memcache_types.cpp: gen-cpp2/Memcache_types.h
gen-cpp2/Memcache_types.h: gen-cpp2/Memcache_types.tcc
gen-cpp2/Memcache_types.tcc: gen-cpp2/Memcache_data.cpp
gen-cpp2/Memcache_types.tcc: gen-cpp2/Memcache_metadata.cpp
gen-cpp2/Memcache_metadata.cpp: gen-cpp2/Memcache_metadata.h
gen-cpp2/Memcache_metadata.h: gen-cpp2/Memcache_data.cpp
gen-cpp2/Memcache_data.cpp: gen-cpp2/Memcache_data.h
gen-cpp2/Memcache_data.h: Memcache.thrift
@FBTHRIFT@ -gen mstch_cpp2:stack_arguments,sync_methods_return_try,deprecated_terse_writes,include_prefix=mcrouter/lib/network/gen -I $(top_srcdir)/.. -I $(INSTALL_DIR)/include/ Memcache.thrift

gen-cpp2/Memcache.cpp: gen-cpp2/Memcache.h
gen-cpp2/Memcache.h: gen-cpp2/MemcacheAsyncClient.cpp
gen-cpp2/MemcacheAsyncClient.cpp: gen-cpp2/MemcacheAsyncClient.h
gen-cpp2/MemcacheAsyncClient.h: gen-cpp2/MemcacheService_constants.cpp
gen-cpp2/MemcacheService_constants.cpp: gen-cpp2/MemcacheService_constants.h
gen-cpp2/MemcacheService_constants.h: gen-cpp2/MemcacheService_types.cpp
gen-cpp2/MemcacheService_types.cpp: gen-cpp2/MemcacheService_types.h
gen-cpp2/MemcacheService_types.h: gen-cpp2/MemcacheService_types.tcc
gen-cpp2/MemcacheService_types.tcc: gen-cpp2/MemcacheService_data.cpp
gen-cpp2/MemcacheService_types.tcc: gen-cpp2/MemcacheService_metadata.cpp
gen-cpp2/MemcacheService_metadata.cpp: gen-cpp2/MemcacheService_metadata.h
gen-cpp2/MemcacheService_metadata.h: gen-cpp2/MemcacheService_data.cpp
gen-cpp2/MemcacheService_data.cpp: gen-cpp2/MemcacheService_data.h
gen-cpp2/MemcacheService_data.h: MemcacheService.thrift
@FBTHRIFT@ -gen mstch_cpp2:stack_arguments,sync_methods_return_try,deprecated_terse_writes,include_prefix=mcrouter/lib/network/gen -I $(top_srcdir)/.. -I $(INSTALL_DIR)/include/ MemcacheService.thrift
44 changes: 40 additions & 4 deletions mcrouter/lib/network/test/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

noinst_PROGRAMS = mock_mc_server
SUBDIRS = gen

noinst_PROGRAMS = mock_mc_server mock_mc_thrift_server mock_mc_server_dual
noinst_LIBRARIES = libtest_util.a
check_PROGRAMS = mcrouter_network_test

Expand Down Expand Up @@ -44,11 +46,17 @@ mock_mc_thrift_server_CPPFLAGS = -I$(top_srcdir)/..
mock_mc_thrift_server_LDADD = \
$(top_builddir)/lib/libmcrouter.a \
-lthriftcpp2 \
-lserverdbginfo \
-ltransport \
-lthriftanyrep \
-lthrifttype \
-lthrifttyperep \
-lthriftprotocol \
-lrpcmetadata \
-lthriftmetadata \
-lasync \
-lconcurrency \
-lruntime \
-lthrift-core \
-lfmt \
-lfizz \
Expand All @@ -65,11 +73,17 @@ mock_mc_server_dual_CPPFLAGS = -I$(top_srcdir)/..
mock_mc_server_dual_LDADD = \
$(top_builddir)/lib/libmcrouter.a \
-lthriftcpp2 \
-lserverdbginfo \
-ltransport \
-lthriftanyrep \
-lthrifttype \
-lthrifttyperep \
-lthriftprotocol \
-lrpcmetadata \
-lthriftmetadata \
-lasync \
-lconcurrency \
-lruntime \
-lthrift-core \
-lfmt \
-lfizz \
Expand All @@ -86,15 +100,25 @@ libtest_util_a_CPPFLAGS = -I$(top_srcdir)/..
mcrouter_network_test_SOURCES = \
AccessPointTest.cpp \
AsyncMcClientTestSync.cpp \
AsyncMcServerShutdownTest.cpp \
AsyncMcServerTest.cpp \
CarbonMessageDispatcherTest.cpp \
CarbonMockMcTest.cpp \
CarbonQueueAppenderTest.cpp \
gen/gen-cpp2/CarbonTest_types.cpp \
gen/gen-cpp2/CarbonTest_types.h \
gen/gen-cpp2/CarbonTest_types.tcc \
gen/gen-cpp2/CarbonTest_data.cpp \
gen/gen-cpp2/CarbonTest_data.h \
gen/CarbonTestMessages.cpp \
gen/CarbonTestMessagesThrift.cpp \
McAsciiParserTest.cpp \
McParserTest.cpp \
McServerAsciiParserTest.cpp \
MemcacheConnectionTest.cpp \
MemcacheTest.cpp \
RequestExpiryTest.cpp \
MockMc.cpp \
MockMcServer.cpp \
SessionTest.cpp \
SessionTestHarness.cpp \
SessionTestHarness.h \
Expand All @@ -108,13 +132,25 @@ mcrouter_network_test_CPPFLAGS = \
-isystem $(top_srcdir)/lib/gtest/include

mcrouter_network_test_LDADD = \
$(top_builddir)/libmcroutercore.a \
$(top_builddir)/lib/libmcrouter.a \
$(top_builddir)/lib/carbon/example/gen/libcarbon_hello_goodbye.a \
$(top_builddir)/lib/libtestmain.la \
$(top_builddir)/lib/network/libtest_util.a \
$(top_builddir)/lib/network/test/libtest_util.a \
-lthriftcpp2 \
-lserverdbginfo \
-ltransport \
-lthriftanyrep \
-lthrifttype \
-lthrifttyperep \
-lthriftprotocol \
-lrpcmetadata \
-ltransport \
-lthriftannotation \
-lthriftmetadata \
-lasync \
-lconcurrency \
-lruntime \
-lthrift-core \
-lwangle \
-lfizz \
-lsodium \
Expand Down
13 changes: 13 additions & 0 deletions mcrouter/lib/network/test/gen/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BUILT_SOURCES = \
gen-cpp2/CarbonTest_types.cpp \
gen-cpp2/CarbonTest_types.h \
gen-cpp2/CarbonTest_types.tcc \
gen-cpp2/CarbonTest_data.cpp \
gen-cpp2/CarbonTest_data.h

gen-cpp2/CarbonTest_types.cpp: gen-cpp2/CarbonTest_types.h
gen-cpp2/CarbonTest_types.h: gen-cpp2/CarbonTest_types.tcc
gen-cpp2/CarbonTest_types.tcc: gen-cpp2/CarbonTest_data.cpp
gen-cpp2/CarbonTest_data.cpp: gen-cpp2/CarbonTest_data.h
gen-cpp2/CarbonTest_data.h: CarbonTest.thrift
@FBTHRIFT@ -gen mstch_cpp2:stack_arguments,sync_methods_return_try,deprecated_terse_writes,include_prefix=mcrouter/lib/network/test/gen/ -I $(top_srcdir)/.. -I $(INSTALL_DIR)/include/ CarbonTest.thrift
Loading

0 comments on commit c53f961

Please sign in to comment.