Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature flag for tests broken by opaque pointers #812

Merged
merged 4 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/k-rule-apply/definition.kore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// XFAIL: opaque-pointers
// RUN: %kompile %s c
// RUN: %apply-rule %S TEST.testArray %input-dir/`basename %S`/foo_Array_Success.in %S/definition.o | diff - %output-dir/`basename %S`/foo_Array_Success.out.diff
// RUN: %apply-rule %S TEST.testArray %input-dir/`basename %S`/foo_Array_Fail.in %S/definition.o | diff - %output-dir/`basename %S`/foo_Array_Fail.out.diff
Expand Down
12 changes: 12 additions & 0 deletions test/lit.cfg.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import glob
import os
import subprocess

from lit import formats

def llvm_major_version():
result = subprocess.run(['llvm-backend-version', '--llvm'], capture_output=True)
if result.returncode != 0:
raise RuntimeError('Failed to get LLVM package version')

major, _, _ = result.stdout.decode('utf-8').strip().split('.')
return int(major)

ROOT_PATH = os.path.realpath(os.path.join(
os.path.dirname(os.path.realpath(__file__)), ".."))

Expand Down Expand Up @@ -39,6 +48,9 @@
'test_bindings.py'
]

if llvm_major_version() >= 16:
config.available_features.add('opaque-pointers')

# When lit is launched, it doesn't inherit any environment variables from the
# parent process' environment. This breaks the Nix derivations for the host
# compiler and linker, as they depend on NIX_* environment variables being set.
Expand Down
22 changes: 19 additions & 3 deletions tools/llvm-backend-version/version.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
#include "version.inc"

#include <cstdio>
#include <llvm/Support/CommandLine.h>
#include <llvm/Support/raw_ostream.h>

int main() {
printf("%s\n", llvm_backend_version);
using namespace llvm;

cl::OptionCategory VersionCat("kprint options");

cl::opt<bool> LLVMVersion(
"llvm", cl::desc("Print LLVM version rather than backend version"),
cl::cat(VersionCat));

int main(int argc, char **argv) {
cl::HideUnrelatedOptions({&VersionCat});
cl::ParseCommandLineOptions(argc, argv);

if (LLVMVersion) {
llvm::outs() << llvm_version << '\n';
} else {
llvm::outs() << llvm_backend_version << '\n';
}
}
1 change: 1 addition & 0 deletions tools/llvm-backend-version/version.inc.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
static const char llvm_backend_version[] = "@LLVM_BACKEND_VERSION@";
static const char llvm_version[] = "@LLVM_PACKAGE_VERSION@";
Loading