mirror of
https://github.com/leanprover/lean4.git
synced 2026-03-17 10:24:07 +00:00
The tests need to run with certain environment variables set that only cmake really knows and that differ between stages. Cmake could just set the variables directly when running the tests and benchmarks, but that would leave no good way to manually run a single benchmark. So cmake generates some stage-specific scripts instead that set the required environment variables. Previously, those scripts were sourced directly by the individual `run_*` scripts, so the env scripts of different stages would overwrite each other. This PR changes the setup so they can instead be generated next to each other. This also simplifies the `run_*` scripts themselves a bit, and makes `tests/bench/build` less of a hack.
58 lines
1.3 KiB
Bash
58 lines
1.3 KiB
Bash
STAGE_THIS="stage$STAGE"
|
|
STAGE_NEXT="stage$((STAGE + 1))"
|
|
|
|
BUILD_ROOT="$(realpath "$BUILD_DIR/..")"
|
|
BUILD_THIS="$(realpath "$BUILD_ROOT/$STAGE_THIS")"
|
|
BUILD_NEXT="$(realpath "$BUILD_ROOT/$STAGE_NEXT")"
|
|
|
|
OUT="$(realpath measurements.jsonl)"
|
|
|
|
|
|
|
|
echo
|
|
echo ">"
|
|
echo "> Configuring $STAGE_NEXT..."
|
|
echo ">"
|
|
|
|
make -C "$BUILD_ROOT" -j"$(nproc)" "$STAGE_NEXT-configure"
|
|
|
|
|
|
|
|
echo
|
|
echo ">"
|
|
echo "> Warming up $STAGE_NEXT..."
|
|
echo ">"
|
|
|
|
make -C "$BUILD_NEXT" -j"$(nproc)"
|
|
find "$BUILD_NEXT/lib" -name "*.olean" -delete
|
|
rm -f measurements.jsonl
|
|
|
|
|
|
|
|
echo
|
|
echo ">"
|
|
echo "> Building $STAGE_NEXT..."
|
|
echo ">"
|
|
|
|
LAKE_OVERRIDE_LEAN=true LEAN="$(realpath fake_root/bin/lean)" \
|
|
WRAPPER_PREFIX="$(realpath fake_root)" WRAPPER_OUT="$OUT" \
|
|
lakeprof record -- \
|
|
"$TEST_DIR/measure.py" -t build -d -a -- \
|
|
make -C "$BUILD_NEXT" -j"$(nproc)"
|
|
|
|
|
|
|
|
echo
|
|
echo ">"
|
|
echo "> Analyzing lakeprof data..."
|
|
echo ">"
|
|
|
|
# Lakeprof must be executed in the src dir because it obtains some metadata by
|
|
# calling lake in its current working directory.
|
|
mv lakeprof.log "$SRC_DIR"
|
|
pushd "$SRC_DIR"
|
|
lakeprof report -prc > lakeprof_report.txt
|
|
lakeprof report -pj | jq '{metric: "build/lakeprof/longest build path//wall-clock", value: .[-1][2], unit: "s"}' -c >> "$OUT"
|
|
lakeprof report -rj | jq '{metric: "build/lakeprof/longest rebuild path//wall-clock", value: .[-1][2], unit: "s"}' -c >> "$OUT"
|
|
popd
|