#!/usr/bin/env python

import os
import sys

# In the Android tree, use the environment variables set by envsetup.sh
# to determine correct path for the root of the source tree.
# TODO: To run clang tests, @LLVM_BINARY_DIR@ must be substituted also.
android_source_root = os.getenv('ANDROID_BUILD_TOP', ".")
llvm_source_root = os.path.join(android_source_root, 'external', 'llvm')
libspirv_source_root = os.path.join(android_source_root, 'external', 'spirv-llvm',
  'tools', 'llvm-spirv')

# Make sure we can find the lit package.
sys.path.append(os.path.join(llvm_source_root, 'utils', 'lit'))

# Set up some builtin parameters, so that by default the LLVM test suite
# configuration file knows how to find the object tree.
builtin_parameters = {
    'llvm_site_config' : os.path.join(libspirv_source_root, 'test',
                                      'lit.site.cfg')
    }

if __name__=='__main__':
    import lit
    lit.main(builtin_parameters)