Skip to content
Snippets Groups Projects
Commit 07c1513f authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Create a blank user config file before running tests

Previously we only removed the properties file but some tests
could touch other parts of the user config so remove it all
and create a blank file to ensure the environment is clean.
Refs #22063
parent 2ac289c3
No related branches found
No related tags found
No related merge requests found
...@@ -300,10 +300,13 @@ fi ...@@ -300,10 +300,13 @@ fi
############################################################################### ###############################################################################
# Run the unit tests # Run the unit tests
############################################################################### ###############################################################################
# Prevent race conditions when creating the user config directory
userconfig_dir=$HOME/.mantid
rm -fr $userconfig_dir
mkdir -p $userconfig_dir
touch $userconfig_dir/Mantid.user.properties
if [[ ${DO_UNITTESTS} == true ]]; then if [[ ${DO_UNITTESTS} == true ]]; then
# Remove any Mantid.user.properties file
userprops=~/.mantid/Mantid.user.properties
rm -f $userprops
$CTEST_EXE -j${BUILD_THREADS:?} --schedule-random --output-on-failure $CTEST_EXE -j${BUILD_THREADS:?} --schedule-random --output-on-failure
fi fi
......
...@@ -157,10 +157,14 @@ if ERRORLEVEL 1 exit /B %ERRORLEVEL% ...@@ -157,10 +157,14 @@ if ERRORLEVEL 1 exit /B %ERRORLEVEL%
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Run the tests :: Run the tests
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Remove the user properties file just in case anything polluted it :: Remove any user configuration and create a blank user properties file
:: This prevents race conditions when creating the user config directory
set USERPROPS=bin\%BUILD_CONFIG%\Mantid.user.properties set USERPROPS=bin\%BUILD_CONFIG%\Mantid.user.properties
del %USERPROPS% del %USERPROPS%
set CONFIGDIR=%APPDATA%\mantidproject\mantid
rmdir /S /Q %CONFIGDIR%
mkdir %CONFIGDIR%
call cmake.exe -E touch %USERPROPS%
call ctest.exe -C %BUILD_CONFIG% -j%BUILD_THREADS% --schedule-random --output-on-failure call ctest.exe -C %BUILD_CONFIG% -j%BUILD_THREADS% --schedule-random --output-on-failure
if ERRORLEVEL 1 exit /B %ERRORLEVEL% if ERRORLEVEL 1 exit /B %ERRORLEVEL%
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment