- usb_haiku.cpp: each disk device transaction kept minimal, because
Haiku R1/beta6 rejects or hangs on combined ones: erase foreign
content, delete old MBR partitions, create the 0x0c partition
("FAT 32-bit, LBA-mapped", with "active false" parameters) and format
FAT32 are separate commits; Uninitialize is never used on an MBR
- OPENPU_DEBUG=1 traces the Haiku disk device steps on stderr
- extractTar resolves the destination first: SECURE_SYMLINKS refused
destinations under a symlink (/tmp on Haiku)
- check.sh: clang-tidy skips sources not built on Linux
- validated in the Haiku VM: write-usb on the virtual stick gives an MBR,
a FAT32 partition at 1 MiB, the label, license/ and the archive tree
without UpdateInfo.xml, with identical checksums; 53 unit tests pass
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
55 lines
2.1 KiB
Bash
55 lines
2.1 KiB
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: MIT
|
|
# Full local quality gate: build + tests, ASan/UBSan tests, valgrind, clang-tidy, cppcheck.
|
|
# usage: tools/check.sh [build-root] (default: ~/build/openpu-check)
|
|
set -eu
|
|
|
|
SRC=$(cd "$(dirname "$0")/.." && pwd)
|
|
OUT=${1:-"$HOME/build/openpu-check"}
|
|
|
|
step() { printf '\n==> %s\n' "$*"; }
|
|
|
|
step "debug build + tests"
|
|
cmake -S "$SRC" -B "$OUT/debug" -G Ninja -DCMAKE_BUILD_TYPE=Debug -DOPENPU_WERROR=ON >/dev/null
|
|
cmake --build "$OUT/debug"
|
|
ctest --test-dir "$OUT/debug" --output-on-failure
|
|
|
|
step "ASan + UBSan tests"
|
|
cmake -S "$SRC" -B "$OUT/asan" -G Ninja -DCMAKE_BUILD_TYPE=Debug -DOPENPU_SANITIZE=ON >/dev/null
|
|
cmake --build "$OUT/asan"
|
|
UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1 ctest --test-dir "$OUT/asan" --output-on-failure
|
|
|
|
if command -v valgrind >/dev/null; then
|
|
step "valgrind memcheck"
|
|
valgrind --quiet --error-exitcode=1 --leak-check=full --errors-for-leak-kinds=definite \
|
|
"$OUT/debug/tests/openpu_tests" >/dev/null
|
|
fi
|
|
|
|
if command -v clang-tidy >/dev/null; then
|
|
step "clang-tidy"
|
|
# Only our sources; compile_commands.json comes from the debug build.
|
|
# Only files of this build: usb_haiku.cpp / usb_none.cpp are not compiled on Linux.
|
|
find "$SRC/src" -name '*.cpp' -not -path '*/ui-*' -not -name 'usb_haiku.cpp' -not -name 'usb_none.cpp' -print0 |
|
|
xargs -0 clang-tidy -p "$OUT/debug" --quiet --warnings-as-errors='*'
|
|
fi
|
|
|
|
if pkg-config --exists gtkmm-4.0; then
|
|
step "GTK user interface build"
|
|
cmake -S "$SRC" -B "$OUT/gtk" -G Ninja -DCMAKE_BUILD_TYPE=Debug -DOPENPU_WERROR=ON -DOPENPU_UI_GTK=ON \
|
|
-DOPENPU_BUILD_TESTS=OFF >/dev/null
|
|
cmake --build "$OUT/gtk"
|
|
if command -v clang-tidy >/dev/null; then
|
|
step "clang-tidy (GTK user interface)"
|
|
find "$SRC/src/ui-gtk" -name '*.cpp' -print0 |
|
|
xargs -0 clang-tidy -p "$OUT/gtk" --quiet --warnings-as-errors='*'
|
|
fi
|
|
fi
|
|
|
|
if command -v cppcheck >/dev/null; then
|
|
step "cppcheck"
|
|
cppcheck --quiet --error-exitcode=1 --std=c++17 --enable=warning,performance,portability \
|
|
--inline-suppr --suppress=missingIncludeSystem -I "$SRC/src/core/include" "$SRC/src"
|
|
fi
|
|
|
|
step "all checks passed"
|