Unit tests working on generated projects

This commit is contained in:
Eric Ratliff
2026-02-18 21:00:24 -06:00
parent c41776df22
commit eee2f690da
3 changed files with 23 additions and 19 deletions

View File

@@ -161,8 +161,8 @@ fn print_diagnostics(health: &SystemHealth) {
} else if !health.avr_core_ok { } else if !health.avr_core_ok {
println!( println!(
" {} avr-size {}", " {} avr-size {}",
"--".bright_black(), "na".yellow(),
"included with arduino:avr core (no separate install)".bright_black() "included with arduino:avr core (no separate install)".yellow()
); );
} else { } else {
// Core is installed but avr-size is not on PATH -- // Core is installed but avr-size is not on PATH --
@@ -170,8 +170,8 @@ fn print_diagnostics(health: &SystemHealth) {
// inside the Arduino15 packages directory. // inside the Arduino15 packages directory.
println!( println!(
" {} avr-size {}", " {} avr-size {}",
"--".bright_black(), "na".yellow(),
hint_avr_size_not_on_path().bright_black() hint_avr_size_not_on_path().yellow()
); );
} }
@@ -195,8 +195,8 @@ fn print_diagnostics(health: &SystemHealth) {
} else { } else {
println!( println!(
" {} cmake {}", " {} cmake {}",
"--".bright_black(), "na".yellow(),
hint_cmake().bright_black() hint_cmake().yellow()
); );
} }
@@ -206,8 +206,8 @@ fn print_diagnostics(health: &SystemHealth) {
} else { } else {
println!( println!(
" {} C++ compiler {}", " {} C++ compiler {}",
"--".bright_black(), "na".yellow(),
hint_cpp_compiler().bright_black() hint_cpp_compiler().yellow()
); );
} }
@@ -217,8 +217,8 @@ fn print_diagnostics(health: &SystemHealth) {
} else { } else {
println!( println!(
" {} git {}", " {} git {}",
"--".bright_black(), "na".yellow(),
hint_git().bright_black() hint_git().yellow()
); );
} }
@@ -235,8 +235,8 @@ fn print_diagnostics(health: &SystemHealth) {
} else { } else {
println!( println!(
" {} no serial ports {}", " {} no serial ports {}",
"--".bright_black(), "na".yellow(),
"(plug in a board to detect)".bright_black() "(plug in a board to detect)".yellow()
); );
} }
} }

View File

@@ -1,8 +1,10 @@
@echo off @echo off
setlocal setlocal
set SCRIPT_DIR=%~dp0 set "SCRIPT_DIR=%~dp0"
set BUILD_DIR=%SCRIPT_DIR%build :: %~dp0 always ends with \ which breaks cmake quoting ("path\" escapes the quote)
set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
set "BUILD_DIR=%SCRIPT_DIR%\build"
if "%1"=="--clean" ( if "%1"=="--clean" (
if exist "%BUILD_DIR%" ( if exist "%BUILD_DIR%" (
@@ -12,10 +14,12 @@ if "%1"=="--clean" (
) )
if not exist "%BUILD_DIR%\CMakeCache.txt" ( if not exist "%BUILD_DIR%\CMakeCache.txt" (
echo Configuring (first run will fetch Google Test)... echo Configuring test build. First run will fetch Google Test...
cmake -S "%SCRIPT_DIR%" -B "%BUILD_DIR%" -DCMAKE_BUILD_TYPE=Debug cmake -S "%SCRIPT_DIR%" -B "%BUILD_DIR%" -DCMAKE_BUILD_TYPE=Debug
if errorlevel 1 ( if errorlevel 1 (
echo FAIL: cmake configure failed echo FAIL: cmake configure failed.
echo cmake is required for host-side tests.
echo Run 'anvil doctor' to see install instructions.
exit /b 1 exit /b 1
) )
) )

View File

@@ -50,7 +50,7 @@ if [[ $DO_CLEAN -eq 1 ]] && [[ -d "$BUILD_DIR" ]]; then
fi fi
if [[ ! -f "$BUILD_DIR/CMakeCache.txt" ]]; then if [[ ! -f "$BUILD_DIR/CMakeCache.txt" ]]; then
info "Configuring (first run will fetch Google Test)..." info "Configuring test build. First run will fetch Google Test..."
cmake -S "$SCRIPT_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Debug cmake -S "$SCRIPT_DIR" -B "$BUILD_DIR" -DCMAKE_BUILD_TYPE=Debug
fi fi