You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2019/07/19 22:01:43 UTC

[impala] branch master updated: IMPALA-8176: Convert simple backend tests to the unified executable

This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/master by this push:
     new 4cc3ff9  IMPALA-8176: Convert simple backend tests to the unified executable
4cc3ff9 is described below

commit 4cc3ff9c6763de10236df351a47324d662766de3
Author: Joe McDonnell <jo...@cloudera.com>
AuthorDate: Fri Feb 22 12:48:19 2019 -0800

    IMPALA-8176: Convert simple backend tests to the unified executable
    
    This converts tests with trivial main() functions to the unified
    executable. This means that the code change is strictly removing
    main() functions and updating the CMakeLists.txt files. Any test
    that requires a change larger than that will be addressed
    separately. The only exceptions are:
     - exec/incr-stats-util-test.cc requires naming changes to avoid
       conflicts with util/rle-test.cc
     - runtime/decimal-test.cc simplified the naming to make the
       CMakeLists.txt arguments easier.
    
    The new test libraries are marked STATIC, because they are linked
    into a single binary (unifiedbetests) and googletest has problems
    with tests in shared libraries.
    
    Converting this set of tests saves about 18GB of disk
    space for a debug build and saves a minute or two of link time.
    
    For any CMakeLists.txt that has unified tests, this adds a comment
    for each test that is not unified.
    
    Testing:
     - Ran backend tests in DEBUG and ASAN modes on Centos7
     - Ran backend tests in DEBUG mode on Centos6
    
    Change-Id: I840d0f9b70edb3a7195a2a33b21fd2874d4c52bd
    Reviewed-on: http://gerrit.cloudera.org:8080/13515
    Reviewed-by: Tim Armstrong <ta...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 be/CMakeLists.txt                                | 12 +++++
 be/src/catalog/CMakeLists.txt                    |  7 ++-
 be/src/catalog/catalog-util-test.cc              |  2 -
 be/src/codegen/CMakeLists.txt                    |  9 +++-
 be/src/codegen/instruction-counter-test.cc       |  3 --
 be/src/common/CMakeLists.txt                     | 13 ++++--
 be/src/common/atomic-test.cc                     |  2 -
 be/src/common/thread-debug-info-test.cc          |  2 -
 be/src/exec/CMakeLists.txt                       | 23 +++++++---
 be/src/exec/delimited-text-parser-test.cc        |  1 -
 be/src/exec/hash-table-test.cc                   |  7 ---
 be/src/exec/hdfs-avro-scanner-test.cc            |  2 -
 be/src/exec/incr-stats-util-test.cc              |  8 ++--
 be/src/exec/parquet/CMakeLists.txt               | 23 +++++++---
 be/src/exec/parquet/hdfs-parquet-scanner-test.cc |  7 ---
 be/src/exec/parquet/parquet-bool-decoder-test.cc |  1 -
 be/src/exec/parquet/parquet-common-test.cc       |  2 -
 be/src/exec/parquet/parquet-page-index-test.cc   |  2 -
 be/src/exec/parquet/parquet-plain-test.cc        |  1 -
 be/src/exec/parquet/parquet-version-test.cc      |  1 -
 be/src/exec/read-write-util-test.cc              |  1 -
 be/src/exec/zigzag-test.cc                       |  1 -
 be/src/exprs/CMakeLists.txt                      | 12 ++++-
 be/src/exprs/expr-test.cc                        |  6 ---
 be/src/exprs/timezone_db-test.cc                 |  2 -
 be/src/gutil/CMakeLists.txt                      |  2 +-
 be/src/rpc/CMakeLists.txt                        | 11 ++++-
 be/src/rpc/thrift-util-test.cc                   |  2 -
 be/src/runtime/CMakeLists.txt                    | 58 +++++++++++++++++-------
 be/src/runtime/bufferpool/CMakeLists.txt         | 13 +++++-
 be/src/runtime/bufferpool/free-list-test.cc      |  7 ---
 be/src/runtime/bufferpool/suballocator-test.cc   |  7 ---
 be/src/runtime/date-test.cc                      |  2 -
 be/src/runtime/decimal-test.cc                   | 21 ++++-----
 be/src/runtime/free-pool-test.cc                 |  1 -
 be/src/runtime/hdfs-fs-cache-test.cc             |  1 -
 be/src/runtime/io/CMakeLists.txt                 | 10 +++-
 be/src/runtime/io/disk-io-mgr-test.cc            |  7 ---
 be/src/runtime/mem-pool-test.cc                  |  1 -
 be/src/runtime/mem-tracker-test.cc               |  1 -
 be/src/runtime/multi-precision-test.cc           |  1 -
 be/src/runtime/raw-value-test.cc                 |  1 -
 be/src/runtime/row-batch-serialize-test.cc       | 10 ----
 be/src/runtime/string-buffer-test.cc             |  2 -
 be/src/runtime/string-compare-test.cc            |  1 -
 be/src/runtime/string-search-test.cc             |  5 --
 be/src/runtime/string-value-test.cc              |  1 -
 be/src/runtime/thread-resource-mgr-test.cc       |  1 -
 be/src/runtime/timestamp-test.cc                 |  1 -
 be/src/runtime/tmp-file-mgr-test.cc              |  7 ---
 be/src/scheduling/CMakeLists.txt                 | 19 ++++++--
 be/src/scheduling/admission-controller-test.cc   |  6 ---
 be/src/scheduling/cluster-membership-mgr-test.cc |  2 -
 be/src/scheduling/executor-group-test.cc         |  2 -
 be/src/scheduling/hash-ring-test.cc              |  2 -
 be/src/scheduling/scheduler-test.cc              |  2 -
 be/src/service/CMakeLists.txt                    | 14 ++++--
 be/src/service/hs2-util-test.cc                  |  2 -
 be/src/service/impala-server-test.cc             |  2 -
 be/src/service/query-options-test.cc             |  1 -
 be/src/util/CMakeLists.txt                       |  2 +-
 61 files changed, 190 insertions(+), 188 deletions(-)

diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt
index 682f341..81151b6 100644
--- a/be/CMakeLists.txt
+++ b/be/CMakeLists.txt
@@ -440,7 +440,19 @@ set (IMPALA_LINK_LIBS
 set(WL_WHOLE_ARCHIVE "-Wl,--whole-archive")
 set(WL_NO_WHOLE_ARCHIVE "-Wl,--no-whole-archive")
 set (UNIFIED_TEST_LIBS
+  BufferPoolTests
+  CatalogTests
+  CodeGenTests
+  CommonTests
+  ExecTests
+  ExprsTests
   GUtilTests
+  IoTests
+  ParquetTests
+  RpcTests
+  RuntimeTests
+  SchedulingTests
+  ServiceTests
   UtilTests
 )
 set (UNIFIED_TEST_LINK_LIBS
diff --git a/be/src/catalog/CMakeLists.txt b/be/src/catalog/CMakeLists.txt
index ba8d97c..89fd96d 100644
--- a/be/src/catalog/CMakeLists.txt
+++ b/be/src/catalog/CMakeLists.txt
@@ -26,4 +26,9 @@ add_library(Catalog
 )
 add_dependencies(Catalog gen-deps)
 
-ADD_BE_LSAN_TEST(catalog-util-test)
+add_library(CatalogTests STATIC
+  catalog-util-test.cc
+)
+add_dependencies(CatalogTests gen-deps)
+
+ADD_UNIFIED_BE_LSAN_TEST(catalog-util-test CatalogUtil.*)
diff --git a/be/src/catalog/catalog-util-test.cc b/be/src/catalog/catalog-util-test.cc
index 91466f5..4c340df 100644
--- a/be/src/catalog/catalog-util-test.cc
+++ b/be/src/catalog/catalog-util-test.cc
@@ -133,5 +133,3 @@ TEST(CatalogUtil, TestTPrivilegeFromObjectName) {
       &privilege), TErrorCode::GENERAL);
 }
 
-IMPALA_TEST_MAIN();
-
diff --git a/be/src/codegen/CMakeLists.txt b/be/src/codegen/CMakeLists.txt
index 2709fcb..0cf5ff5 100644
--- a/be/src/codegen/CMakeLists.txt
+++ b/be/src/codegen/CMakeLists.txt
@@ -38,6 +38,11 @@ add_library(CodeGen
 )
 add_dependencies(CodeGen gen-deps gen_ir_descriptions)
 
+add_library(CodeGenTests STATIC
+  instruction-counter-test.cc
+)
+add_dependencies(CodeGenTests gen-deps)
+
 # output cross compile to ir metadata
 set(IR_DESC_GEN_OUTPUT
   $ENV{IMPALA_HOME}/be/generated-sources/impala-ir/impala-ir-names.h
@@ -107,6 +112,8 @@ add_custom_target(test-loop.bc
   SOURCES ${CMAKE_SOURCE_DIR}/testdata/llvm/test-loop.cc
 )
 
+# Exception to unified be tests: custom main initializes LLVM
 ADD_BE_LSAN_TEST(llvm-codegen-test)
 add_dependencies(llvm-codegen-test test-loop.bc)
-ADD_BE_LSAN_TEST(instruction-counter-test)
+
+ADD_UNIFIED_BE_LSAN_TEST(instruction-counter-test InstructionCounterTest.*)
diff --git a/be/src/codegen/instruction-counter-test.cc b/be/src/codegen/instruction-counter-test.cc
index 5dbc605..d801c2d 100644
--- a/be/src/codegen/instruction-counter-test.cc
+++ b/be/src/codegen/instruction-counter-test.cc
@@ -174,6 +174,3 @@ TEST_F(InstructionCounterTest, TestMemInstrCount) {
 }
 
 }  // namespace impala
-
-IMPALA_TEST_MAIN();
-
diff --git a/be/src/common/CMakeLists.txt b/be/src/common/CMakeLists.txt
index 2ea3b0c..d2f30d1 100644
--- a/be/src/common/CMakeLists.txt
+++ b/be/src/common/CMakeLists.txt
@@ -35,6 +35,13 @@ add_library(Common
   thread-debug-info.cc
   ${VERSION_CC_GEN_OUTPUT}
 )
+add_dependencies(Common gen-deps)
+
+add_library(CommonTests STATIC
+  atomic-test.cc
+  thread-debug-info-test.cc
+)
+add_dependencies(CommonTests gen-deps)
 
 # Command to generate the build version file if not present. We don't automatically
 # regenerate the file if present, which speeds up incremental builds but can lead
@@ -46,15 +53,13 @@ add_custom_command(
   VERBATIM
 )
 
-add_dependencies(Common gen-deps)
-
 add_library(GlobalFlags
   global-flags.cc
 )
 add_dependencies(GlobalFlags gen-deps)
 
