You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jb...@apache.org on 2016/09/14 14:45:49 UTC
[2/3] incubator-impala git commit: IMPALA-4091: Fix backend unit to
log in logs/be_tests.
IMPALA-4091: Fix backend unit to log in logs/be_tests.
1. Many backend unit tests did not follow proper initialization
using InitCommonRuntime(), and as a result did not write their
logs into the logs/be_tests directory.
2. Added an IMPALA_TEST_MAIN() macro that stamps out the common
main() function used in most gtest unit tests.
3. Tests added via ADD_UDF_TEST in a CMakeLists.txt did not
have the logging dir set up properly.
Testing: I validated that every test produces a corresponding
.INFO file in logs/be_tests. The only exception is promise-test
for which I added a TODO since the fix seems non-trivial.
Change-Id: Iaff0acf09bf192d54baeb0bb347e895fce6ed23b
Reviewed-on: http://gerrit.cloudera.org:8080/4352
Reviewed-by: Alex Behm <al...@cloudera.com>
Tested-by: Internal Jenkins
Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/f4bbd415
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/f4bbd415
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/f4bbd415
Branch: refs/heads/master
Commit: f4bbd415e8f0632661937e72da815332a27e412e
Parents: 01b8ade
Author: Alex Behm <al...@cloudera.com>
Authored: Thu Sep 8 17:07:20 2016 -0700
Committer: Internal Jenkins <cl...@gerrit.cloudera.org>
Committed: Wed Sep 14 04:13:28 2016 +0000
----------------------------------------------------------------------
be/CMakeLists.txt | 3 ++-
be/src/codegen/instruction-counter-test.cc | 7 ++-----
be/src/common/atomic-test.cc | 7 ++-----
be/src/common/init.h | 4 ++--
be/src/exec/delimited-text-parser-test.cc | 9 ++-------
be/src/exec/hdfs-avro-scanner-test.cc | 9 ++-------
be/src/exec/incr-stats-util-test.cc | 8 ++------
be/src/exec/incr-stats-util.cc | 7 ++++---
be/src/exec/old-hash-table-test.cc | 8 ++------
be/src/exec/parquet-plain-test.cc | 8 ++------
be/src/exec/parquet-version-test.cc | 11 ++++-------
be/src/exec/read-write-util-test.cc | 12 ++++--------
be/src/exec/row-batch-list-test.cc | 11 +++--------
be/src/exec/zigzag-test.cc | 10 +++-------
be/src/experiments/string-search-sse-test.cc | 7 ++-----
be/src/exprs/aggregate-functions-test.cc | 10 ++--------
be/src/rpc/thrift-server-test.cc | 7 +------
be/src/rpc/thrift-util-test.cc | 7 ++-----
be/src/runtime/buffered-tuple-stream-test.cc | 1 -
be/src/runtime/collection-value-builder-test.cc | 8 +-------
be/src/runtime/decimal-test.cc | 8 ++------
be/src/runtime/free-pool-test.cc | 7 ++-----
be/src/runtime/free-pool.h | 1 +
be/src/runtime/hdfs-fs-cache-test.cc | 10 +++-------
be/src/runtime/mem-pool-test.cc | 7 ++-----
be/src/runtime/mem-tracker-test.cc | 7 ++-----
be/src/runtime/multi-precision-test.cc | 8 ++------
be/src/runtime/parallel-executor-test.cc | 8 ++------
be/src/runtime/raw-value-test.cc | 9 ++-------
be/src/runtime/row-batch-serialize-test.cc | 3 ++-
be/src/runtime/string-buffer-test.cc | 8 ++------
be/src/runtime/string-value-test.cc | 9 ++-------
be/src/runtime/thread-resource-mgr-test.cc | 8 ++------
be/src/runtime/timestamp-test.cc | 9 ++-------
be/src/scheduling/backend-config-test.cc | 11 ++---------
be/src/scheduling/simple-scheduler-test.cc | 12 ++----------
be/src/service/hs2-util-test.cc | 8 ++------
be/src/service/query-options-test.cc | 7 +------
be/src/service/session-expiry-test.cc | 11 +++++------
be/src/testutil/gtest-util.h | 10 ++++++++++
be/src/udf/uda-test.cc | 9 ++-------
be/src/udf/udf-test.cc | 9 ++-------
be/src/util/benchmark-test.cc | 9 ++-------
be/src/util/bit-util-test.cc | 8 ++------
be/src/util/bitmap-test.cc | 11 +++--------
be/src/util/blocking-queue-test.cc | 8 ++------
be/src/util/bloom-filter-test.cc | 11 ++---------
be/src/util/coding-util-test.cc | 7 ++-----
be/src/util/debug-util-test.cc | 7 ++-----
be/src/util/decompress-test.cc | 6 ++++--
be/src/util/dict-test.cc | 12 ++----------
be/src/util/error-util-test.cc | 10 ++++------
be/src/util/filesystem-util-test.cc | 8 ++------
be/src/util/fixed-size-hash-table-test.cc | 9 ++-------
be/src/util/internal-queue-test.cc | 3 ++-
be/src/util/logging-support-test.cc | 9 ++-------
be/src/util/lru-cache-test.cc | 8 ++------
be/src/util/metrics-test.cc | 10 +++-------
be/src/util/parse-util-test.cc | 10 ++--------
be/src/util/perf-counters-test.cc | 11 +++--------
be/src/util/pretty-printer-test.cc | 9 ++-------
be/src/util/promise-test.cc | 6 ++++--
be/src/util/redactor-config-parser-test.cc | 9 ++-------
be/src/util/redactor-test.cc | 8 ++------
be/src/util/redactor-unconfigured-test.cc | 9 ++-------
be/src/util/rle-test.cc | 10 ++--------
be/src/util/runtime-profile-test.cc | 12 +++---------
be/src/util/runtime-profile.cc | 1 -
be/src/util/string-parser-test.cc | 7 ++-----
be/src/util/symbols-util-test.cc | 7 ++-----
be/src/util/thread-pool-test.cc | 9 ++-------
be/src/util/uid-util-test.cc | 7 ++-----
be/src/util/webserver-test.cc | 2 +-
73 files changed, 167 insertions(+), 419 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt
index 2a46239..6df394f 100644
--- a/be/CMakeLists.txt
+++ b/be/CMakeLists.txt
@@ -394,7 +394,8 @@ FUNCTION(ADD_UDF_TEST TEST_NAME)
# the Runtime method implementations will be linked. See IMPALA-3132.
TARGET_LINK_LIBRARIES(${TEST_NAME} ImpalaUdf ${IMPALA_TEST_LINK_LIBS})
set(CMAKE_EXE_LINKER_FLAGS "--start-group")
- ADD_TEST(${TEST_NAME} "${BUILD_OUTPUT_ROOT_DIRECTORY}/${DIR_NAME}/${TEST_NAME}")
+ ADD_TEST(${TEST_NAME} "${BUILD_OUTPUT_ROOT_DIRECTORY}/${DIR_NAME}/${TEST_NAME}"
+ -log_dir=$ENV{IMPALA_BE_TEST_LOGS_DIR})
ADD_DEPENDENCIES(be-test ${TEST_NAME})
ENDFUNCTION()
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/codegen/instruction-counter-test.cc
----------------------------------------------------------------------
diff --git a/be/src/codegen/instruction-counter-test.cc b/be/src/codegen/instruction-counter-test.cc
index 3251234..0bd4619 100644
--- a/be/src/codegen/instruction-counter-test.cc
+++ b/be/src/codegen/instruction-counter-test.cc
@@ -16,7 +16,6 @@
// under the License.
#include <boost/thread/thread.hpp>
-#include <gtest/gtest.h>
#include <string>
#include "llvm/IR/Module.h"
@@ -27,6 +26,7 @@
#include "codegen/llvm-codegen.h"
#include "codegen/instruction-counter.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
using namespace llvm;
@@ -173,8 +173,5 @@ TEST_F(InstructionCounterTest, TestMemInstrCount) {
} // namespace impala
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/common/atomic-test.cc
----------------------------------------------------------------------
diff --git a/be/src/common/atomic-test.cc b/be/src/common/atomic-test.cc
index 36f7fdf..ccbaa8e 100644
--- a/be/src/common/atomic-test.cc
+++ b/be/src/common/atomic-test.cc
@@ -16,10 +16,10 @@
// under the License.
#include <string>
-#include <gtest/gtest.h>
#include <boost/thread.hpp>
#include "common/atomic.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -252,7 +252,4 @@ TEST(AtomicTest, MultipleTreadsAcquireReleaseLoadStoreInt64) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/common/init.h
----------------------------------------------------------------------
diff --git a/be/src/common/init.h b/be/src/common/init.h
index 9f40e4c..941d879 100644
--- a/be/src/common/init.h
+++ b/be/src/common/init.h
@@ -23,8 +23,8 @@
namespace impala {
/// Initialises logging, flags, and, if init_jvm is true, an embedded JVM.
-/// Tests can initialize indicating if they are a FE or BE test if they require
-/// different behavior (most BE tests don't.).
+/// Tests must indicate if they are a FE or BE test to output logs to the appropriate
+/// logging directory, and enable special test-specific behavior.
/// Callers that want to override default gflags variables should do so before calling
/// this method. No logging should be performed until after this method returns.
void InitCommonRuntime(int argc, char** argv, bool init_jvm,
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exec/delimited-text-parser-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/delimited-text-parser-test.cc b/be/src/exec/delimited-text-parser-test.cc
index de0915c..4929431 100644
--- a/be/src/exec/delimited-text-parser-test.cc
+++ b/be/src/exec/delimited-text-parser-test.cc
@@ -16,10 +16,9 @@
// under the License.
#include <string>
-#include <gtest/gtest.h>
#include "exec/delimited-text-parser.inline.h"
-#include "util/cpu-info.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -187,8 +186,4 @@ TEST(DelimitedTextParser, SpecialDelimiters) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exec/hdfs-avro-scanner-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/hdfs-avro-scanner-test.cc b/be/src/exec/hdfs-avro-scanner-test.cc
index 2bf77a7..b031d6c 100644
--- a/be/src/exec/hdfs-avro-scanner-test.cc
+++ b/be/src/exec/hdfs-avro-scanner-test.cc
@@ -17,14 +17,13 @@
#include "exec/hdfs-avro-scanner.h"
-#include <gtest/gtest.h>
#include <limits.h>
-#include "common/init.h"
#include "exec/read-write-util.h"
#include "runtime/decimal-value.inline.h"
#include "runtime/runtime-state.h"
#include "runtime/string-value.inline.h"
+#include "testutil/gtest-util.h"
// TODO: IMPALA-3658: complete CHAR unit tests.
// TODO: IMPALA-3658: complete VARCHAR unit tests.
@@ -462,8 +461,4 @@ TEST_F(HdfsAvroScannerTest, DecimalTest) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- InitCommonRuntime(argc, argv, false, impala::TestInfo::BE_TEST);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exec/incr-stats-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/incr-stats-util-test.cc b/be/src/exec/incr-stats-util-test.cc
index 16eec4a..cf5e725 100644
--- a/be/src/exec/incr-stats-util-test.cc
+++ b/be/src/exec/incr-stats-util-test.cc
@@ -20,7 +20,7 @@
#include <limits>
#include <cmath>
-#include "common/logging.h"
+#include "testutil/gtest-util.h"
#include "exprs/aggregate-functions.h"
#include "common/names.h"
@@ -73,8 +73,4 @@ TEST(RleTest, TestEncode) {
}
-int main(int argc, char** argv) {
- //InitCommonRuntime(argc, argv, true);
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exec/incr-stats-util.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/incr-stats-util.cc b/be/src/exec/incr-stats-util.cc
index 5b32b5d..7d27184 100644
--- a/be/src/exec/incr-stats-util.cc
+++ b/be/src/exec/incr-stats-util.cc
@@ -22,13 +22,14 @@
#include <cmath>
#include <sstream>
+#include "gen-cpp/CatalogService_types.h"
+#include "gen-cpp/CatalogObjects_types.h"
+
#include "common/compiler-util.h"
#include "common/logging.h"
+#include "exprs/aggregate-functions.h"
#include "service/hs2-util.h"
#include "udf/udf.h"
-#include "gen-cpp/CatalogService_types.h"
-#include "gen-cpp/CatalogObjects_types.h"
-#include "exprs/aggregate-functions.h"
#include "common/names.h"
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exec/old-hash-table-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/old-hash-table-test.cc b/be/src/exec/old-hash-table-test.cc
index 6374293..31e0cac 100644
--- a/be/src/exec/old-hash-table-test.cc
+++ b/be/src/exec/old-hash-table-test.cc
@@ -20,7 +20,6 @@
#include <iostream>
#include <vector>
-#include "testutil/gtest-util.h"
#include "common/compiler-util.h"
#include "exec/old-hash-table.inline.h"
#include "exprs/expr.h"
@@ -30,6 +29,7 @@
#include "runtime/mem-tracker.h"
#include "runtime/string-value.h"
#include "runtime/tuple-row.h"
+#include "testutil/gtest-util.h"
#include "util/cpu-info.h"
#include "util/runtime-profile-counters.h"
@@ -323,8 +323,4 @@ TEST_F(OldHashTableTest, GrowTableTest) {
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exec/parquet-plain-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/parquet-plain-test.cc b/be/src/exec/parquet-plain-test.cc
index 524ef4b..19c09ce 100644
--- a/be/src/exec/parquet-plain-test.cc
+++ b/be/src/exec/parquet-plain-test.cc
@@ -19,11 +19,11 @@
#include <stdio.h>
#include <iostream>
#include <limits.h>
-#include <gtest/gtest.h>
#include "exec/parquet-common.h"
#include "runtime/decimal-value.h"
#include "runtime/string-value.inline.h"
#include "runtime/timestamp-value.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -162,8 +162,4 @@ TEST(PlainEncoding, CorruptString) {
}
-int main(int argc, char **argv) {
- impala::CpuInfo::Init();
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exec/parquet-version-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/parquet-version-test.cc b/be/src/exec/parquet-version-test.cc
index 0b8ad33..d720e0e 100644
--- a/be/src/exec/parquet-version-test.cc
+++ b/be/src/exec/parquet-version-test.cc
@@ -19,9 +19,9 @@
#include <stdio.h>
#include <iostream>
#include <limits.h>
-#include <gtest/gtest.h>
+
#include "exec/parquet-metadata-utils.h"
-#include "util/cpu-info.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -80,8 +80,5 @@ TEST(ParquetVersionTest, Comparisons) {
}
-int main(int argc, char **argv) {
- impala::CpuInfo::Init();
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
+
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exec/read-write-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/read-write-util-test.cc b/be/src/exec/read-write-util-test.cc
index bed928e..0f9c6ae 100644
--- a/be/src/exec/read-write-util-test.cc
+++ b/be/src/exec/read-write-util-test.cc
@@ -19,9 +19,9 @@
#include <stdio.h>
#include <iostream>
#include <limits.h>
-#include <gtest/gtest.h>
+
#include "exec/read-write-util.h"
-#include "util/cpu-info.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -45,7 +45,7 @@ TEST(ReadWriteUtil, BigEndian) {
TestBigEndian<uint32_t>(0xffff);
TestBigEndian<uint32_t>(0xffffff);
TestBigEndian<uint32_t>(0xffffffff);
-
+
TestBigEndian<uint64_t>(0);
TestBigEndian<uint64_t>(0xff);
TestBigEndian<uint64_t>(0xffff);
@@ -58,8 +58,4 @@ TEST(ReadWriteUtil, BigEndian) {
}
-int main(int argc, char **argv) {
- impala::CpuInfo::Init();
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exec/row-batch-list-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/row-batch-list-test.cc b/be/src/exec/row-batch-list-test.cc
index 7d36a58..38ce177 100644
--- a/be/src/exec/row-batch-list-test.cc
+++ b/be/src/exec/row-batch-list-test.cc
@@ -20,17 +20,15 @@
#include <iostream>
#include <vector>
-#include <gtest/gtest.h>
-
#include "exec/row-batch-list.h"
#include "runtime/descriptors.h"
#include "runtime/mem-pool.h"
#include "runtime/mem-tracker.h"
#include "runtime/string-value.h"
#include "runtime/tuple-row.h"
-#include "util/cpu-info.h"
#include "util/runtime-profile-counters.h"
#include "testutil/desc-tbl-builder.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -141,8 +139,5 @@ TEST_F(RowBatchListTest, MultipleRowBatchesTest) {
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
+
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exec/zigzag-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exec/zigzag-test.cc b/be/src/exec/zigzag-test.cc
index 9510220..87b686c 100644
--- a/be/src/exec/zigzag-test.cc
+++ b/be/src/exec/zigzag-test.cc
@@ -19,11 +19,10 @@
#include <stdio.h>
#include <iostream>
#include <limits.h>
-#include <gtest/gtest.h>
#include "common/status.h"
#include "exec/read-write-util.h"
-#include "util/cpu-info.h"
#include "util/hash-util.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -164,8 +163,5 @@ TEST(ZigzagTest, Weird) {
}
}
-int main(int argc, char **argv) {
- impala::CpuInfo::Init();
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
+
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/experiments/string-search-sse-test.cc
----------------------------------------------------------------------
diff --git a/be/src/experiments/string-search-sse-test.cc b/be/src/experiments/string-search-sse-test.cc
index e570a6b..ef0d431 100644
--- a/be/src/experiments/string-search-sse-test.cc
+++ b/be/src/experiments/string-search-sse-test.cc
@@ -15,10 +15,10 @@
// specific language governing permissions and limitations
// under the License.
-#include <gtest/gtest.h>
#include <string>
#include "experiments/string-search-sse.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -113,7 +113,4 @@ TEST(StringSearchTest, Basic) {
}
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/exprs/aggregate-functions-test.cc
----------------------------------------------------------------------
diff --git a/be/src/exprs/aggregate-functions-test.cc b/be/src/exprs/aggregate-functions-test.cc
index d14f016..c0857e0 100644
--- a/be/src/exprs/aggregate-functions-test.cc
+++ b/be/src/exprs/aggregate-functions-test.cc
@@ -16,17 +16,15 @@
// under the License.
#include <iostream>
-#include <gtest/gtest.h>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/variance.hpp>
-#include "common/init.h"
-#include "common/logging.h"
#include "exprs/aggregate-functions.h"
#include "runtime/multi-precision.h"
+#include "testutil/gtest-util.h"
#include "udf/udf.h"
#include "udf/uda-test-harness.h"
#include "util/decimal-util.h"
@@ -165,8 +163,4 @@ TEST(HistogramTest, TestString) {
EXPECT_TRUE(test.Execute(input, StringVal(&expected[0]))) << test.GetErrorMsg();
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- InitCommonRuntime(argc, argv, false, TestInfo::BE_TEST);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/rpc/thrift-server-test.cc
----------------------------------------------------------------------
diff --git a/be/src/rpc/thrift-server-test.cc b/be/src/rpc/thrift-server-test.cc
index 7c5ba66..efd35cb 100644
--- a/be/src/rpc/thrift-server-test.cc
+++ b/be/src/rpc/thrift-server-test.cc
@@ -21,7 +21,6 @@
#include "rpc/thrift-client.h"
#include "service/fe-support.h"
#include "service/impala-server.h"
-#include "common/init.h"
#include "gen-cpp/StatestoreService.h"
#include "gutil/strings/substitute.h"
@@ -171,8 +170,4 @@ TEST(SslTest, ClientBeforeServer) {
ssl_client.iface()->RegisterSubscriber(resp, TRegisterSubscriberRequest());
}
-int main(int argc, char** argv) {
- InitCommonRuntime(argc, argv, false);
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/rpc/thrift-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/rpc/thrift-util-test.cc b/be/src/rpc/thrift-util-test.cc
index 6078ad8..ddf1ce9 100644
--- a/be/src/rpc/thrift-util-test.cc
+++ b/be/src/rpc/thrift-util-test.cc
@@ -19,9 +19,9 @@
#include <stdio.h>
#include <iostream>
+#include "rpc/thrift-util.h"
#include "testutil/gtest-util.h"
#include "util/network-util.h"
-#include "rpc/thrift-util.h"
#include "gen-cpp/RuntimeProfile_types.h"
@@ -82,7 +82,4 @@ TEST(ThriftUtil, TNetworkAddressComparator) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/buffered-tuple-stream-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/buffered-tuple-stream-test.cc b/be/src/runtime/buffered-tuple-stream-test.cc
index 558b617..5049e8b 100644
--- a/be/src/runtime/buffered-tuple-stream-test.cc
+++ b/be/src/runtime/buffered-tuple-stream-test.cc
@@ -25,7 +25,6 @@
#include "testutil/gtest-util.h"
#include "codegen/llvm-codegen.h"
-#include "common/init.h"
#include "gutil/gscoped_ptr.h"
#include "runtime/buffered-tuple-stream.inline.h"
#include "runtime/collection-value.h"
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/collection-value-builder-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/collection-value-builder-test.cc b/be/src/runtime/collection-value-builder-test.cc
index 7f6284e..c7843b7 100644
--- a/be/src/runtime/collection-value-builder-test.cc
+++ b/be/src/runtime/collection-value-builder-test.cc
@@ -15,8 +15,6 @@
// specific language governing permissions and limitations
// under the License.
-#include <gtest/gtest.h>
-
#include "runtime/collection-value-builder.h"
#include "runtime/mem-tracker.h"
#include "testutil/desc-tbl-builder.h"
@@ -68,8 +66,4 @@ TEST(CollectionValueBuilderTest, MaxBufferSize) {
pool.FreeAll();
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/decimal-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/decimal-test.cc b/be/src/runtime/decimal-test.cc
index e141242..ab87a0b 100644
--- a/be/src/runtime/decimal-test.cc
+++ b/be/src/runtime/decimal-test.cc
@@ -19,10 +19,10 @@
#include <stdio.h>
#include <iostream>
#include <limits>
-#include <gtest/gtest.h>
#include <boost/cstdint.hpp>
#include <boost/lexical_cast.hpp>
#include "runtime/decimal-value.inline.h"
+#include "testutil/gtest-util.h"
#include "util/string-parser.h"
#include "common/names.h"
@@ -798,8 +798,4 @@ TEST(DecimalArithmetic, RandTesting) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::DecimalUtil::InitMaxUnscaledDecimal16();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/free-pool-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/free-pool-test.cc b/be/src/runtime/free-pool-test.cc
index 1558683..d808695 100644
--- a/be/src/runtime/free-pool-test.cc
+++ b/be/src/runtime/free-pool-test.cc
@@ -16,11 +16,11 @@
// under the License.
#include <string>
-#include <gtest/gtest.h>
#include "runtime/free-pool.h"
#include "runtime/mem-pool.h"
#include "runtime/mem-tracker.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -197,7 +197,4 @@ TEST(FreePoolTest, ReAlloc) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/free-pool.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/free-pool.h b/be/src/runtime/free-pool.h
index f37f433..ca22c48 100644
--- a/be/src/runtime/free-pool.h
+++ b/be/src/runtime/free-pool.h
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <string.h>
#include <string>
+#include <sstream>
#include "common/logging.h"
#include "gutil/bits.h"
#include "runtime/mem-pool.h"
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/hdfs-fs-cache-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/hdfs-fs-cache-test.cc b/be/src/runtime/hdfs-fs-cache-test.cc
index 6615554..bd110f0 100644
--- a/be/src/runtime/hdfs-fs-cache-test.cc
+++ b/be/src/runtime/hdfs-fs-cache-test.cc
@@ -16,13 +16,13 @@
// under the License.
#include <string>
-#include <gtest/gtest.h>
#include <gutil/strings/substitute.h>
#include "runtime/hdfs-fs-cache.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
-using namespace strings;
+using strings::Substitute;
namespace impala {
void ValidateNameNode(const string& path, const string& expected_namenode,
@@ -65,8 +65,4 @@ TEST(HdfsFsCacheTest, Basic) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/mem-pool-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/mem-pool-test.cc b/be/src/runtime/mem-pool-test.cc
index 78b0963..99cec9a 100644
--- a/be/src/runtime/mem-pool-test.cc
+++ b/be/src/runtime/mem-pool-test.cc
@@ -16,10 +16,10 @@
// under the License.
#include <string>
-#include <gtest/gtest.h>
#include "runtime/mem-pool.h"
#include "runtime/mem-tracker.h"
+#include "testutil/gtest-util.h"
#include "util/bit-util.h"
#include "common/names.h"
@@ -489,7 +489,4 @@ TEST(MemPoolTest, ReturnAllocationThenFailedAllocation) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/mem-tracker-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/mem-tracker-test.cc b/be/src/runtime/mem-tracker-test.cc
index 584fc31..87eec14 100644
--- a/be/src/runtime/mem-tracker-test.cc
+++ b/be/src/runtime/mem-tracker-test.cc
@@ -17,9 +17,9 @@
#include <string>
#include <boost/bind.hpp>
-#include <gtest/gtest.h>
#include "runtime/mem-tracker.h"
+#include "testutil/gtest-util.h"
#include "util/metrics.h"
#include "common/names.h"
@@ -219,7 +219,4 @@ TEST(MemTestTest, GcFunctions) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/multi-precision-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/multi-precision-test.cc b/be/src/runtime/multi-precision-test.cc
index fc31de6..9930a8a 100644
--- a/be/src/runtime/multi-precision-test.cc
+++ b/be/src/runtime/multi-precision-test.cc
@@ -16,11 +16,10 @@
// under the License.
#include <string>
-#include <gtest/gtest.h>
#include <boost/math/constants/constants.hpp>
-#include "common/logging.h"
#include "runtime/multi-precision.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -140,7 +139,4 @@ TEST(MultiPrecisionFloatTest, Example) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/parallel-executor-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/parallel-executor-test.cc b/be/src/runtime/parallel-executor-test.cc
index dd89bf3..c0d797f 100644
--- a/be/src/runtime/parallel-executor-test.cc
+++ b/be/src/runtime/parallel-executor-test.cc
@@ -19,8 +19,8 @@
#include <string>
#include <boost/bind.hpp>
-#include "testutil/gtest-util.h"
#include "runtime/parallel-executor.h"
+#include "testutil/gtest-util.h"
#include "util/thread.h"
#include "common/names.h"
@@ -79,8 +79,4 @@ TEST(ParallelExecutorTest, Basic) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- InitThreading();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/raw-value-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/raw-value-test.cc b/be/src/runtime/raw-value-test.cc
index 5677917..7cea538 100644
--- a/be/src/runtime/raw-value-test.cc
+++ b/be/src/runtime/raw-value-test.cc
@@ -15,9 +15,9 @@
// specific language governing permissions and limitations
// under the License.
-#include <gtest/gtest.h>
#include <sstream>
#include "runtime/raw-value.inline.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -194,9 +194,4 @@ TEST_F(RawValueTest, TemplatizedHash) {
}
-int main(int argc, char **argv) {
- google::InitGoogleLogging(argv[0]);
- ::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/row-batch-serialize-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/row-batch-serialize-test.cc b/be/src/runtime/row-batch-serialize-test.cc
index e4a2de8..0f5e519 100644
--- a/be/src/runtime/row-batch-serialize-test.cc
+++ b/be/src/runtime/row-batch-serialize-test.cc
@@ -15,6 +15,7 @@
// specific language governing permissions and limitations
// under the License.
+#include "common/init.h"
#include "testutil/gtest-util.h"
#include "runtime/collection-value.h"
#include "runtime/collection-value-builder.h"
@@ -646,7 +647,7 @@ TEST_F(RowBatchSerializeTest, DedupPathologicalFull) {
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
+ impala::InitCommonRuntime(argc, argv, false, impala::TestInfo::BE_TEST);
uint32_t seed = time(NULL);
cout << "seed = " << seed << endl;
srand(seed);
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/string-buffer-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/string-buffer-test.cc b/be/src/runtime/string-buffer-test.cc
index 0ce0b6b..c370728 100644
--- a/be/src/runtime/string-buffer-test.cc
+++ b/be/src/runtime/string-buffer-test.cc
@@ -16,11 +16,11 @@
// under the License.
#include <string>
-#include <gtest/gtest.h>
#include "runtime/mem-pool.h"
#include "runtime/mem-tracker.h"
#include "runtime/string-buffer.h"
+#include "testutil/gtest-util.h"
#include "common/names.h"
@@ -93,8 +93,4 @@ TEST(StringBufferTest, AppendBoundary) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/string-value-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/string-value-test.cc b/be/src/runtime/string-value-test.cc
index 6b3a440..0beee90 100644
--- a/be/src/runtime/string-value-test.cc
+++ b/be/src/runtime/string-value-test.cc
@@ -16,9 +16,9 @@
// under the License.
#include <string>
-#include <gtest/gtest.h>
#include "runtime/string-value.inline.h"
+#include "testutil/gtest-util.h"
#include "util/cpu-info.h"
#include "common/names.h"
@@ -121,9 +121,4 @@ TEST(StringValueTest, TestCompare) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
- return RUN_ALL_TESTS();
-}
-
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/thread-resource-mgr-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/thread-resource-mgr-test.cc b/be/src/runtime/thread-resource-mgr-test.cc
index 45f3bf3..f480ecd 100644
--- a/be/src/runtime/thread-resource-mgr-test.cc
+++ b/be/src/runtime/thread-resource-mgr-test.cc
@@ -17,9 +17,9 @@
#include <string>
#include <boost/bind.hpp>
-#include <gtest/gtest.h>
#include "runtime/thread-resource-mgr.h"
+#include "testutil/gtest-util.h"
#include "util/cpu-info.h"
#include "common/names.h"
@@ -166,8 +166,4 @@ TEST(ThreadResourceMgr, MultiCallbacks) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/runtime/timestamp-test.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/timestamp-test.cc b/be/src/runtime/timestamp-test.cc
index adcc5ac..b3002a9 100644
--- a/be/src/runtime/timestamp-test.cc
+++ b/be/src/runtime/timestamp-test.cc
@@ -20,13 +20,12 @@
#include <boost/assign/list_of.hpp>
#include <boost/date_time/gregorian/gregorian.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
-#include <gtest/gtest.h>
-#include "common/init.h"
#include "common/status.h"
#include "runtime/raw-value.inline.h"
#include "runtime/timestamp-parse-util.h"
#include "runtime/timestamp-value.h"
+#include "testutil/gtest-util.h"
#include "util/string-parser.h"
#include "common/names.h"
@@ -626,8 +625,4 @@ TEST(TimestampTest, Basic) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::InitCommonRuntime(argc, argv, false);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/scheduling/backend-config-test.cc
----------------------------------------------------------------------
diff --git a/be/src/scheduling/backend-config-test.cc b/be/src/scheduling/backend-config-test.cc
index 82dc6a5..9da7660 100644
--- a/be/src/scheduling/backend-config-test.cc
+++ b/be/src/scheduling/backend-config-test.cc
@@ -15,12 +15,11 @@
// specific language governing permissions and limitations
// under the License.
-#include <gtest/gtest.h>
-
#include "scheduling/backend-config.h"
#include "common/logging.h"
#include "common/names.h"
+#include "testutil/gtest-util.h"
#include "util/network-util.h"
#include "util/thread.h"
@@ -91,10 +90,4 @@ TEST(BackendConfigTest, RemoveBackendOnSameHost) {
} // end namespace impala
-int main(int argc, char **argv) {
- google::InitGoogleLogging(argv[0]);
- impala::CpuInfo::Init();
- impala::InitThreading();
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/scheduling/simple-scheduler-test.cc
----------------------------------------------------------------------
diff --git a/be/src/scheduling/simple-scheduler-test.cc b/be/src/scheduling/simple-scheduler-test.cc
index 4fb81e9..76da6f9 100644
--- a/be/src/scheduling/simple-scheduler-test.cc
+++ b/be/src/scheduling/simple-scheduler-test.cc
@@ -15,15 +15,13 @@
// specific language governing permissions and limitations
// under the License.
-#include <gtest/gtest.h>
-
#include <set>
#include <vector>
#include <boost/scoped_ptr.hpp>
-#include "common/logging.h"
#include "simple-scheduler.h"
+#include "testutil/gtest-util.h"
#include "util/runtime-profile.h"
#include "common/names.h"
@@ -1211,10 +1209,4 @@ TEST_F(SchedulerTest, TestSendUpdates) {
} // end namespace impala
-int main(int argc, char **argv) {
- google::InitGoogleLogging(argv[0]);
- impala::CpuInfo::Init();
- impala::InitThreading();
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/service/hs2-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/service/hs2-util-test.cc b/be/src/service/hs2-util-test.cc
index 7a45e82..8932ce8 100644
--- a/be/src/service/hs2-util-test.cc
+++ b/be/src/service/hs2-util-test.cc
@@ -19,11 +19,10 @@
#include <string>
#include <utility>
-#include <gtest/gtest.h>
#include "common/init.h"
-
#include "common/names.h"
+#include "testutil/gtest-util.h"
using namespace impala;
using namespace std;
@@ -160,7 +159,4 @@ TEST(PrintTColumnValueTest, TestAllTypes) {
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/service/query-options-test.cc
----------------------------------------------------------------------
diff --git a/be/src/service/query-options-test.cc b/be/src/service/query-options-test.cc
index c833ab2..9006947 100644
--- a/be/src/service/query-options-test.cc
+++ b/be/src/service/query-options-test.cc
@@ -19,7 +19,6 @@
#include <boost/lexical_cast.hpp>
#include <inttypes.h>
-#include <gtest/gtest.h>
#include <string>
#include <gutil/strings/substitute.h>
@@ -135,8 +134,4 @@ TEST(QueryOptions, ParseQueryOptions) {
}
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- MemInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/service/session-expiry-test.cc
----------------------------------------------------------------------
diff --git a/be/src/service/session-expiry-test.cc b/be/src/service/session-expiry-test.cc
index 281d961..01a17eb 100644
--- a/be/src/service/session-expiry-test.cc
+++ b/be/src/service/session-expiry-test.cc
@@ -15,15 +15,14 @@
// specific language governing permissions and limitations
// under the License.
-#include <boost/scoped_ptr.hpp>
#include <string>
+#include <boost/scoped_ptr.hpp>
-#include "testutil/gtest-util.h"
#include "rpc/thrift-client.h"
+#include "service/fe-support.h"
#include "service/impala-server.h"
+#include "testutil/gtest-util.h"
#include "testutil/in-process-servers.h"
-#include "common/init.h"
-#include "service/fe-support.h"
#include "util/impalad-metrics.h"
#include "util/time.h"
@@ -99,8 +98,8 @@ TEST(SessionTest, TestExpiry) {
}
int main(int argc, char** argv) {
- InitCommonRuntime(argc, argv, true);
- InitFeSupport();
::testing::InitGoogleTest(&argc, argv);
+ impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
+ InitFeSupport();
return RUN_ALL_TESTS();
}
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/testutil/gtest-util.h
----------------------------------------------------------------------
diff --git a/be/src/testutil/gtest-util.h b/be/src/testutil/gtest-util.h
index a984953..20401ff 100644
--- a/be/src/testutil/gtest-util.h
+++ b/be/src/testutil/gtest-util.h
@@ -19,6 +19,7 @@
#define IMPALA_TESTUTIL_GTEST_UTIL_H_
#include <gtest/gtest.h>
+#include "common/init.h"
#include "common/status.h"
namespace impala {
@@ -28,5 +29,14 @@ namespace impala {
#define ASSERT_OK(status) ASSERT_TRUE(status.ok()) << "Error: " << status.GetDetail();
#define EXPECT_ERROR(status, err) EXPECT_EQ(status.code(), err);
+// Basic main() function to be used in gtest unit tests. Does not start a JVM and does
+// not initialize the FE.
+#define IMPALA_TEST_MAIN() \
+ int main(int argc, char** argv) { \
+ ::testing::InitGoogleTest(&argc, argv); \
+ impala::InitCommonRuntime(argc, argv, false, impala::TestInfo::BE_TEST); \
+ return RUN_ALL_TESTS(); \
+ } \
+
}
#endif // IMPALA_TESTUTIL_GTEST_UTIL_H_
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/udf/uda-test.cc
----------------------------------------------------------------------
diff --git a/be/src/udf/uda-test.cc b/be/src/udf/uda-test.cc
index 6dacc38..6f21699 100644
--- a/be/src/udf/uda-test.cc
+++ b/be/src/udf/uda-test.cc
@@ -16,11 +16,10 @@
// under the License.
#include <iostream>
-#include <gtest/gtest.h>
-#include "common/init.h"
#include "common/logging.h"
#include "udf/uda-test-harness.h"
+#include "testutil/gtest-util.h"
#include "testutil/test-udas.h"
#include "common/names.h"
@@ -314,8 +313,4 @@ TEST(MemTest, Basic) {
EXPECT_FALSE(test_leak.Execute(input, BigIntVal(100))) << test.GetErrorMsg();
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- InitCommonRuntime(argc, argv, false, TestInfo::BE_TEST);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/udf/udf-test.cc
----------------------------------------------------------------------
diff --git a/be/src/udf/udf-test.cc b/be/src/udf/udf-test.cc
index 5e08306..d35ca48 100644
--- a/be/src/udf/udf-test.cc
+++ b/be/src/udf/udf-test.cc
@@ -15,14 +15,13 @@
// specific language governing permissions and limitations
// under the License.
-#include <gtest/gtest.h>
#include <iostream>
#include <boost/date_time/posix_time/posix_time.hpp>
-#include "common/init.h"
#include "common/logging.h"
#include "runtime/multi-precision.h"
#include "testutil/test-udfs.h"
+#include "testutil/gtest-util.h"
#include "udf/udf-test-harness.h"
#include "common/names.h"
@@ -281,8 +280,4 @@ TEST(UdfTest, MemTest) {
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- InitCommonRuntime(argc, argv, false, TestInfo::BE_TEST);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/benchmark-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/benchmark-test.cc b/be/src/util/benchmark-test.cc
index 2ef94cd..2c33e3b 100644
--- a/be/src/util/benchmark-test.cc
+++ b/be/src/util/benchmark-test.cc
@@ -18,11 +18,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
-#include <gtest/gtest.h>
#include "common/object-pool.h"
+#include "testutil/gtest-util.h"
#include "util/benchmark.h"
-#include "util/cpu-info.h"
#include "common/names.h"
@@ -73,8 +72,4 @@ TEST(BenchmarkTest, Basic) {
}
-int main(int argc, char **argv) {
- impala::CpuInfo::Init();
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/bit-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/bit-util-test.cc b/be/src/util/bit-util-test.cc
index a7a1b85..0c0db8b 100644
--- a/be/src/util/bit-util-test.cc
+++ b/be/src/util/bit-util-test.cc
@@ -22,9 +22,9 @@
#include <limits.h>
#include <boost/utility.hpp>
-#include <gtest/gtest.h>
#include "gutil/bits.h"
+#include "testutil/gtest-util.h"
#include "util/bit-util.h"
#include "util/cpu-info.h"
@@ -267,8 +267,4 @@ TEST(BitUtil, RoundUpDown) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/bitmap-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/bitmap-test.cc b/be/src/util/bitmap-test.cc
index 23344b8..238b5fc 100644
--- a/be/src/util/bitmap-test.cc
+++ b/be/src/util/bitmap-test.cc
@@ -19,11 +19,10 @@
#include <stdio.h>
#include <iostream>
#include <limits.h>
-
#include <boost/utility.hpp>
-#include <gtest/gtest.h>
+
+#include "testutil/gtest-util.h"
#include "util/bitmap.h"
-#include "util/cpu-info.h"
#include "common/names.h"
@@ -176,8 +175,4 @@ TEST(Bitmap, MemUsage) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/blocking-queue-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/blocking-queue-test.cc b/be/src/util/blocking-queue-test.cc
index e3d808b..f45853a 100644
--- a/be/src/util/blocking-queue-test.cc
+++ b/be/src/util/blocking-queue-test.cc
@@ -19,9 +19,9 @@
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <glog/logging.h>
-#include <gtest/gtest.h>
#include <unistd.h>
+#include "testutil/gtest-util.h"
#include "util/blocking-queue.h"
#include "common/names.h"
@@ -154,8 +154,4 @@ TEST(BlockingQueueTest, TestMultipleThreads) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::OsInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/bloom-filter-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/bloom-filter-test.cc b/be/src/util/bloom-filter-test.cc
index f86e2eb..d47a7e0 100644
--- a/be/src/util/bloom-filter-test.cc
+++ b/be/src/util/bloom-filter-test.cc
@@ -21,9 +21,7 @@
#include <unordered_set>
#include <vector>
-#include <gtest/gtest.h>
-
-#include "util/cpu-info.h"
+#include "testutil/gtest-util.h"
using namespace std;
@@ -287,9 +285,4 @@ TEST(BloomFilter, ThriftOr) {
} // namespace impala
-int main(int argc, char** argv) {
- using namespace impala;
- CpuInfo::Init();
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/coding-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/coding-util-test.cc b/be/src/util/coding-util-test.cc
index 76a5e68..20ca9a8 100644
--- a/be/src/util/coding-util-test.cc
+++ b/be/src/util/coding-util-test.cc
@@ -18,9 +18,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
-#include <gtest/gtest.h>
#include "common/logging.h"
+#include "testutil/gtest-util.h"
#include "util/coding-util.h"
#include "common/names.h"
@@ -120,7 +120,4 @@ TEST(HtmlEscapingTest, Basic) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/debug-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/debug-util-test.cc b/be/src/util/debug-util-test.cc
index a4f58fe..002d628 100644
--- a/be/src/util/debug-util-test.cc
+++ b/be/src/util/debug-util-test.cc
@@ -19,7 +19,7 @@
#include <stdio.h>
#include <iostream>
-#include <gtest/gtest.h>
+#include "testutil/gtest-util.h"
#include "util/debug-util.h"
#include "common/names.h"
@@ -91,7 +91,4 @@ TEST(DebugUtil, PreCDH5QueryIdParsing) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/decompress-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/decompress-test.cc b/be/src/util/decompress-test.cc
index f139c39..48d17c4 100644
--- a/be/src/util/decompress-test.cc
+++ b/be/src/util/decompress-test.cc
@@ -19,12 +19,13 @@
#include <stdio.h>
#include <iostream>
-#include "testutil/gtest-util.h"
+#include "gen-cpp/Descriptors_types.h"
+
#include "runtime/mem-tracker.h"
#include "runtime/mem-pool.h"
+#include "testutil/gtest-util.h"
#include "util/decompress.h"
#include "util/compress.h"
-#include "gen-cpp/Descriptors_types.h"
#include "common/names.h"
@@ -375,6 +376,7 @@ TEST_F(DecompressorTest, Impala1506) {
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
+ impala::InitCommonRuntime(argc, argv, false, impala::TestInfo::BE_TEST);
int rand_seed = time(NULL);
LOG(INFO) << "rand_seed: " << rand_seed;
srand(rand_seed);
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/dict-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/dict-test.cc b/be/src/util/dict-test.cc
index 10d5e3d..39cba66 100644
--- a/be/src/util/dict-test.cc
+++ b/be/src/util/dict-test.cc
@@ -19,13 +19,10 @@
#include <stdio.h>
#include <iostream>
-#include <gtest/gtest.h>
-
-#include "common/init.h"
#include "runtime/mem-tracker.h"
#include "runtime/string-value.inline.h"
#include "runtime/timestamp-value.h"
-#include "testutil/test-macros.h"
+#include "testutil/gtest-util.h"
#include "util/dict-encoding.h"
#include "common/names.h"
@@ -165,11 +162,6 @@ TEST(DictTest, TestStringBufferOverrun) {
ASSERT_FALSE(decoder.Reset(buffer, sizeof(buffer), 0));
}
-
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/error-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/error-util-test.cc b/be/src/util/error-util-test.cc
index 5e976fe..2390630 100644
--- a/be/src/util/error-util-test.cc
+++ b/be/src/util/error-util-test.cc
@@ -15,13 +15,14 @@
// specific language governing permissions and limitations
// under the License.
-#include <gtest/gtest.h>
#include <gutil/strings/substitute.h>
-#include "error-util.h"
#include "gen-cpp/Status_types.h"
#include "gen-cpp/ErrorCodes_types.h"
+#include "error-util.h"
+#include "testutil/gtest-util.h"
+
namespace impala {
TEST(ErrorMsg, GenericFormatting) {
@@ -134,7 +135,4 @@ TEST(ErrorMsg, PrintMap) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/filesystem-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/filesystem-util-test.cc b/be/src/util/filesystem-util-test.cc
index 0a8b545..5214483 100644
--- a/be/src/util/filesystem-util-test.cc
+++ b/be/src/util/filesystem-util-test.cc
@@ -20,9 +20,8 @@
#include <boost/filesystem.hpp>
#include <sys/stat.h>
-#include "testutil/gtest-util.h"
-#include "common/init.h"
#include "common/logging.h"
+#include "testutil/gtest-util.h"
#include "util/test-info.h"
#include "common/names.h"
@@ -65,7 +64,4 @@ TEST(FilesystemUtil, RemoveAndCreateDirectory) {
filesystem::remove_all(dir);
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/fixed-size-hash-table-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/fixed-size-hash-table-test.cc b/be/src/util/fixed-size-hash-table-test.cc
index 4d8722f..211693f 100644
--- a/be/src/util/fixed-size-hash-table-test.cc
+++ b/be/src/util/fixed-size-hash-table-test.cc
@@ -15,8 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-#include <gtest/gtest.h>
-#include "util/cpu-info.h"
+#include "testutil/gtest-util.h"
#include "util/fixed-size-hash-table.h"
#include "common/names.h"
@@ -80,8 +79,4 @@ TEST(FixedSizeHash, TestAllOperations) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/internal-queue-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/internal-queue-test.cc b/be/src/util/internal-queue-test.cc
index a6e18c2..7566969 100644
--- a/be/src/util/internal-queue-test.cc
+++ b/be/src/util/internal-queue-test.cc
@@ -22,6 +22,7 @@
#include <gtest/gtest.h>
#include <unistd.h>
+#include "common/init.h"
#include "common/atomic.h"
#include "util/internal-queue.h"
@@ -302,7 +303,7 @@ int main(int argc, char **argv) {
cerr << "Internal Queue Test Skipped" << endl;
return 0;
#endif
- google::InitGoogleLogging(argv[0]);
::testing::InitGoogleTest(&argc, argv);
+ impala::InitCommonRuntime(argc, argv, false, impala::TestInfo::BE_TEST);
return RUN_ALL_TESTS();
}
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/logging-support-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/logging-support-test.cc b/be/src/util/logging-support-test.cc
index 5916bd8..96da519 100644
--- a/be/src/util/logging-support-test.cc
+++ b/be/src/util/logging-support-test.cc
@@ -16,14 +16,12 @@
// under the License.
#include <iostream>
-
-#include "logging-support.h"
-
#include <boost/filesystem.hpp>
#include <ctime>
#include "testutil/gtest-util.h"
#include "util/filesystem-util.h"
+#include "util/logging-support.h"
using namespace impala;
namespace filesystem = boost::filesystem;
@@ -95,7 +93,4 @@ TEST(LoggingSupport, DeleteOldLogs) {
filesystem::remove_all(dir);
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/lru-cache-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/lru-cache-test.cc b/be/src/util/lru-cache-test.cc
index efaffac..993d9df 100644
--- a/be/src/util/lru-cache-test.cc
+++ b/be/src/util/lru-cache-test.cc
@@ -19,10 +19,9 @@
#include <boost/thread.hpp>
#include <glog/logging.h>
-#include <gtest/gtest.h>
-#include "common/init.h"
#include "common/logging.h"
+#include "testutil/gtest-util.h"
#include "util/test-info.h"
#include "common/names.h"
@@ -152,7 +151,4 @@ TEST(FifoMultimap, PopShouldPopMostRecent) {
ASSERT_EQ(0, c.size());
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/metrics-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/metrics-test.cc b/be/src/util/metrics-test.cc
index 8a0f983..592382e 100644
--- a/be/src/util/metrics-test.cc
+++ b/be/src/util/metrics-test.cc
@@ -16,13 +16,12 @@
// under the License.
#include <cmath>
-#include <gtest/gtest.h>
#include <boost/scoped_ptr.hpp>
#include <limits>
#include <map>
+#include "testutil/gtest-util.h"
#include "util/collection-metrics.h"
-#include "util/jni-util.h"
#include "util/memory-metrics.h"
#include "util/metrics.h"
#include "util/thread.h"
@@ -379,11 +378,8 @@ TEST_F(MetricsTest, MetricGroupJson) {
}
-int main(int argc, char **argv) {
- google::InitGoogleLogging(argv[0]);
+int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
- impala::InitThreading();
- impala::JniUtil::Init();
-
+ impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
return RUN_ALL_TESTS();
}
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/parse-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/parse-util-test.cc b/be/src/util/parse-util-test.cc
index 6bb0193..971e118 100644
--- a/be/src/util/parse-util-test.cc
+++ b/be/src/util/parse-util-test.cc
@@ -20,9 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
-#include <gtest/gtest.h>
-
-#include "common/init.h"
+#include "testutil/gtest-util.h"
#include "util/mem-info.h"
#include "util/parse-util.h"
@@ -117,8 +115,4 @@ TEST(ParseMemSpecs, Basic) {
}
-int main(int argc, char **argv) {
- impala::InitCommonRuntime(argc, argv, false);
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/perf-counters-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/perf-counters-test.cc b/be/src/util/perf-counters-test.cc
index 0ef6190..3c0120f 100644
--- a/be/src/util/perf-counters-test.cc
+++ b/be/src/util/perf-counters-test.cc
@@ -18,8 +18,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
-#include <gtest/gtest.h>
-#include "common/init.h"
+
+#include "testutil/gtest-util.h"
#include "util/disk-info.h"
#include "util/perf-counters.h"
@@ -63,9 +63,4 @@ TEST(DiskInfoTest, Basic) {
}
-int main(int argc, char **argv) {
- InitCommonRuntime(argc, argv, false);
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
-
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/pretty-printer-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/pretty-printer-test.cc b/be/src/util/pretty-printer-test.cc
index 8b5ffab..fbf9827 100644
--- a/be/src/util/pretty-printer-test.cc
+++ b/be/src/util/pretty-printer-test.cc
@@ -18,8 +18,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
-#include <gtest/gtest.h>
+#include "testutil/gtest-util.h"
#include "util/pretty-printer.h"
#include "common/names.h"
@@ -134,9 +134,4 @@ TEST(PrettyPrinterTest, StringList) {
}
-int main(int argc, char **argv) {
- google::InitGoogleLogging(argv[0]);
- ::testing::InitGoogleTest(&argc, argv);
- impala::CpuInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/promise-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/promise-test.cc b/be/src/util/promise-test.cc
index c353803..1ce77c0 100644
--- a/be/src/util/promise-test.cc
+++ b/be/src/util/promise-test.cc
@@ -16,10 +16,10 @@
// under the License.
#include <boost/thread.hpp>
-#include <gtest/gtest.h>
-#include <runtime/timestamp-value.h>
#include <sys/resource.h>
+#include "runtime/timestamp-value.h"
+#include "testutil/gtest-util.h"
#include "util/promise.h"
#include "util/time.h"
@@ -90,6 +90,8 @@ TEST(PromiseDeathTest, RepeatedSetTest) {
}
int main(int argc, char **argv) {
+ // TODO: This test does not log into the logs/be_tests directory, but using the
+ // standard via InitCommonRuntime() causes the test to fail.
google::InitGoogleLogging(argv[0]);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/redactor-config-parser-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/redactor-config-parser-test.cc b/be/src/util/redactor-config-parser-test.cc
index 956615e..582169a 100644
--- a/be/src/util/redactor-config-parser-test.cc
+++ b/be/src/util/redactor-config-parser-test.cc
@@ -17,10 +17,8 @@
#include "redactor.h"
#include "redactor.detail.h"
-
-#include <gtest/gtest.h>
-
#include "redactor-test-utils.h"
+#include "testutil/gtest-util.h"
namespace impala {
@@ -184,7 +182,4 @@ TEST(ParserTest, RuleNumberInErrorMessage) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/redactor-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/redactor-test.cc b/be/src/util/redactor-test.cc
index 51a090e..24f8bc0 100644
--- a/be/src/util/redactor-test.cc
+++ b/be/src/util/redactor-test.cc
@@ -23,9 +23,8 @@
#include <pthread.h>
#include <unistd.h> // cpu info
-#include <gtest/gtest.h>
-
#include "redactor-test-utils.h"
+#include "testutil/gtest-util.h"
namespace impala {
@@ -330,7 +329,4 @@ TEST(RedactorTest, MultiThreaded) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/redactor-unconfigured-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/redactor-unconfigured-test.cc b/be/src/util/redactor-unconfigured-test.cc
index 0f0ae68..e8e46e2 100644
--- a/be/src/util/redactor-unconfigured-test.cc
+++ b/be/src/util/redactor-unconfigured-test.cc
@@ -17,10 +17,8 @@
#include "redactor.h"
#include "redactor.detail.h"
-
-#include <gtest/gtest.h>
-
#include "redactor-test-utils.h"
+#include "testutil/gtest-util.h"
namespace impala {
@@ -34,7 +32,4 @@ TEST(RedactorTest, Unconfigured) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/rle-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/rle-test.cc b/be/src/util/rle-test.cc
index fd429eb..0e0368c 100644
--- a/be/src/util/rle-test.cc
+++ b/be/src/util/rle-test.cc
@@ -20,10 +20,9 @@
#include <iostream>
#include <boost/utility.hpp>
-#include <gtest/gtest.h>
#include <math.h>
-#include "common/init.h"
+#include "testutil/gtest-util.h"
#include "util/rle-encoding.h"
#include "util/bit-stream-utils.inline.h"
@@ -447,9 +446,4 @@ TEST(Rle, ZeroLiteralOrRepeatCount) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
- return RUN_ALL_TESTS();
-}
-
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/runtime-profile-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/runtime-profile-test.cc b/be/src/util/runtime-profile-test.cc
index 5e9f973..6910ac9 100644
--- a/be/src/util/runtime-profile-test.cc
+++ b/be/src/util/runtime-profile-test.cc
@@ -18,10 +18,10 @@
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
-#include <gtest/gtest.h>
#include <boost/bind.hpp>
+
#include "common/object-pool.h"
-#include "util/cpu-info.h"
+#include "testutil/gtest-util.h"
#include "util/periodic-counter-updater.h"
#include "util/runtime-profile-counters.h"
#include "util/streaming-sampler.h"
@@ -690,10 +690,4 @@ TEST(TimerCounterTest, CountersTestRandom) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::InitThreading();
- impala::CpuInfo::Init();
- impala::OsInfo::Init();
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/runtime-profile.cc
----------------------------------------------------------------------
diff --git a/be/src/util/runtime-profile.cc b/be/src/util/runtime-profile.cc
index 5134804..58ab501 100644
--- a/be/src/util/runtime-profile.cc
+++ b/be/src/util/runtime-profile.cc
@@ -29,7 +29,6 @@
#include "util/coding-util.h"
#include "util/compress.h"
#include "util/container-util.h"
-#include "util/cpu-info.h"
#include "util/debug-util.h"
#include "util/periodic-counter-updater.h"
#include "util/redactor.h"
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/string-parser-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/string-parser-test.cc b/be/src/util/string-parser-test.cc
index 6d4007b..f3133eb 100644
--- a/be/src/util/string-parser-test.cc
+++ b/be/src/util/string-parser-test.cc
@@ -19,9 +19,9 @@
#include <stdio.h>
#include <iostream>
#include <limits>
-#include <gtest/gtest.h>
#include <boost/cstdint.hpp>
#include <boost/lexical_cast.hpp>
+#include "testutil/gtest-util.h"
#include "util/string-parser.h"
#include "common/names.h"
@@ -505,7 +505,4 @@ TEST(StringToBool, Basic) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/symbols-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/symbols-util-test.cc b/be/src/util/symbols-util-test.cc
index f0c2cca..a00fc94 100644
--- a/be/src/util/symbols-util-test.cc
+++ b/be/src/util/symbols-util-test.cc
@@ -18,8 +18,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
-#include <gtest/gtest.h>
+#include "testutil/gtest-util.h"
#include "util/symbols-util.h"
#include "common/names.h"
@@ -324,7 +324,4 @@ TEST(SymbolsUtil, ManglingPrepareOrClose) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/thread-pool-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/thread-pool-test.cc b/be/src/util/thread-pool-test.cc
index 0d1465f..edfe881 100644
--- a/be/src/util/thread-pool-test.cc
+++ b/be/src/util/thread-pool-test.cc
@@ -18,11 +18,10 @@
#include <boost/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <glog/logging.h>
-#include <gtest/gtest.h>
#include <unistd.h>
-#include "common/init.h"
#include "common/logging.h"
+#include "testutil/gtest-util.h"
#include "util/thread-pool.h"
#include "common/names.h"
@@ -70,8 +69,4 @@ TEST(ThreadPoolTest, BasicTest) {
}
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
- impala::InitCommonRuntime(argc, argv, true, impala::TestInfo::BE_TEST);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/uid-util-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/uid-util-test.cc b/be/src/util/uid-util-test.cc
index a789562..ebbc5eb 100644
--- a/be/src/util/uid-util-test.cc
+++ b/be/src/util/uid-util-test.cc
@@ -18,8 +18,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
-#include <gtest/gtest.h>
+#include "testutil/gtest-util.h"
#include "util/uid-util.h"
namespace impala {
@@ -43,7 +43,4 @@ TEST(UidUtil, FragmentInstanceId) {
}
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
-}
+IMPALA_TEST_MAIN();
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/f4bbd415/be/src/util/webserver-test.cc
----------------------------------------------------------------------
diff --git a/be/src/util/webserver-test.cc b/be/src/util/webserver-test.cc
index 6e6007f..d5a1b6d 100644
--- a/be/src/util/webserver-test.cc
+++ b/be/src/util/webserver-test.cc
@@ -345,8 +345,8 @@ TEST(Webserver, NullCharTest) {
int main(int argc, char **argv) {
- InitCommonRuntime(argc, argv, false, TestInfo::BE_TEST);
::testing::InitGoogleTest(&argc, argv);
+ InitCommonRuntime(argc, argv, false, TestInfo::BE_TEST);
FLAGS_webserver_port = 27890;
return RUN_ALL_TESTS();
}