From ea65720761aa36c38b3d3cff90e7e1f20c50ac1d Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Thu, 30 Jun 2022 10:19:17 -0700 Subject: [PATCH] bazel: parallelize tests --- BUILD.bazel | 28 ++++++++++++------- ...ommand_map_test.cc => test_command_map.cc} | 0 ...mand_slot_test.cc => test_command_slot.cc} | 0 .../{command_test.cc => test_command_test.cc} | 0 ...storage_test.cc => test_object_storage.cc} | 0 ...ynamic_test.cc => test_command_dynamic.cc} | 0 6 files changed, 18 insertions(+), 10 deletions(-) rename test/rpc/{command_map_test.cc => test_command_map.cc} (100%) rename test/rpc/{command_slot_test.cc => test_command_slot.cc} (100%) rename test/rpc/{command_test.cc => test_command_test.cc} (100%) rename test/rpc/{object_storage_test.cc => test_object_storage.cc} (100%) rename test/src/{command_dynamic_test.cc => test_command_dynamic.cc} (100%) diff --git a/BUILD.bazel b/BUILD.bazel index 706a1e2d..c6dd279b 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -97,7 +97,6 @@ cc_binary( name = "rtorrent", srcs = [ "src/main.cc", - "//:included_headers", "@mimalloc", ], copts = COPTS, @@ -109,24 +108,33 @@ cc_binary( ], ) -cc_test( - name = "rtorrent_test", - srcs = glob([ - "test/**/*.cc", - ]) + [ - "@mimalloc", - "//:included_headers", - ], +cc_library( + name = "test_common", + srcs = ["test/main.cc"], copts = COPTS, includes = ["include"], linkopts = LINKOPTS, - linkstatic = True, deps = [ "//:rtorrent_common", "@com_google_googletest//:gtest", ], ) +[cc_test( + name = t.split("/")[-1][:-3], + srcs = [ + t, + "@mimalloc", + ], + copts = COPTS, + includes = ["include"], + linkopts = LINKOPTS, + tags = ["rtorrent_test"], + deps = ["//:test_common"], +) for t in glob([ + "test/**/test_*.cc", +])] + pkg_tar( name = "rtorrent-bin", srcs = ["//:rtorrent"], diff --git a/test/rpc/command_map_test.cc b/test/rpc/test_command_map.cc similarity index 100% rename from test/rpc/command_map_test.cc rename to test/rpc/test_command_map.cc diff --git a/test/rpc/command_slot_test.cc b/test/rpc/test_command_slot.cc similarity index 100% rename from test/rpc/command_slot_test.cc rename to test/rpc/test_command_slot.cc diff --git a/test/rpc/command_test.cc b/test/rpc/test_command_test.cc similarity index 100% rename from test/rpc/command_test.cc rename to test/rpc/test_command_test.cc diff --git a/test/rpc/object_storage_test.cc b/test/rpc/test_object_storage.cc similarity index 100% rename from test/rpc/object_storage_test.cc rename to test/rpc/test_object_storage.cc diff --git a/test/src/command_dynamic_test.cc b/test/src/test_command_dynamic.cc similarity index 100% rename from test/src/command_dynamic_test.cc rename to test/src/test_command_dynamic.cc