mirror of
https://github.com/apache/impala.git
synced 2025-12-19 18:12:08 -05:00
There are 100+ backend tests and each requires 400+ MB of disk space when statically linked (the default). This requires a large amount of disk space and adds considerable link time. This introduces a framework to link multiple backend tests into a single executable. Currently it does this for several tests in be/src/util. It saves about 10GB of space. It maintains several of the same properties that the current tests have: 1. "make <testname>" rebuilds that test. 2. It generates an executable shell script with the same name as the original backend test that runs the same subset of tests. 3. It generates JUnitXML and log files with names that match the test name. 4. One can run the shell script with "--gtest_filter" and run a subset of the tests. 5. ctest commands such as ctest -R continue to function. It validates at build time that every test linked into the unified executable is covered by an equivalent test filter pattern. This means that every test in the unified executable will run as part of normal testing. Introducing the framework along with a limited number of trial backend tests gives us a chance to evaluate this change before continuing to convert tests. Change-Id: Ia03ef38719b1fbc0fe2025e16b7b3d3dd4488842 Reviewed-on: http://gerrit.cloudera.org:8080/12124 Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
68 lines
2.6 KiB
Python
Executable File
68 lines
2.6 KiB
Python
Executable File
#!/usr/bin/env python
|
|
#
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
# or more contributor license agreements. See the NOTICE file
|
|
# distributed with this work for additional information
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
# to you under the Apache License, Version 2.0 (the
|
|
# "License"); you may not use this file except in compliance
|
|
# with the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing,
|
|
# software distributed under the License is distributed on an
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
# KIND, either express or implied. See the License for the
|
|
# specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
import subprocess
|
|
import sys
|
|
from optparse import OptionParser
|
|
|
|
|
|
def get_set_of_tests(unified_binary, filters):
|
|
# Run the unified_binary with the specified filters. If filters is None, run
|
|
# without filters. Process the output to get fully qualified tests.
|
|
command = [unified_binary, "--gtest_list_tests"]
|
|
if filters is not None:
|
|
command.append("--gtest_filter={0}".format(filters))
|
|
p = subprocess.Popen(command, stdout=subprocess.PIPE)
|
|
out, err = p.communicate()
|
|
test_list = set()
|
|
cur_test_suite = None
|
|
for line in out.split("\n"):
|
|
if line.find("seed = ") != -1: continue
|
|
if len(line) == 0: continue
|
|
if line[-1] == ".":
|
|
cur_test_suite = line
|
|
else:
|
|
testcase = line.strip()
|
|
test_list.add("{0}{1}".format(cur_test_suite, testcase))
|
|
return test_list
|
|
|
|
|
|
def main():
|
|
parser = OptionParser()
|
|
parser.add_option("-f", "--filters", dest="filters",
|
|
help="Aggregation of all gtest filters")
|
|
parser.add_option("-b", "--unified_binary", dest="unified_binary",
|
|
help="Filename for the unified test binary")
|
|
options, args = parser.parse_args()
|
|
without_filter = get_set_of_tests(options.unified_binary, None)
|
|
with_filter = get_set_of_tests(options.unified_binary, options.filters)
|
|
|
|
assert with_filter.issubset(without_filter)
|
|
if without_filter != with_filter:
|
|
print("FAILED: The unified backend test executable contains tests that are\n"
|
|
"missing from the CMake test filters:")
|
|
for tests in without_filter - with_filter:
|
|
print(tests)
|
|
print("Unified test executable: {0}\nFilters: {1}".format(
|
|
options.unified_binary, options.filters))
|
|
sys.exit(1)
|
|
|
|
|
|
if __name__ == "__main__": main()
|