Skip to content

Commit 08ab8bf

Browse files
authored
chore: fix ci for new test suite (#12704)
1 parent 54df517 commit 08ab8bf

19 files changed

+193
-30
lines changed

.github/workflows/build-template.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,16 @@ jobs:
234234
- name: Build Stage 2
235235
run: |
236236
make -C build -j$NPROC stage2
237-
if: matrix.test-speedcenter
237+
if: matrix.test-bench
238238
- name: Check Stage 3
239239
run: |
240240
make -C build -j$NPROC check-stage3
241241
if: matrix.check-stage3
242-
- name: Test Speedcenter Benchmarks
243-
run: nix shell github:Kha/lakeprof -c make -C build -j$NPROC bench
244-
if: matrix.test-speedcenter
242+
- name: Test Benchmarks
243+
run: |
244+
cd tests
245+
nix develop -c make -C ../build -j$NPROC bench
246+
if: matrix.test-bench
245247
- name: Check rebootstrap
246248
run: |
247249
set -e

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ jobs:
258258
"check-rebootstrap": level >= 1,
259259
"check-stage3": level >= 2,
260260
"test": true,
261-
// NOTE: `test-speedcenter` currently seems to be broken on `ubuntu-latest`
262-
"test-speedcenter": large && level >= 2,
261+
// NOTE: `test-bench` currently seems to be broken on `ubuntu-latest`
262+
"test-bench": large && level >= 2,
263263
// We are not warning-free yet on all platforms, start here
264264
"CMAKE_OPTIONS": "-DLEAN_EXTRA_CXX_FLAGS=-Werror",
265265
},
@@ -269,6 +269,8 @@ jobs:
269269
"enabled": level >= 2,
270270
"test": true,
271271
"CMAKE_PRESET": "reldebug",
272+
// * `elab_bench/big_do` crashes with exit code 134
273+
"CTEST_OPTIONS": "-E 'elab_bench/big_do'",
272274
},
273275
{
274276
"name": "Linux fsanitize",

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
*~
22
\#*
33
.#*
4-
*.lock
54
.lake
65
lake-manifest.json
76
/build

CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"SMALL_ALLOCATOR": "OFF",
4242
"USE_MIMALLOC": "OFF",
4343
"BSYMBOLIC": "OFF",
44-
"LEAN_TEST_VARS": "MAIN_STACK_SIZE=16000 LSAN_OPTIONS=max_leaks=10"
44+
"LEAN_TEST_VARS": "MAIN_STACK_SIZE=16000 TEST_STACK_SIZE=16000 LSAN_OPTIONS=max_leaks=10"
4545
},
4646
"generator": "Unix Makefiles",
4747
"binaryDir": "${sourceDir}/build/sanitize"

tests/CMakeLists.txt

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,33 @@
22
## Environment ##
33
#################
44

