From 32f68ff2fc05d35ed85c81b06b535b8b59bf2baf Mon Sep 17 00:00:00 2001 From: Alexander Penev Date: Thu, 30 Nov 2023 07:50:52 +0000 Subject: [PATCH] Fix pass params to llvm-config --- .github/workflows/ci.yml | 8 ++++++- test/lit.cfg | 49 ++++++++++++++++++++++++++-------------- 2 files changed, 39 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b38ba666..26f593a03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -694,11 +694,17 @@ jobs: if: ${{ runner.os != 'windows' }} run: | mkdir obj && cd obj + if [[ ${{ matrix.debug_build }} == "true" ]]; then + external_lit='-DLLVM_EXTERNAL_LIT="`which lit`"' + else + external_lit='' + fi + echo "external_lit='${external_lit}'" cmake -DClang_DIR="$PATH_TO_LLVM_BUILD" \ -DLLVM_DIR="$PATH_TO_LLVM_BUILD" \ -DCMAKE_BUILD_TYPE=$([[ -z "$BUILD_TYPE" ]] && echo RelWithDebInfo || echo $BUILD_TYPE) \ -DCODE_COVERAGE=${CODE_COVERAGE} \ - -DLLVM_EXTERNAL_LIT="`which lit`" \ + ${external_lit} \ $GITHUB_WORKSPACE \ ${{ matrix.extra_cmake_options }} diff --git a/test/lit.cfg b/test/lit.cfg index 4dd440702..176c0536e 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -5,10 +5,12 @@ import os import platform import re -import subprocess +#import subprocess -import lit.util import lit.formats +import lit.util + +from lit.llvm import llvm_config # name: The name of this test suite. config.name = 'clad' @@ -324,19 +326,32 @@ if libcudart_path is not None: if(config.have_enzyme): config.available_features.add('Enzyme') + +print(type(lit_config)) +print(type(config)) +print(type(llvm_config)) + +# Ask llvm-config about asserts +llvm_config.feature_config( + [ + ("--assertion-mode", {"ON": "asserts"}), + ("--build-mode", {"[Dd][Ee][Bb][Uu][Gg]": "debug"}), + ] +) + # Ask llvm-config about assertion mode and build-mode. -try: - llvm_config_cmd = subprocess.Popen( - [os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode', '--build-mode'], - stdout = subprocess.PIPE, - env=config.environment) -except OSError: - print("Could not find llvm-config in " + llvm_tools_dir) - exit(42) -res=llvm_config_cmd.stdout.read().decode('ascii') -llvm_config_cmd.wait() - -if re.search(r'ON', res): - config.available_features.add('asserts') -if re.search(r'[Dd][Ee][Bb][Uu][Gg]', res): - config.available_features.add('debug') +#try: +# llvm_config_cmd = subprocess.Popen( +# [os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode', '--build-mode'], +# stdout = subprocess.PIPE, +# env=config.environment) +#except OSError: +# print("Could not find llvm-config in " + llvm_tools_dir) +# exit(42) +#res=llvm_config_cmd.stdout.read().decode('ascii') +#llvm_config_cmd.wait() +# +#if re.search(r'ON', res): +# config.available_features.add('asserts') +#if re.search(r'[Dd][Ee][Bb][Uu][Gg]', res): +# config.available_features.add('debug')