Skip to content

Commit 6e2c242

Browse files
Fix macos ci (#201)
* Use a virtual environment for Python3 while testing under MacOS With Python3.12, brew requires a virtualenv for external python packages. Setup and use such an environment for testing under MacOS. While there is a `tabulate` package in brew, installing it won't install the library only the command line tool `tabulate`. Therefore, we install `tabulate` via `pip install`. Remove unnecessary package upgrade. * Fix bug in PATH cleaning, more robust installation detection The previous implementation gobbled up the first entry of the PATH by interpreting the second argument as pattern. New implementation avoids this and is more robust in detecting existing KLEE installations. * Mark variadic argument tests as requiring x86_64 * Update VarArgByValOld.c --------- Co-authored-by: Martin Nowack <m.nowack@imperial.ac.uk>
1 parent e513fc3 commit 6e2c242

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

.github/workflows/build.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ jobs:
168168
- name: Install newer version of Bash
169169
run: brew install bash
170170
- name: Checkout KLEE source code
171-
uses: actions/checkout@v3
172-
with:
173-
submodules: recursive
171+
uses: actions/checkout@v4
172+
- name: Create virtualenv for Python3 (PEP 668)
173+
run: python3 -m venv .venv
174174
- name: Build KLEE
175-
run: scripts/build/build.sh klee --debug --install-system-deps
175+
run: source .venv/bin/activate && echo "$(which tabulate)" && scripts/build/build.sh klee --debug --install-system-deps
176176
- name: Run tests
177-
run: scripts/build/run-tests.sh /tmp/klee_build* --debug
177+
run: source .venv/bin/activate && scripts/build/run-tests.sh /tmp/klee_build* --debug
178178

179179
Docker:
180180
runs-on: ubuntu-latest

scripts/build/p-klee-osx.inc

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# Build dependencies
22
install_build_dependencies_klee() {
3-
brew upgrade python # upgrade to Python 3
4-
brew link --overwrite python
5-
63
if [[ $(to_bool "${ENABLE_DOXYGEN}") -eq 1 ]]; then
74
brew install doxygen graphviz
85
fi
96

10-
brew install python-tabulate lit
7+
# Install `lit` required for testing
8+
brew install lit
119

1210
brew install pkg-config
1311
brew install coreutils
14-
# Get path of package location
15-
base_path=$(python3 -m site --user-base)
16-
export PATH="${base_path}/bin:$PATH"
17-
}
12+
13+
# Install package in virtual environment
14+
python3 -m pip install "tabulate"
15+
}

scripts/build/run-tests.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@ run_tests() {
3737
# TODO change to pinpoint specific directory
3838
cd "${build_dir}"
3939

40-
# Remove klee from PATH
41-
export PATH=${PATH/":/home/klee/klee_build/bin"/}
40+
# Remove klee from PATH. The goal is that for test cases klee is referenced via `%klee` not accidently being picked up via PATH
4241
if which klee; then
43-
return 1 # should not happen
42+
full_path_to_klee="$(which klee)"
43+
target_directory="$(dirname "${full_path_to_klee}")"
44+
PATH=${PATH/$target_directory/}
45+
if which klee; then
46+
return 1 # should not happen
47+
fi
4448
fi
4549

4650
###############################################################################

test/Feature/VarArgByValOld.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Variadic functions are only supported on x86_64
2+
// REQUIRES: x86_64
3+
14
// REQUIRES: lt-llvm-15.0
25
/* This test checks that KLEE correctly handles variadic arguments with the
36
byval attribute */

0 commit comments

Comments
 (0)