Skip to content

Commit

Permalink
run_tests.sh: update comment on -j option, add run_tests.bat
Browse files Browse the repository at this point in the history
  • Loading branch information
phetdam committed Aug 3, 2022
1 parent 74eda8a commit 724052c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
34 changes: 34 additions & 0 deletions run_tests.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
:: Run all tests registered with CMake using ctest.

@echo off
setlocal

call :Main %*
exit /b %ERRORLEVEL%

::::
:: Collect command-line arguments.
::
:: Arguments:
:: Array of command-line arguments
:CollectArgs
exit /b 0

::::
:: Main method for the script.
::
:: Note: In CMD GTEST_COLOR does not work with ctest. However, color output is
:: still produced if the Google Test runner is executed directly.
::
:: Arguments:
:: Array of command-line arguments
::
:Main
:: use half the number of processors. only final -j<n_procs> takes effect.
set /a N_PROCS=%NUMBER_OF_PROCESSORS% / 2
ctest --test-dir build_windows -j%N_PROCS% %*
copy a b
exit /b %ERRORLEVEL%

endlocal
echo on
4 changes: 2 additions & 2 deletions run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
main() {
# GTEST_COLOR=yes allows color output from Google test mains. the nested
# command substitution gets half the number of available threads on system.
# note that -j x can be overridden with a subsequent -j y.
GTEST_COLOR=yes ctest --test-dir build -j $(expr $(nproc --all) / 2) "$@"
# note that only the final -j<n_procs> option takes effect.
GTEST_COLOR=yes ctest --test-dir build -j$(expr $(nproc --all) / 2) "$@"
}

set -e
Expand Down

0 comments on commit 724052c

Please sign in to comment.