Move test invocation into a python script.
Invoking these from make was pretty gross, and apparently I was getting it wrong for the buildbot (was running mmm buildcmds without running configtests). This makes a single entry point of run-tests.py. The ugly hacks for cflags/ldflags detection is still there, but it's at least not *as* bad. Change-Id: I0157700d83f6a38a209751a03a00dc9a8e708744
This commit is contained in:
55
Android.mk
55
Android.mk
@@ -115,57 +115,8 @@ endif
|
|||||||
|
|
||||||
include $(BUILD_HOST_SHARED_LIBRARY)
|
include $(BUILD_HOST_SHARED_LIBRARY)
|
||||||
|
|
||||||
LIT := $(ANDROID_BUILD_TOP)/external/llvm/utils/lit/lit.py
|
ifdef LIBCXX_TESTING
|
||||||
LIBCXX_CONFIGTESTS := $(ANDROID_BUILD_TOP)/external/libcxx/buildcmds/configtests.py
|
include $(LOCAL_PATH)/buildcmds/Android.mk
|
||||||
LIBCXX_TEST_MK := $(ANDROID_BUILD_TOP)/external/libcxx/test.mk
|
endif
|
||||||
|
|
||||||
test-libcxx-target: test-libcxx-target-clang
|
|
||||||
test-libcxx-host: test-libcxx-host-clang
|
|
||||||
|
|
||||||
test-libcxx-target-clang: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --compiler=clang
|
|
||||||
LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
|
|
||||||
test-libcxx-target-gcc: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --compiler=gcc
|
|
||||||
LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
|
|
||||||
test-libcxx-target-clang-32: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --bitness=32 --compiler=clang
|
|
||||||
LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
|
|
||||||
test-libcxx-target-gcc-32: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --bitness=32 --compiler=gcc
|
|
||||||
LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
|
|
||||||
test-libcxx-target-clang-64: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --bitness=64 --compiler=clang
|
|
||||||
LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
|
|
||||||
test-libcxx-target-gcc-64: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --bitness=64 --compiler=gcc
|
|
||||||
LIT=$(LIT) LIT_MODE=device make -f $(LIBCXX_TEST_MK)
|
|
||||||
|
|
||||||
test-libcxx-host-clang: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --compiler=clang --host
|
|
||||||
LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
|
|
||||||
test-libcxx-host-gcc: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --compiler=gcc --host
|
|
||||||
LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
|
|
||||||
test-libcxx-host-clang-32: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --bitness=32 --compiler=clang --host
|
|
||||||
LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
|
|
||||||
test-libcxx-host-gcc-32: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --bitness=32 --compiler=gcc --host
|
|
||||||
LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
|
|
||||||
test-libcxx-host-clang-64: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --bitness=64 --compiler=clang --host
|
|
||||||
LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
|
|
||||||
test-libcxx-host-gcc-64: libc++
|
|
||||||
python $(LIBCXX_CONFIGTESTS) --bitness=64 --compiler=gcc --host
|
|
||||||
LIT=$(LIT) LIT_MODE=host make -f $(LIBCXX_TEST_MK)
|
|
||||||
|
|
||||||
# Don't want to just make test-libcxx-(host|target) dependencies of this because
|
|
||||||
# the two families can't be run concurrently.
|
|
||||||
test-libcxx: libc++
|
|
||||||
python buildcmds/configtests.py --host
|
|
||||||
LIT=$(LIT) LIT_MODE=host make -f $(ANDROID_BUILD_TOP)/external/libcxx/test.mk
|
|
||||||
python buildcmds/configtests.py
|
|
||||||
LIT=$(LIT) LIT_MODE=device make -f $(ANDROID_BUILD_TOP)/external/libcxx/test.mk
|
|
||||||
|
|
||||||
endif # TARGET_BUILD_APPS
|
endif # TARGET_BUILD_APPS
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
from __future__ import print_function
|
|
||||||
import getopt
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
try:
|
|
||||||
opts, _ = getopt.getopt(sys.argv[1:], '', [
|
|
||||||
'bitness=', 'compiler=', 'host'])
|
|
||||||
except getopt.GetoptError as err:
|
|
||||||
sys.exit(err)
|
|
||||||
|
|
||||||
bitness = None
|
|
||||||
compiler = 'clang'
|
|
||||||
host = False
|
|
||||||
for opt, val in opts:
|
|
||||||
if opt == '--bitness':
|
|
||||||
bitness = int(val)
|
|
||||||
if bitness not in (32, 64):
|
|
||||||
sys.exit('Invalid bitness: {}'.format(bitness))
|
|
||||||
elif opt == '--compiler':
|
|
||||||
if val not in ('clang', 'gcc'):
|
|
||||||
sys.exit('Unknown compiler: {}'.format(val))
|
|
||||||
compiler = val
|
|
||||||
elif opt == '--host':
|
|
||||||
host = True
|
|
||||||
else:
|
|
||||||
raise NotImplementedError('unhandled option: {}'.format(opt))
|
|
||||||
|
|
||||||
with open('external/libcxx/buildcmds/testconfig.mk', 'w') as test_config:
|
|
||||||
if compiler == 'clang':
|
|
||||||
print('LOCAL_CLANG := true', file=test_config)
|
|
||||||
elif compiler == 'gcc':
|
|
||||||
print('LOCAL_CLANG := false', file=test_config)
|
|
||||||
|
|
||||||
if bitness == 32:
|
|
||||||
print('LOCAL_MULTILIB := 32', file=test_config)
|
|
||||||
elif bitness == 64:
|
|
||||||
print('LOCAL_MULTILIB := 64', file=test_config)
|
|
||||||
|
|
||||||
if compiler == 'clang':
|
|
||||||
print('LOCAL_CXX := $(LOCAL_PATH)/buildcmdscc $(CLANG_CXX)',
|
|
||||||
file=test_config)
|
|
||||||
else:
|
|
||||||
if host:
|
|
||||||
prefix = 'HOST_'
|
|
||||||
else:
|
|
||||||
prefix = 'TARGET_'
|
|
||||||
print('LOCAL_CXX := $(LOCAL_PATH)/buildcmdscc '
|
|
||||||
'$($(LOCAL_2ND_ARCH_VAR_PREFIX){}CXX)'.format(prefix),
|
|
||||||
file=test_config)
|
|
||||||
|
|
||||||
if host:
|
|
||||||
print('include $(BUILD_HOST_EXECUTABLE)', file=test_config)
|
|
||||||
else:
|
|
||||||
print('include $(BUILD_EXECUTABLE)', file=test_config)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
100
run-tests.py
Normal file
100
run-tests.py
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2015 The Android Open Source Project
|
||||||
|
#
|
||||||
|
# Licensed 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.
|
||||||
|
#
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
THIS_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
ANDROID_DIR = os.path.realpath(os.path.join(THIS_DIR, '../..'))
|
||||||
|
|
||||||
|
|
||||||
|
class ArgParser(argparse.ArgumentParser):
|
||||||
|
def __init__(self):
|
||||||
|
super(ArgParser, self).__init__()
|
||||||
|
self.add_argument(
|
||||||
|
'--compiler', choices=('clang', 'gcc'), default='clang')
|
||||||
|
self.add_argument(
|
||||||
|
'--bitness', choices=(32, 64), type=int, default=32)
|
||||||
|
self.add_argument('--host', action='store_true')
|
||||||
|
|
||||||
|
|
||||||
|
def gen_test_config(bitness, compiler, host):
|
||||||
|
testconfig_mk_path = os.path.join(THIS_DIR, 'buildcmds/testconfig.mk')
|
||||||
|
with open(testconfig_mk_path, 'w') as test_config:
|
||||||
|
if compiler == 'clang':
|
||||||
|
print('LOCAL_CLANG := true', file=test_config)
|
||||||
|
elif compiler == 'gcc':
|
||||||
|
print('LOCAL_CLANG := false', file=test_config)
|
||||||
|
|
||||||
|
if bitness == 32:
|
||||||
|
print('LOCAL_MULTILIB := 32', file=test_config)
|
||||||
|
elif bitness == 64:
|
||||||
|
print('LOCAL_MULTILIB := 64', file=test_config)
|
||||||
|
|
||||||
|
if compiler == 'clang':
|
||||||
|
print('LOCAL_CXX := $(LOCAL_PATH)/buildcmdscc $(CLANG_CXX)',
|
||||||
|
file=test_config)
|
||||||
|
else:
|
||||||
|
if host:
|
||||||
|
prefix = 'HOST_'
|
||||||
|
else:
|
||||||
|
prefix = 'TARGET_'
|
||||||
|
print('LOCAL_CXX := $(LOCAL_PATH)/buildcmdscc '
|
||||||
|
'$($(LOCAL_2ND_ARCH_VAR_PREFIX){}CXX)'.format(prefix),
|
||||||
|
file=test_config)
|
||||||
|
|
||||||
|
if host:
|
||||||
|
print('include $(BUILD_HOST_EXECUTABLE)', file=test_config)
|
||||||
|
else:
|
||||||
|
print('include $(BUILD_EXECUTABLE)', file=test_config)
|
||||||
|
|
||||||
|
|
||||||
|
def mmm(path):
|
||||||
|
makefile = os.path.join(path, 'Android.mk')
|
||||||
|
main_mk = 'build/core/main.mk'
|
||||||
|
|
||||||
|
env = dict(os.environ)
|
||||||
|
env['ONE_SHOT_MAKEFILE'] = makefile
|
||||||
|
env['LIBCXX_TESTING'] = 'true'
|
||||||
|
cmd = ['make', '-C', ANDROID_DIR, '-f', main_mk, 'all_modules']
|
||||||
|
subprocess.check_call(cmd, env=env)
|
||||||
|
|
||||||
|
|
||||||
|
def gen_build_cmds(bitness, compiler, host):
|
||||||
|
gen_test_config(bitness, compiler, host)
|
||||||
|
mmm(os.path.join(THIS_DIR, 'buildcmds'))
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args, lit_args = ArgParser().parse_known_args()
|
||||||
|
lit_path = os.path.join(ANDROID_DIR, 'external/llvm/utils/lit/lit.py')
|
||||||
|
gen_build_cmds(args.bitness, args.compiler, args.host)
|
||||||
|
|
||||||
|
mode_str = 'host' if args.host else 'device'
|
||||||
|
android_mode_arg = '--param=android_mode=' + mode_str
|
||||||
|
test_path = os.path.join(THIS_DIR, 'test')
|
||||||
|
|
||||||
|
lit_args = ['-sv', android_mode_arg] + lit_args
|
||||||
|
cmd = ['python', lit_path] + lit_args + [test_path]
|
||||||
|
sys.exit(subprocess.call(cmd))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user