Skip to content

Commit

Permalink
Fix pass params to llvm-config
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-penev committed Nov 30, 2023
1 parent 613f5ed commit 32f68ff
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 18 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
49 changes: 32 additions & 17 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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')

0 comments on commit 32f68ff

Please sign in to comment.