IMPALA-8071: Initial unified backend test framework

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>
This commit is contained in:
Joe McDonnell
2018-12-21 14:58:23 -08:00
parent d0c1030950
commit 3ce34a81b2
48 changed files with 548 additions and 192 deletions

View File

@@ -0,0 +1,65 @@
#!/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.
"""
Some tests that produce JUnitXML include tests that did not run (i.e. status="notrun").
This script walks through the JUnitXML and removes these elements.
"""
from optparse import OptionParser
from xml.etree.ElementTree import ElementTree
def junitxml_prune_notrun(junitxml_filename):
tree = ElementTree()
root = tree.parse(junitxml_filename)
for testsuite in root.findall("testsuite"):
# Get the list of notrun tests
notrun_testcases = []
for testcase in testsuite:
status = testcase.attrib["status"]
if status == 'notrun':
notrun_testcases.append(testcase)
# Get the total number of tests
num_tests = int(testsuite.attrib["tests"])
# There are two cases.
# 1. No test from the testsuite ran. The whole testsuite can be pruned.
# 2. Some test from the testsuite ran. The individual testcases can be pruned.
if len(notrun_testcases) == num_tests:
# Remove whole testsuite
root.remove(testsuite)
else:
# Remote individual testcases.
for testcase in notrun_testcases:
testsuite.remove(testcase)
# Fixup the total number of tests
testsuite.attrib["tests"] = str(num_tests - len(notrun_testcases))
# Write out the pruned JUnitXML
tree.write(junitxml_filename, encoding="utf-8", xml_declaration=True)
def main():
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename", help="JUnitXML file to prune")
options, args = parser.parse_args()
junitxml_prune_notrun(options.filename)
if __name__ == "__main__": main()