feat: add ProcessExecutor, FAKE mode, fix thread lifecycle crash
- Add ProcessExecutor class wrapping PIProcess with proper cleanup - Add CMake FAKE option (-DFAKE=ON) for testing without opencode - Add 3 FAKE-mode tests for full pipeline execution, status transitions, output - Fix PIThread lifecycle: use startOnce() instead of start(), track threads, wait + delete in destructor to prevent use-after-free of PIDeque<PIChar> - Update build.sh with --fake flag and automatic cache invalidation - Upgrade CMake to C++17 standard - Update AGENTS.md with build commands and FAKE mode
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
BUILD_DIR="${SCRIPT_DIR}/build"
|
||||
|
||||
REBUILD=false
|
||||
FAKE=false
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--rebuild) REBUILD=true ;;
|
||||
--fake) FAKE=true ;;
|
||||
esac
|
||||
done
|
||||
|
||||
CMAKE_ARGS=""
|
||||
if [ "${FAKE}" = true ]; then
|
||||
CMAKE_ARGS="-DFAKE=ON"
|
||||
fi
|
||||
|
||||
if [ "${REBUILD}" = true ]; then
|
||||
echo "==> Clean build directory"
|
||||
rm -rf "${BUILD_DIR}"
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
echo "==> Configure"
|
||||
cmake -S "${SCRIPT_DIR}" -B "${BUILD_DIR}" ${CMAKE_ARGS}
|
||||
fi
|
||||
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
|
||||
if [ -f "${BUILD_DIR}/CMakeCache.txt" ]; then
|
||||
CACHED_FAKE=$(grep -o "FAKE:BOOL=.\+" "${BUILD_DIR}/CMakeCache.txt" 2>/dev/null || echo "")
|
||||
if [ "${FAKE}" = true ] && [ "${CACHED_FAKE}" != "FAKE:BOOL=ON" ]; then
|
||||
echo "==> FAKE flag changed, cleaning build"
|
||||
rm -rf "${BUILD_DIR}"
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
elif [ "${FAKE}" = false ] && [ "${CACHED_FAKE}" = "FAKE:BOOL=ON" ]; then
|
||||
echo "==> FAKE flag changed, cleaning build"
|
||||
rm -rf "${BUILD_DIR}"
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "${BUILD_DIR}/CMakeCache.txt" ]; then
|
||||
echo "==> Configure"
|
||||
cmake -S "${SCRIPT_DIR}" -B "${BUILD_DIR}" ${CMAKE_ARGS}
|
||||
fi
|
||||
|
||||
echo "==> Build"
|
||||
cmake --build "${BUILD_DIR}" -j$(nproc)
|
||||
|
||||
echo "==> Run tests"
|
||||
rm -rf /tmp/pipeline-runner-test/
|
||||
"${BUILD_DIR}/test-pipeline-runner" \
|
||||
--gtest_brief=1 \
|
||||
--gtest_output=xml:"${BUILD_DIR}/test-results.xml"
|
||||
|
||||
echo "==> Done"
|
||||
Reference in New Issue
Block a user