From c1d4d62e87e5f7e935139f799f94d4e8ed404681 Mon Sep 17 00:00:00 2001
From: Martyn Gigg <martyn.gigg@gmail.com>
Date: Wed, 19 Dec 2018 17:46:29 +0000
Subject: [PATCH] Remove old ExternalData files and user instrument data...

when running systemtests
---
 buildconfig/Jenkins/systemtests     | 7 +++++++
 buildconfig/Jenkins/systemtests.bat | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/buildconfig/Jenkins/systemtests b/buildconfig/Jenkins/systemtests
index fe04694e0c2..e98b59a7318 100755
--- a/buildconfig/Jenkins/systemtests
+++ b/buildconfig/Jenkins/systemtests
@@ -50,6 +50,11 @@ fi
 [ -d $WORKSPACE/build ] || mkdir $WORKSPACE/build
 cd $WORKSPACE/build
 
+# Remove (possibly) stale files
+#   build/ExternalData/**: data files will change over time and removing
+#                          the links helps keep it fresh
+rm -rf $WORKSPACE/build/ExternalData
+
 ###############################################################################
 # CMake configuration if it has not already been configured.
 # We use the special flag that only creates the targets for the data
@@ -76,6 +81,8 @@ rm -f $userprops
 echo "UpdateInstrumentDefinitions.OnStartup = 0" > $userprops
 echo "usagereports.enabled = 0" >> $userprops
 echo "CheckMantidVersion.OnStartup = 0" >> $userprops
+# Remove user instrument directory
+rm -fr ~/.mantid/instrument
 
 # Remove mismatch files which have not been cleaned up yet
 default_save_directory=${WORKSPACE}/build/Testing/SystemTests/scripts/
diff --git a/buildconfig/Jenkins/systemtests.bat b/buildconfig/Jenkins/systemtests.bat
index 02c2fd894af..2b96928449a 100755
--- a/buildconfig/Jenkins/systemtests.bat
+++ b/buildconfig/Jenkins/systemtests.bat
@@ -34,6 +34,11 @@ if NOT DEFINED MANTID_DATA_STORE (
 md %WORKSPACE%\build
 cd %WORKSPACE%\build
 
+:: Remove (possibly) stale files
+::   build/ExternalData/**: data files will change over time and removing
+::                          the links helps keep it fresh
+rmdir /S /Q %WORKSPACE%\build\ExternalData
+
 :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
 :: CMake configuration if it has not already been configured.
 :: We use the special flag that only creates the targets for the data
@@ -70,6 +75,9 @@ echo CheckMantidVersion.OnStartup = 0 >> %USERPROPS_RELEASE%
 echo UpdateInstrumentDefinitions.OnStartup = 0 > %USERPROPS_NIGHTLY%
 echo usagereports.enabled = 0 >> %USERPROPS_NIGHTLY%
 echo CheckMantidVersion.OnStartup = 0 >> %USERPROPS_NIGHTLY%
+:: Remove user instrument directory
+rmdir /S /Q %APPDATA%\mantidproject\mantid\instrument
+
 
 :: Run
 set PKGDIR=%WORKSPACE%\build
-- 
GitLab