-ADD_BE_LSAN_TEST(atomic-test)
-ADD_BE_LSAN_TEST(thread-debug-info-test)
+ADD_UNIFIED_BE_LSAN_TEST(atomic-test AtomicTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(thread-debug-info-test ThreadDebugInfo.*)
 
 # Generate config.h from config.h.in, filling in variables from CMake
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
diff --git a/be/src/common/atomic-test.cc b/be/src/common/atomic-test.cc
index dc35396..3ce476b 100644
--- a/be/src/common/atomic-test.cc
+++ b/be/src/common/atomic-test.cc
@@ -251,5 +251,3 @@ TEST(AtomicTest, MultipleTreadsAcquireReleaseLoadStoreInt64) {
 }
 
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/common/thread-debug-info-test.cc b/be/src/common/thread-debug-info-test.cc
index 616aa0a..7b1ee52 100644
--- a/be/src/common/thread-debug-info-test.cc
+++ b/be/src/common/thread-debug-info-test.cc
@@ -142,5 +142,3 @@ TEST(ThreadDebugInfo, Scoping) {
 }
 
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/exec/CMakeLists.txt b/be/src/exec/CMakeLists.txt
index 64af4ef..e7d2caa 100644
--- a/be/src/exec/CMakeLists.txt
+++ b/be/src/exec/CMakeLists.txt
@@ -105,10 +105,21 @@ add_library(Exec
 
 add_dependencies(Exec gen-deps)
 
-ADD_BE_LSAN_TEST(zigzag-test)
-ADD_BE_LSAN_TEST(hash-table-test)
-ADD_BE_LSAN_TEST(delimited-text-parser-test)
-ADD_BE_LSAN_TEST(read-write-util-test)
+add_library(ExecTests STATIC
+  delimited-text-parser-test.cc
+  hash-table-test.cc
+  hdfs-avro-scanner-test.cc
+  incr-stats-util-test.cc
+  read-write-util-test.cc
+  zigzag-test.cc
+)
+add_dependencies(ExecTests gen-deps)
+
+ADD_UNIFIED_BE_LSAN_TEST(zigzag-test ZigzagTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(hash-table-test HashTableTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(delimited-text-parser-test DelimitedTextParser.*)
+ADD_UNIFIED_BE_LSAN_TEST(read-write-util-test ReadWriteUtil.*)
+# Exception to unified be tests: Custom main with global Frontend object
 ADD_BE_LSAN_TEST(row-batch-list-test)
-ADD_BE_LSAN_TEST(incr-stats-util-test)
-ADD_BE_LSAN_TEST(hdfs-avro-scanner-test)
+ADD_UNIFIED_BE_LSAN_TEST(incr-stats-util-test IncrStatsUtilTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(hdfs-avro-scanner-test HdfsAvroScannerTest.*)
diff --git a/be/src/exec/delimited-text-parser-test.cc b/be/src/exec/delimited-text-parser-test.cc
index 6c5ae4b..3236c9c 100644
--- a/be/src/exec/delimited-text-parser-test.cc
+++ b/be/src/exec/delimited-text-parser-test.cc
@@ -221,4 +221,3 @@ TEST(DelimitedTextParser, SpecialDelimiters) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/exec/hash-table-test.cc b/be/src/exec/hash-table-test.cc
index 7293df7..1a98804 100644
--- a/be/src/exec/hash-table-test.cc
+++ b/be/src/exec/hash-table-test.cc
@@ -741,10 +741,3 @@ TEST_F(HashTableTest, VeryLowMemTest) {
 }
 
 }
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
-  impala::InitFeSupport();
-  return RUN_ALL_TESTS();
-}
diff --git a/be/src/exec/hdfs-avro-scanner-test.cc b/be/src/exec/hdfs-avro-scanner-test.cc
index 9358de4..def42e4 100644
--- a/be/src/exec/hdfs-avro-scanner-test.cc
+++ b/be/src/exec/hdfs-avro-scanner-test.cc
@@ -457,5 +457,3 @@ TEST_F(HdfsAvroScannerTest, DecimalTest) {
 }
 
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/exec/incr-stats-util-test.cc b/be/src/exec/incr-stats-util-test.cc
index cf5e725..0410f1e 100644
--- a/be/src/exec/incr-stats-util-test.cc
+++ b/be/src/exec/incr-stats-util-test.cc
@@ -32,7 +32,7 @@ extern string DecodeNdv(const string& ndv, bool is_encoded);
 
 static const int HLL_LEN = pow(2, AggregateFunctions::HLL_PRECISION);
 
-TEST(RleTest, TestEmptyRle) {
+TEST(IncrStatsUtilTest, TestEmptyRle) {
   string test(HLL_LEN, 0);
 
   bool is_encoded;
@@ -45,7 +45,7 @@ TEST(RleTest, TestEmptyRle) {
   ASSERT_EQ(test, decoded);
 }
 
-TEST(RleTest, TestNoEncode) {
+TEST(IncrStatsUtilTest, TestNoEncode) {
   string test;
   for (int i = 0; i < HLL_LEN; ++i) {
     test += (i % 2 == 0) ? 'A' : 'B';
@@ -59,7 +59,7 @@ TEST(RleTest, TestNoEncode) {
   ASSERT_EQ(DecodeNdv(encoded, is_encoded), test);
 }
 
-TEST(RleTest, TestEncode) {
+TEST(IncrStatsUtilTest, TestEncode) {
   string test;
   for (int i = 0; i < HLL_LEN; ++i) {
     test += (i < 512) ? 'A' : 'B';
@@ -72,5 +72,3 @@ TEST(RleTest, TestEncode) {
   ASSERT_EQ(DecodeNdv(encoded, is_encoded), test);
 }
 
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/exec/parquet/CMakeLists.txt b/be/src/exec/parquet/CMakeLists.txt
index 8d11780..ec33f93 100644
--- a/be/src/exec/parquet/CMakeLists.txt
+++ b/be/src/exec/parquet/CMakeLists.txt
@@ -39,9 +39,20 @@ add_library(Parquet
 
 add_dependencies(Parquet gen-deps)
 
-ADD_BE_LSAN_TEST(parquet-bool-decoder-test)
-ADD_BE_LSAN_TEST(parquet-common-test)
-ADD_BE_LSAN_TEST(parquet-page-index-test)
-ADD_BE_LSAN_TEST(parquet-plain-test)
-ADD_BE_LSAN_TEST(parquet-version-test)
-ADD_BE_LSAN_TEST(hdfs-parquet-scanner-test)
+add_library(ParquetTests STATIC
+  hdfs-parquet-scanner-test.cc
+  parquet-bool-decoder-test.cc
+  parquet-common-test.cc
+  parquet-page-index-test.cc
+  parquet-plain-test.cc
+  parquet-version-test.cc
+)
+add_dependencies(ParquetTests gen-deps)
+
+ADD_UNIFIED_BE_LSAN_TEST(parquet-bool-decoder-test ParquetBoolDecoder.*)
+ADD_UNIFIED_BE_LSAN_TEST(parquet-common-test ParquetCommon.*)
+ADD_UNIFIED_BE_LSAN_TEST(parquet-page-index-test ParquetPageIndex.*)
+ADD_UNIFIED_BE_LSAN_TEST(parquet-plain-test PlainEncoding.*)
+ADD_UNIFIED_BE_LSAN_TEST(parquet-version-test ParquetVersionTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(hdfs-parquet-scanner-test HdfsParquetScannerTest.*)
+
diff --git a/be/src/exec/parquet/hdfs-parquet-scanner-test.cc b/be/src/exec/parquet/hdfs-parquet-scanner-test.cc
index f57a12d..5b55732 100644
--- a/be/src/exec/parquet/hdfs-parquet-scanner-test.cc
+++ b/be/src/exec/parquet/hdfs-parquet-scanner-test.cc
@@ -168,10 +168,3 @@ TEST_F(HdfsParquetScannerTest, DivideReservation) {
 }
 
 }
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
-  impala::InitFeSupport();
-  return RUN_ALL_TESTS();
-}
diff --git a/be/src/exec/parquet/parquet-bool-decoder-test.cc b/be/src/exec/parquet/parquet-bool-decoder-test.cc
index 309c982..ded6c24 100644
--- a/be/src/exec/parquet/parquet-bool-decoder-test.cc
+++ b/be/src/exec/parquet/parquet-bool-decoder-test.cc
@@ -105,4 +105,3 @@ TEST(ParquetBoolDecoder, TestDecodeAndSkipping) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/exec/parquet/parquet-common-test.cc b/be/src/exec/parquet/parquet-common-test.cc
index 8605845..b67603a 100644
--- a/be/src/exec/parquet/parquet-common-test.cc
+++ b/be/src/exec/parquet/parquet-common-test.cc
@@ -118,5 +118,3 @@ TEST(ParquetCommon, ComputeCandidatePages) {
 }
 
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/exec/parquet/parquet-page-index-test.cc b/be/src/exec/parquet/parquet-page-index-test.cc
index 19656b5..4a4966c 100644
--- a/be/src/exec/parquet/parquet-page-index-test.cc
+++ b/be/src/exec/parquet/parquet-page-index-test.cc
@@ -104,5 +104,3 @@ TEST(ParquetPageIndex, DeterminePageIndexRangesInRowGroup) {
 }
 
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/exec/parquet/parquet-plain-test.cc b/be/src/exec/parquet/parquet-plain-test.cc
index 9fbe540..b302f30 100644
--- a/be/src/exec/parquet/parquet-plain-test.cc
+++ b/be/src/exec/parquet/parquet-plain-test.cc
@@ -488,4 +488,3 @@ TEST(PlainEncoding, CorruptString) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/exec/parquet/parquet-version-test.cc b/be/src/exec/parquet/parquet-version-test.cc
index 5eaa692..28a2d71 100644
--- a/be/src/exec/parquet/parquet-version-test.cc
+++ b/be/src/exec/parquet/parquet-version-test.cc
@@ -80,5 +80,4 @@ TEST(ParquetVersionTest, Comparisons) {
 
 }
 
-IMPALA_TEST_MAIN();
 
diff --git a/be/src/exec/read-write-util-test.cc b/be/src/exec/read-write-util-test.cc
index 453a333..a044886 100644
--- a/be/src/exec/read-write-util-test.cc
+++ b/be/src/exec/read-write-util-test.cc
@@ -122,4 +122,3 @@ TEST(ReadWriteUtil, ZeroCompressedLong) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/exec/zigzag-test.cc b/be/src/exec/zigzag-test.cc
index ea9363f..601d7a7 100644
--- a/be/src/exec/zigzag-test.cc
+++ b/be/src/exec/zigzag-test.cc
@@ -163,5 +163,4 @@ TEST(ZigzagTest, Weird) {
 }
 }
 
-IMPALA_TEST_MAIN();
 
diff --git a/be/src/exprs/CMakeLists.txt b/be/src/exprs/CMakeLists.txt
index 9863182..29b15a0 100644
--- a/be/src/exprs/CMakeLists.txt
+++ b/be/src/exprs/CMakeLists.txt
@@ -69,9 +69,17 @@ add_library(Exprs
 )
 add_dependencies(Exprs gen-deps gen_ir_descriptions)
 
-ADD_BE_LSAN_TEST(expr-test)
+add_library(ExprsTests STATIC
+  expr-test.cc
+  timezone_db-test.cc
+)
+add_dependencies(ExprsTests gen-deps)
+
+ADD_UNIFIED_BE_LSAN_TEST(expr-test "Instantiations/ExprTest.*")
+# Exception to unified be tests: custom main initiailizes LLVM
 ADD_BE_LSAN_TEST(expr-codegen-test)
-ADD_BE_LSAN_TEST(timezone_db-test)
+ADD_UNIFIED_BE_LSAN_TEST(timezone_db-test
+ "TimezoneDbNamesTest.*:TimezoneDbLoadAliasTest.*:TimezoneDbLoadZoneInfoTest.*")
 
 # expr-codegen-test includes test IR functions
 COMPILE_TO_IR(expr-codegen-test.cc)
diff --git a/be/src/exprs/expr-test.cc b/be/src/exprs/expr-test.cc
index b11dd52..9cb4899 100644
--- a/be/src/exprs/expr-test.cc
+++ b/be/src/exprs/expr-test.cc
@@ -9944,9 +9944,3 @@ INSTANTIATE_TEST_CASE_P(Instantiations, ExprTest, ::testing::Values(
   // additional incidental coverage from codegening some additional expr tree
   // shapes but mostly it isn't that interesting since the majority of
   // expressions get folded to a constant anyway.
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  InitCommonRuntime(argc, argv, true, TestInfo::BE_TEST);
-  return RUN_ALL_TESTS();
-}
diff --git a/be/src/exprs/timezone_db-test.cc b/be/src/exprs/timezone_db-test.cc
index b2ef399..a41b6d2 100644
--- a/be/src/exprs/timezone_db-test.cc
+++ b/be/src/exprs/timezone_db-test.cc
@@ -226,5 +226,3 @@ TEST_F(TimezoneDbLoadZoneInfoTest, LoadZoneInfo) {
 }
 
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/gutil/CMakeLists.txt b/be/src/gutil/CMakeLists.txt
index 87612da..444ef80 100644
--- a/be/src/gutil/CMakeLists.txt
+++ b/be/src/gutil/CMakeLists.txt
@@ -72,7 +72,7 @@ ADD_EXPORTABLE_LIBRARY(gutil
 
 add_kudu_test(strings/string_util-test)
 
-add_library(GUtilTests
+add_library(GUtilTests STATIC
   sysinfo-test.cc
 )
 add_dependencies(GUtilTests gen-deps gen_ir_descriptions)
diff --git a/be/src/rpc/CMakeLists.txt b/be/src/rpc/CMakeLists.txt
index be50575..e420049 100644
--- a/be/src/rpc/CMakeLists.txt
+++ b/be/src/rpc/CMakeLists.txt
@@ -39,7 +39,16 @@ add_library(Rpc
 )
 add_dependencies(Rpc gen-deps)
 
-ADD_BE_LSAN_TEST(thrift-util-test)
+add_library(RpcTests STATIC
+  thrift-util-test.cc
+)
+add_dependencies(RpcTests gen-deps)
+
+ADD_UNIFIED_BE_LSAN_TEST(thrift-util-test ThriftUtil.*)
+
+# Exception to unified be tests: The following tests have extra link libraries and some
+# have custom main() functions.
+
 ADD_BE_TEST(thrift-server-test) # TODO: this test leaks servers
 # The thrift-server-test uses some utilities from the Kudu security test code.
 target_link_libraries(thrift-server-test security-test-for-impala)
diff --git a/be/src/rpc/thrift-util-test.cc b/be/src/rpc/thrift-util-test.cc
index 5adba29..c9980ed 100644
--- a/be/src/rpc/thrift-util-test.cc
+++ b/be/src/rpc/thrift-util-test.cc
@@ -93,5 +93,3 @@ TEST(ThriftUtil, TNetworkAddressComparator) {
 }
 
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/CMakeLists.txt b/be/src/runtime/CMakeLists.txt
index ff0e43d..242f02b 100644
--- a/be/src/runtime/CMakeLists.txt
+++ b/be/src/runtime/CMakeLists.txt
@@ -82,24 +82,50 @@ add_library(Runtime
 )
 add_dependencies(Runtime gen-deps)
 
-ADD_BE_LSAN_TEST(mem-pool-test)
-ADD_BE_LSAN_TEST(free-pool-test)
-ADD_BE_LSAN_TEST(string-buffer-test)
+add_library(RuntimeTests STATIC
+  date-test.cc
+  decimal-test.cc
+  free-pool-test.cc
+  hdfs-fs-cache-test.cc
+  mem-pool-test.cc
+  mem-tracker-test.cc
+  multi-precision-test.cc
+  raw-value-test.cc
+  row-batch-serialize-test.cc
+  string-buffer-test.cc
+  string-compare-test.cc
+  string-search-test.cc
+  string-value-test.cc
+  thread-resource-mgr-test.cc
+  timestamp-test.cc
+  tmp-file-mgr-test.cc
+)
+add_dependencies(RuntimeTests gen-deps)
+
+ADD_UNIFIED_BE_LSAN_TEST(mem-pool-test MemPoolTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(free-pool-test FreePoolTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(string-buffer-test StringBufferTest.*)
+# Exception to unified be tests: Custom main function (initializes LLVM)
 ADD_BE_TEST(data-stream-test) # TODO: this test leaks
-ADD_BE_LSAN_TEST(date-test)
-ADD_BE_LSAN_TEST(timestamp-test)
-ADD_BE_LSAN_TEST(raw-value-test)
-ADD_BE_LSAN_TEST(string-compare-test)
-ADD_BE_LSAN_TEST(string-search-test)
-ADD_BE_LSAN_TEST(string-value-test)
-ADD_BE_LSAN_TEST(thread-resource-mgr-test)
-ADD_BE_LSAN_TEST(mem-tracker-test)
-ADD_BE_LSAN_TEST(multi-precision-test)
-ADD_BE_LSAN_TEST(decimal-test)
+ADD_UNIFIED_BE_LSAN_TEST(date-test DateTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(timestamp-test TimestampTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(raw-value-test "RawValueTest.*:HashUtil.*")
+ADD_UNIFIED_BE_LSAN_TEST(string-compare-test StringCompareTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(string-search-test StringSearchTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(string-value-test StringValueTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(thread-resource-mgr-test ThreadResourceMgr.*)
+ADD_UNIFIED_BE_LSAN_TEST(mem-tracker-test MemTestTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(multi-precision-test
+    "MultiPrecisionIntTest.*:MultiPrecisionFloatTest.*")
+ADD_UNIFIED_BE_LSAN_TEST(decimal-test DecimalTest.*)
+# Exception to unified be tests: Custom main function (initializes LLVM)
 ADD_BE_LSAN_TEST(buffered-tuple-stream-test)
-ADD_BE_LSAN_TEST(hdfs-fs-cache-test)
-ADD_BE_LSAN_TEST(tmp-file-mgr-test)
-ADD_BE_LSAN_TEST(row-batch-serialize-test)
+ADD_UNIFIED_BE_LSAN_TEST(hdfs-fs-cache-test "HdfsFsCacheTest.*")
+ADD_UNIFIED_BE_LSAN_TEST(tmp-file-mgr-test "TmpFileMgrTest.*")
+ADD_UNIFIED_BE_LSAN_TEST(row-batch-serialize-test "RowBatchSerializeTest.*")
+# Exception to unified be tests: Custom main function with global Frontend object
 ADD_BE_LSAN_TEST(row-batch-test)
+# Exception to unified be tests: Custom main function with global Frontend object
 ADD_BE_LSAN_TEST(collection-value-builder-test)
+# Exception to unified be tests: Custom main function (initializes LLVM)
 ADD_BE_LSAN_TEST(runtime-state-test)
diff --git a/be/src/runtime/bufferpool/CMakeLists.txt b/be/src/runtime/bufferpool/CMakeLists.txt
index d5c95e9..e20640e 100644
--- a/be/src/runtime/bufferpool/CMakeLists.txt
+++ b/be/src/runtime/bufferpool/CMakeLists.txt
@@ -31,8 +31,17 @@ add_library(BufferPool
 )
 add_dependencies(BufferPool gen-deps)
 
+add_library(BufferPoolTests STATIC
+  free-list-test.cc
+  suballocator-test.cc
+)
+add_dependencies(BufferPoolTests gen-deps)
+
+# Exception to unified be tests: Custom main() with test repeats, messages, etc.
 ADD_BE_LSAN_TEST(buffer-allocator-test)
 ADD_BE_LSAN_TEST(buffer-pool-test)
-ADD_BE_LSAN_TEST(free-list-test)
+
+ADD_UNIFIED_BE_LSAN_TEST(free-list-test FreeListTest.*)
+# Exception to unified be tests: Custom main() with InitFeSupport(disable_codegen=false)
 ADD_BE_LSAN_TEST(reservation-tracker-test)
-ADD_BE_LSAN_TEST(suballocator-test)
+ADD_UNIFIED_BE_LSAN_TEST(suballocator-test SuballocatorTest.*)
diff --git a/be/src/runtime/bufferpool/free-list-test.cc b/be/src/runtime/bufferpool/free-list-test.cc
index d3c4c9a..5a025bf 100644
--- a/be/src/runtime/bufferpool/free-list-test.cc
+++ b/be/src/runtime/bufferpool/free-list-test.cc
@@ -162,10 +162,3 @@ TEST_F(FreeListTest, ReturnOrder) {
   }
 }
 }
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
-  impala::InitFeSupport();
-  return RUN_ALL_TESTS();
-}
diff --git a/be/src/runtime/bufferpool/suballocator-test.cc b/be/src/runtime/bufferpool/suballocator-test.cc
index ff621c5..281ab5e 100644
--- a/be/src/runtime/bufferpool/suballocator-test.cc
+++ b/be/src/runtime/bufferpool/suballocator-test.cc
@@ -369,10 +369,3 @@ void SuballocatorTest::AssertMemoryValid(
   }
 }
 }
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
-  impala::InitFeSupport();
-  return RUN_ALL_TESTS();
-}
diff --git a/be/src/runtime/date-test.cc b/be/src/runtime/date-test.cc
index 13b5c68..fefd418 100644
--- a/be/src/runtime/date-test.cc
+++ b/be/src/runtime/date-test.cc
@@ -963,5 +963,3 @@ TEST(DateTest, MonthsBetween) {
 }
 
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/decimal-test.cc b/be/src/runtime/decimal-test.cc
index ac9fea7..87d3652 100644
--- a/be/src/runtime/decimal-test.cc
+++ b/be/src/runtime/decimal-test.cc
@@ -98,7 +98,7 @@ void StringToAllDecimals(const string& s, int precision, int scale,
       Decimal16Value(val_v1), result_v1, Decimal16Value(val_v2), result_v2);
 }
 
-TEST(IntToDecimal, Basic) {
+TEST(DecimalTest, IntToDecimal) {
   Decimal16Value d16;
   bool overflow = false;
 
@@ -117,7 +117,7 @@ TEST(IntToDecimal, Basic) {
   // that.
 }
 
-TEST(DoubleToDecimal, Basic) {
+TEST(DecimalTest, DoubleToDecimal) {
   Decimal4Value d4;
   Decimal8Value d8;
   Decimal16Value d16;
@@ -270,7 +270,7 @@ TEST(DoubleToDecimal, Basic) {
   VerifyToString(d4, 1, 0, "-1");
 }
 
-TEST(StringToDecimal, Basic) {
+TEST(DecimalTest, StringToDecimalBasic) {
   StringToAllDecimals("       1234", 10, 0, 1234, StringParser::PARSE_SUCCESS);
   StringToAllDecimals("", 10, 0, 0, StringParser::PARSE_FAILURE);
   StringToAllDecimals("   ", 10, 0, 0, StringParser::PARSE_FAILURE);
@@ -358,7 +358,7 @@ TEST(StringToDecimal, Basic) {
   StringToAllDecimals("1.10e3 ", 2, 0, 11, StringParser::PARSE_OVERFLOW);
 }
 
-TEST(StringToDecimal, LargeDecimals) {
+TEST(DecimalTest, StringToDecimalLarge) {
   StringToAllDecimals("1", 1, 0, 1, StringParser::PARSE_SUCCESS);
   StringToAllDecimals("-1", 1, 0, -1, StringParser::PARSE_SUCCESS);
   StringToAllDecimals(".1", 1, 0, 0, StringParser::PARSE_UNDERFLOW);
@@ -772,7 +772,7 @@ ColumnType GetResultType(const ColumnType& t1, const ColumnType& t2, Op op, bool
   }
 }
 
-TEST(DecimalResultTypes, Basic) {
+TEST(DecimalTest, ResultTypes) {
   ColumnType t1 = ColumnType::CreateDecimalType(38, 10);
   ColumnType t2 = ColumnType::CreateDecimalType(38, 38);
   ColumnType t3 = ColumnType::CreateDecimalType(38, 0);
@@ -799,7 +799,7 @@ void VerifyFuzzyEquals(const T& actual, const ColumnType& t,
     << actual_d << " != " << expected;
 }
 
-TEST(DecimalArithmetic, Basic) {
+TEST(DecimalTest, BasicArithmetic) {
   ColumnType t1 = ColumnType::CreateDecimalType(5, 4);
   ColumnType t2 = ColumnType::CreateDecimalType(8, 3);
   ColumnType t1_plus_2 = GetResultType(t1, t2, ADD, false);
@@ -834,7 +834,7 @@ TEST(DecimalArithmetic, Basic) {
       t1_times_2, d1_double * d3_double, overflow);
 }
 
-TEST(DecimalArithmetic, Divide) {
+TEST(DecimalTest, Divide) {
   // Exhaustively test precision and scale for 4 byte decimals. The logic errors tend
   // to be by powers of 10 so not testing the other decimal types is okay.
   Decimal4Value x(123456789);
@@ -888,7 +888,7 @@ TEST(DecimalArithmetic, Divide) {
   EXPECT_FALSE(is_nan);
 }
 
-TEST(DecimalArithmetic, DivideLargeScales) {
+TEST(DecimalTest, DivideLargeScales) {
   ColumnType t1 = ColumnType::CreateDecimalType(38, 8);
   ColumnType t2 = ColumnType::CreateDecimalType(20, 0);
   ColumnType t3 = GetResultType(t1, t2, DIVIDE, false);
@@ -931,7 +931,7 @@ int DoubleCompare(double x, double y) {
 }
 
 // Randomly test decimal operations, comparing the result with a double ground truth.
-TEST(DecimalArithmetic, RandTesting) {
+TEST(DecimalTest, RandTesting) {
   int NUM_ITERS = 1000000;
   int seed = time(0);
   LOG(ERROR) << "Seed: " << seed;
@@ -982,7 +982,7 @@ TEST(DecimalArithmetic, RandTesting) {
   }
 }
 
-TEST(DecimalValidation, PrecisionScaleValidation) {
+TEST(DecimalTest, PrecisionScaleValidation) {
   // Valid precision and scale.
   EXPECT_TRUE(ColumnType::ValidateDecimalParams(1, 0));
   EXPECT_TRUE(ColumnType::ValidateDecimalParams(1, 1));
@@ -1001,4 +1001,3 @@ TEST(DecimalValidation, PrecisionScaleValidation) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/free-pool-test.cc b/be/src/runtime/free-pool-test.cc
index bfbce20..e5a5348 100644
--- a/be/src/runtime/free-pool-test.cc
+++ b/be/src/runtime/free-pool-test.cc
@@ -249,4 +249,3 @@ TEST(FreePoolTest, ReAlloc) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/hdfs-fs-cache-test.cc b/be/src/runtime/hdfs-fs-cache-test.cc
index 9c69dc3..b49a852 100644
--- a/be/src/runtime/hdfs-fs-cache-test.cc
+++ b/be/src/runtime/hdfs-fs-cache-test.cc
@@ -63,4 +63,3 @@ TEST(HdfsFsCacheTest, Basic) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/io/CMakeLists.txt b/be/src/runtime/io/CMakeLists.txt
index 29dfe1a..239d901 100644
--- a/be/src/runtime/io/CMakeLists.txt
+++ b/be/src/runtime/io/CMakeLists.txt
@@ -36,9 +36,15 @@ add_library(Io
 )
 add_dependencies(Io gen-deps)
 
+add_library(IoTests STATIC
+  disk-io-mgr-test.cc
+)
+add_dependencies(IoTests gen-deps)
+
 # This test runs forever so should not be part of 'make test'
 add_executable(disk-io-mgr-stress-test disk-io-mgr-stress-test.cc)
 target_link_libraries(disk-io-mgr-stress-test ${IMPALA_TEST_LINK_LIBS})
 
-ADD_BE_LSAN_TEST(disk-io-mgr-test)
-ADD_BE_LSAN_TEST(data-cache-test)
\ No newline at end of file
+ADD_UNIFIED_BE_LSAN_TEST(disk-io-mgr-test DiskIoMgrTest.*)
+# Exception to unified be: Custom main function (platform tests)
+ADD_BE_LSAN_TEST(data-cache-test)
diff --git a/be/src/runtime/io/disk-io-mgr-test.cc b/be/src/runtime/io/disk-io-mgr-test.cc
index 616aafc..bff89f6 100644
--- a/be/src/runtime/io/disk-io-mgr-test.cc
+++ b/be/src/runtime/io/disk-io-mgr-test.cc
@@ -1640,10 +1640,3 @@ TEST_F(DiskIoMgrTest, BufferSizeSelection) {
 }
 }
 }
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
-  impala::InitFeSupport();
-  return RUN_ALL_TESTS();
-}
diff --git a/be/src/runtime/mem-pool-test.cc b/be/src/runtime/mem-pool-test.cc
index f939008..6653af1 100644
--- a/be/src/runtime/mem-pool-test.cc
+++ b/be/src/runtime/mem-pool-test.cc
@@ -521,4 +521,3 @@ TEST(MemPoolTest, TryAllocateAligned) {
 }
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/mem-tracker-test.cc b/be/src/runtime/mem-tracker-test.cc
index e52c345..755e4ce 100644
--- a/be/src/runtime/mem-tracker-test.cc
+++ b/be/src/runtime/mem-tracker-test.cc
@@ -355,4 +355,3 @@ TEST(MemTestTest, GcFunctions) {
 }
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/multi-precision-test.cc b/be/src/runtime/multi-precision-test.cc
index babf191..390e19e 100644
--- a/be/src/runtime/multi-precision-test.cc
+++ b/be/src/runtime/multi-precision-test.cc
@@ -139,4 +139,3 @@ TEST(MultiPrecisionFloatTest, Example) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/raw-value-test.cc b/be/src/runtime/raw-value-test.cc
index 422ee58..ac67890 100644
--- a/be/src/runtime/raw-value-test.cc
+++ b/be/src/runtime/raw-value-test.cc
@@ -207,4 +207,3 @@ TEST_F(RawValueTest, TemplatizedHash) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/row-batch-serialize-test.cc b/be/src/runtime/row-batch-serialize-test.cc
index 4ea81a6..fcac615 100644
--- a/be/src/runtime/row-batch-serialize-test.cc
+++ b/be/src/runtime/row-batch-serialize-test.cc
@@ -761,13 +761,3 @@ TEST_F(RowBatchSerializeTest, DedupPathologicalFull) {
 }
 
 }
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
-  InitFeSupport();
-  uint32_t seed = time(NULL);
-  cout << "seed = " << seed << endl;
-  srand(seed);
-  return RUN_ALL_TESTS();
-}
diff --git a/be/src/runtime/string-buffer-test.cc b/be/src/runtime/string-buffer-test.cc
index 27d1021..6fb378e 100644
--- a/be/src/runtime/string-buffer-test.cc
+++ b/be/src/runtime/string-buffer-test.cc
@@ -92,5 +92,3 @@ TEST(StringBufferTest, AppendBoundary) {
 }
 
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/string-compare-test.cc b/be/src/runtime/string-compare-test.cc
index a3c959a..64cfeb1 100644
--- a/be/src/runtime/string-compare-test.cc
+++ b/be/src/runtime/string-compare-test.cc
@@ -71,4 +71,3 @@ TEST(StringCompareTest, Basic) {
 }
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/string-search-test.cc b/be/src/runtime/string-search-test.cc
index a7804cc..9d3bffb 100644
--- a/be/src/runtime/string-search-test.cc
+++ b/be/src/runtime/string-search-test.cc
@@ -128,8 +128,3 @@ TEST(StringSearchTest, ReverseSearch) {
   EXPECT_EQ(0, TestRSearch("cacacbaba", "cacacba"));
 }
 }
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}
diff --git a/be/src/runtime/string-value-test.cc b/be/src/runtime/string-value-test.cc
index 0beee90..3cdc1f3 100644
--- a/be/src/runtime/string-value-test.cc
+++ b/be/src/runtime/string-value-test.cc
@@ -121,4 +121,3 @@ TEST(StringValueTest, TestCompare) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/thread-resource-mgr-test.cc b/be/src/runtime/thread-resource-mgr-test.cc
index 66c6d14..1005d1e 100644
--- a/be/src/runtime/thread-resource-mgr-test.cc
+++ b/be/src/runtime/thread-resource-mgr-test.cc
@@ -162,4 +162,3 @@ TEST(ThreadResourceMgr, MultiCallbacks) {
 
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/timestamp-test.cc b/be/src/runtime/timestamp-test.cc
index 80c44e8..ff4e3bb 100644
--- a/be/src/runtime/timestamp-test.cc
+++ b/be/src/runtime/timestamp-test.cc
@@ -1066,4 +1066,3 @@ TEST(TimestampTest, TimezoneConversions) {
 }
 }
 
-IMPALA_TEST_MAIN();
diff --git a/be/src/runtime/tmp-file-mgr-test.cc b/be/src/runtime/tmp-file-mgr-test.cc
index c017ef7..5bed3b4 100644
--- a/be/src/runtime/tmp-file-mgr-test.cc
+++ b/be/src/runtime/tmp-file-mgr-test.cc
@@ -645,10 +645,3 @@ TEST_F(TmpFileMgrTest, TestHWMMetric) {
   checkHWMMetrics(0, 2 * LIMIT);
 }
 }
-
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
-  impala::InitFeSupport();
-  return RUN_ALL_TESTS();
-}
diff --git a/be/src/scheduling/CMakeLists.txt b/be/src/scheduling/CMakeLists.txt
index 135585d..5fd49dc 100644
--- a/be/src/scheduling/CMakeLists.txt
+++ b/be/src/scheduling/CMakeLists.txt
@@ -36,8 +36,17 @@ add_library(Scheduling STATIC
 )
 add_dependencies(Scheduling gen-deps)
 
-ADD_BE_LSAN_TEST(admission-controller-test)
-ADD_BE_LSAN_TEST(cluster-membership-mgr-test)
-ADD_BE_LSAN_TEST(executor-group-test)
-ADD_BE_LSAN_TEST(hash-ring-test)
-ADD_BE_LSAN_TEST(scheduler-test)
+add_library(SchedulingTests STATIC
+  admission-controller-test.cc
+  cluster-membership-mgr-test.cc
+  executor-group-test.cc
+  hash-ring-test.cc
+  scheduler-test.cc
+)
+add_dependencies(SchedulingTests gen-deps)
+
+ADD_UNIFIED_BE_LSAN_TEST(admission-controller-test AdmissionControllerTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(cluster-membership-mgr-test ClusterMembershipMgrTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(executor-group-test ExecutorGroupTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(hash-ring-test HashRingTest.*)
+ADD_UNIFIED_BE_LSAN_TEST(scheduler-test SchedulerTest.*)
diff --git a/be/src/scheduling/admission-controller-test.cc b/be/src/scheduling/admission-controller-test.cc
index 45ac072..2537fde 100644
--- a/be/src/scheduling/admission-controller-test.cc
+++ b/be/src/scheduling/admission-controller-test.cc
@@ -681,9 +681,3 @@ TEST_F(AdmissionControllerTest, PoolDisabled) {
 
 } // end namespace impala
 
-int main(int argc, char** argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
-  impala::InitFeSupport();
-  return RUN_ALL_TESTS();
-}
diff --git a/be/src/scheduling/cluster-membership-mgr-test.cc b/be/src/scheduling/cluster-membership-mgr-test.cc
index 91e780e..bacd8e8 100644
--- a/be/src/scheduling/cluster-membership-mgr-test.cc
+++ b/be/src/scheduling/cluster-membership-mgr-test.cc
@@ -471,5 +471,3 @@ TEST_F(ClusterMembershipMgrTest, RandomizedMembershipUpdates) {
 /// quiesce, delete).
 
 } // end namespace impala
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/scheduling/executor-group-test.cc b/be/src/scheduling/executor-group-test.cc
index ea14f6c..4eba14b 100644
--- a/be/src/scheduling/executor-group-test.cc
+++ b/be/src/scheduling/executor-group-test.cc
@@ -78,5 +78,3 @@ TEST(ExecutorGroupTest, RemoveExecutorOnSameHost) {
       executor_group.GetExecutorsForHost("10.0.0.1");
   EXPECT_EQ(1, backend_list.size());
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/scheduling/hash-ring-test.cc b/be/src/scheduling/hash-ring-test.cc
index 4ea9ba9..eb8c696 100644
--- a/be/src/scheduling/hash-ring-test.cc
+++ b/be/src/scheduling/hash-ring-test.cc
@@ -226,5 +226,3 @@ TEST_F(HashRingTest, MaxMinRatio) {
 }
 
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/scheduling/scheduler-test.cc b/be/src/scheduling/scheduler-test.cc
index e038034..8a1a541 100644
--- a/be/src/scheduling/scheduler-test.cc
+++ b/be/src/scheduling/scheduler-test.cc
@@ -702,5 +702,3 @@ TEST_F(SchedulerTest, TestExecAtCoordWithoutLocalBackend) {
 }
 
 } // end namespace impala
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/service/CMakeLists.txt b/be/src/service/CMakeLists.txt
index 95fcefc..20fd237 100644
--- a/be/src/service/CMakeLists.txt
+++ b/be/src/service/CMakeLists.txt
@@ -46,6 +46,13 @@ add_library(Service
 )
 add_dependencies(Service gen-deps)
 
+add_library(ServiceTests STATIC
+  hs2-util-test.cc
+  impala-server-test.cc
+  query-options-test.cc
+)
+add_dependencies(ServiceTests gen-deps)
+
 # this shared library provides Impala executor functionality to FE test.
 add_library(fesupport SHARED
   fe-support.cc
@@ -102,7 +109,8 @@ target_link_libraries(unifiedbetests
   ${JAVA_JSIG_LIBRARY} ${UNIFIED_TEST_LINK_LIBS})
 ADD_DEPENDENCIES(unified-be-test-executable unifiedbetests)
 
+# Exception to unified be tests: Custom main() due to leak
 ADD_BE_TEST(session-expiry-test session-expiry-test.cc) # TODO: this leaks thrift server
-ADD_BE_LSAN_TEST(hs2-util-test hs2-util-test.cc)
-ADD_BE_LSAN_TEST(query-options-test query-options-test.cc)
-ADD_BE_LSAN_TEST(impala-server-test impala-server-test.cc)
+ADD_UNIFIED_BE_LSAN_TEST(hs2-util-test "StitchNullsTest.*:PrintTColumnValueTest.*")
+ADD_UNIFIED_BE_LSAN_TEST(query-options-test QueryOptions.*)
+ADD_UNIFIED_BE_LSAN_TEST(impala-server-test ImpalaServerTest.*)
diff --git a/be/src/service/hs2-util-test.cc b/be/src/service/hs2-util-test.cc
index 8932ce8..ec39bde 100644
--- a/be/src/service/hs2-util-test.cc
+++ b/be/src/service/hs2-util-test.cc
@@ -158,5 +158,3 @@ TEST(PrintTColumnValueTest, TestAllTypes) {
   }
 }
 
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/service/impala-server-test.cc b/be/src/service/impala-server-test.cc
index 772e70f..10dd22b 100644
--- a/be/src/service/impala-server-test.cc
+++ b/be/src/service/impala-server-test.cc
@@ -70,5 +70,3 @@ TEST(ImpalaServerTest, PopulateAuthorizedProxyConfig) {
     EXPECT_EQ(proxy_map.end(), proxy_map.find("doesnotexist"));
   }
 }
-
-IMPALA_TEST_MAIN();
diff --git a/be/src/service/query-options-test.cc b/be/src/service/query-options-test.cc
index 46fff23..8c02417 100644
--- a/be/src/service/query-options-test.cc
+++ b/be/src/service/query-options-test.cc
@@ -509,4 +509,3 @@ TEST(QueryOptions, CompressionCodec) {
 #undef ENTRIES
 #undef ENTRY
 }
-IMPALA_TEST_MAIN();
diff --git a/be/src/util/CMakeLists.txt b/be/src/util/CMakeLists.txt
index 605060e..15e7cbe 100644
--- a/be/src/util/CMakeLists.txt
+++ b/be/src/util/CMakeLists.txt
@@ -99,7 +99,7 @@ add_library(Util
   ${MPFIT_SRC_DIR}/mpfit.c)
 add_dependencies(Util gen-deps gen_ir_descriptions)
 
-add_library(UtilTests
+add_library(UtilTests STATIC
   benchmark-test.cc
   bitmap-test.cc
   bit-packing-test.cc