Update run_tests.py to use Soong.

run_tests.py had bitrotted since it was last run (e.g. it used perl
which is now not allowed and the warning flags were out of date).
I changed it to use a different way of extracting the compile command
which is based on Soong instead of makefiles. This way is also
compatible with multiple build directories since it doesn't clobber
the source directory and doesn't require OUT_DIR == out.

This also changes run_tests.py to run the libcxxabi tests as well,
since they can be run using the same mechanism.

Bug: 120510768
Test: ./run_tests.py --bitness 32
Test: ./run_tests.py --bitness 64
Test: ./run_tests.py --bitness 64 --host
Change-Id: Id30129161f8519fa6c1bc106727326373ca9ab82
This commit is contained in:
Peter Collingbourne
2018-11-30 20:29:22 -08:00
committed by Dan Albert
parent 20fc590391
commit 26cd9b82f8
12 changed files with 158 additions and 168 deletions

View File

@@ -1,13 +0,0 @@
import os
import subprocess
def mm(path, android_build_top):
env = os.environ
env['ONE_SHOT_MAKEFILE'] = os.path.join(path, 'Android.mk')
cmd = [
'make', '-C', android_build_top, '-f', 'build/core/main.mk',
'MODULES-IN-' + path.replace('/', '-'), '-B'
]
return not subprocess.Popen(cmd, stdout=None, stderr=None, env=env).wait()

View File

@@ -2,7 +2,6 @@ import os
import re
import libcxx.test.config
import libcxx.android.build
import libcxx.android.compiler
import libcxx.android.test.format
@@ -10,11 +9,9 @@ import libcxx.android.test.format
class Configuration(libcxx.test.config.Configuration):
def __init__(self, lit_config, config):
super(Configuration, self).__init__(lit_config, config)
self.build_cmds_dir = None
def configure(self):
self.configure_src_root()
self.configure_build_cmds()
self.configure_obj_root()
self.configure_cxx()
@@ -32,34 +29,24 @@ class Configuration(libcxx.test.config.Configuration):
list(self.config.available_features))
def configure_obj_root(self):
test_config_file = os.path.join(self.build_cmds_dir, 'testconfig.mk')
if 'HOST_NATIVE_TEST' in open(test_config_file).read():
if self.lit_config.params.get('android_mode') == 'host':
self.libcxx_obj_root = os.getenv('ANDROID_HOST_OUT')
else:
self.libcxx_obj_root = os.getenv('ANDROID_PRODUCT_OUT')
def configure_build_cmds(self):
os.chdir(self.config.android_root)
self.build_cmds_dir = 'external/libcxx/buildcmds'
if not libcxx.android.build.mm(self.build_cmds_dir,
self.config.android_root):
raise RuntimeError('Could not generate build commands.')
def configure_cxx(self):
cxx_under_test_file = os.path.join(self.build_cmds_dir,
'cxx_under_test')
cxx_under_test = open(cxx_under_test_file).read().strip()
cxx_template_file = os.path.join(self.build_cmds_dir, 'cxx.cmds')
cxx_template = open(cxx_template_file).read().strip()
link_template_file = os.path.join(self.build_cmds_dir, 'link.cmds')
link_template = open(link_template_file).read().strip()
cxx_under_test = self.lit_config.params.get('cxx_under_test')
cxx_template = self.lit_config.params.get('cxx_template')
link_template = self.lit_config.params.get('link_template')
self.cxx = libcxx.android.compiler.AndroidCXXCompiler(
cxx_under_test, cxx_template, link_template)
def configure_triple(self):
# The libcxxabi test suite needs this but it doesn't actually
# use it for anything important.
self.config.host_triple = ''
self.config.target_triple = self.cxx.get_triple()
def configure_features(self):