5-
# MSYS2 bash usually handles Windows paths relatively well, but not when putting them in the PATH
6-
string(REGEX REPLACE "^([a-zA-Z]):" "/\\1" LEAN_BIN "${CMAKE_BINARY_DIR}/bin")
5+
# MSYS2 bash usually handles Windows paths relatively well, but not in all situations.
6+
# Thus, rewrite C:/foo/bar to /C/foo/bar on Windows.
7+
function(mangle_windows_path OUT PATH)
8+
if(WIN32)
9+
string(REGEX REPLACE "^([a-zA-Z]):" "/\\1" RESULT "${PATH}")
10+
# Replace with return(PROPAGATE) if we ever update to cmake 3.25+
11+
set("${OUT}" "${RESULT}" PARENT_SCOPE)
12+
else()
13+
# Replace with return(PROPAGATE) if we ever update to cmake 3.25+
14+
set("${OUT}" "${PATH}" PARENT_SCOPE)
15+
endif()
16+
endfunction()
17+
18+
mangle_windows_path(MANGLED_BINARY_DIR "${CMAKE_BINARY_DIR}")
19+
mangle_windows_path(MANGLED_SOURCE_DIR "${CMAKE_SOURCE_DIR}")
20+
mangle_windows_path(MANGLED_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
21+
22+
set(LEAN_BIN "${MANGLED_BINARY_DIR}/bin")
723

824
set(TEST_VARS "${LEAN_TEST_VARS}")
925

1026
# Test scripts can use these to find other parts of the repo, e.g. "$TEST_DIR/measure.py"
1127
string(APPEND TEST_VARS " STAGE='${STAGE}'") # Using this should not normally be necessary
12-
string(APPEND TEST_VARS " SRC_DIR='${CMAKE_SOURCE_DIR}'")
13-
string(APPEND TEST_VARS " TEST_DIR='${CMAKE_CURRENT_SOURCE_DIR}'")
14-
string(APPEND TEST_VARS " BUILD_DIR='${CMAKE_BINARY_DIR}'")
15-
string(APPEND TEST_VARS " SCRIPT_DIR='${CMAKE_SOURCE_DIR}/../script'")
28+
string(APPEND TEST_VARS " SRC_DIR='${MANGLED_SOURCE_DIR}'")
29+
string(APPEND TEST_VARS " TEST_DIR='${MANGLED_CURRENT_SOURCE_DIR}'")
30+
string(APPEND TEST_VARS " BUILD_DIR='${MANGLED_BINARY_DIR}'")
31+
string(APPEND TEST_VARS " SCRIPT_DIR='${MANGLED_SOURCE_DIR}/../script'")
1632

1733
# Use the current stage's lean binary instead of whatever lake thinks we want
1834
string(APPEND TEST_VARS " PATH='${LEAN_BIN}':\"$PATH\"")
@@ -117,7 +133,12 @@ function(add_test_pile DIR GLOB)
117133
cmake_path(RELATIVE_PATH FILE_ABS BASE_DIRECTORY "${DIR_ABS}" OUTPUT_VARIABLE FILE_NAME)
118134

119135
if(RUN_TEST_EXISTS AND NOT EXISTS "${FILE_ABS}.no_test")
120-
add_test(NAME "${FILE}" WORKING_DIRECTORY "${DIR_ABS}" COMMAND "${RUN_TEST}" "${FILE_NAME}")
136+
add_test(
137+
NAME "${FILE}"
138+
WORKING_DIRECTORY "${DIR_ABS}"
139+
# On Windows, we can't call the file directly, hence we always use bash.
140+
COMMAND bash "${RUN_TEST}" "${FILE_NAME}"
141+
)
121142
endif()
122143

123144
if(RUN_BENCH_EXISTS AND NOT EXISTS "${FILE_ABS}.no_bench")
@@ -127,7 +148,8 @@ function(add_test_pile DIR GLOB)
127148
OUTPUT "${MEASUREMENTS_FILE}"
128149
WORKING_DIRECTORY "${DIR_ABS}"
129150
COMMAND "${CMAKE_COMMAND}" -E remove -f "${MEASUREMENTS_FILE}"
130-
COMMAND "${RUN_BENCH}" "${FILE_NAME}"
151+
# On Windows, we can't call the file directly, hence we always use bash.
152+
COMMAND bash "${RUN_BENCH}" "${FILE_NAME}"
131153
)
132154
endif()
133155
endforeach()
@@ -152,7 +174,12 @@ function(add_test_dir DIR)
152174

153175
# Add as test
154176
if(RUN_TEST_EXISTS)
155-
add_test(NAME "${DIR}" WORKING_DIRECTORY "${DIR_ABS}" COMMAND "${RUN_TEST}")
177+
add_test(
178+
NAME "${DIR}"
179+
WORKING_DIRECTORY "${DIR_ABS}"
180+
# On Windows, we can't call the file directly, hence we always use bash.
181+
COMMAND bash "${RUN_TEST}"
182+
)
156183
endif()
157184

158185
# Add as benchmark
@@ -164,7 +191,8 @@ function(add_test_dir DIR)
164191
OUTPUT "${MEASUREMENTS_FILE}"
165192
WORKING_DIRECTORY "${DIR_ABS}"
166193
COMMAND "${CMAKE_COMMAND}" -E remove -f "${MEASUREMENTS_FILE}"
167-
COMMAND "${RUN_BENCH}"
194+
# On Windows, we can't call the file directly, hence we always use bash.
195+
COMMAND bash "${RUN_BENCH}"
168196
)
169197
endif()
170198
endfunction()

tests/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ These files are available to configure a test:
193193
- `<file>.exit.expected`:
194194
The test fails if its exit code doesn't match this file's contents.
195195
If this file isn't present, the pile's default exit code is used instead.
196+
If this file contains the text `nonzero`, the test's exit code must not be 0.
196197

197198
These bash variables (set via `<file>.init.sh`) are used by the run script:
198199

@@ -234,6 +235,7 @@ These files are available to configure a test:
234235
- `<file>.exit.expected`:
235236
The test fails if its exit code doesn't match this file's contents.
236237
If this file isn't present, the test's exit code must be 0.
238+
If this file contains the text `nonzero`, the test's exit code must not be 0.
237239

238240
These bash variables (set via `<file>.init.sh`) are used by the run script:
239241

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
134
1+
nonzero
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
134
1+
nonzero

tests/compile_bench/const_fold.lean.init.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ if [[ -n $TEST_BENCH ]]; then
44
TEST_ARGS=( 23 )
55
fi
66

7-
ulimit -s unlimited
7+
set_stack_size_to_maximum

tests/elab/async_systems_info.lean.out.expected

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)