From c1b9ee111e3e26a09abe0a9b6215bfc5562c14be Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 28 Jan 2025 19:32:14 +0100 Subject: [PATCH 1/3] CONF_DEFAULT_SAVE_LOCATION: Create it --- Packages/MIES/MIES_Configuration.ipf | 2 +- Packages/MIES/MIES_Constants.ipf | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Packages/MIES/MIES_Configuration.ipf b/Packages/MIES/MIES_Configuration.ipf index fa214639f1..20c96117e6 100644 --- a/Packages/MIES/MIES_Configuration.ipf +++ b/Packages/MIES/MIES_Configuration.ipf @@ -255,7 +255,7 @@ static Function CONF_DefaultSettings() JSON_AddString(jsonID, EXPCONFIG_JSON_POSITION_MCC, NONE) JSON_AddString(jsonID, EXPCONFIG_JSON_STIMSET_NAME, "") - JSON_AddString(jsonID, EXPCONFIG_JSON_SAVE_PATH, "C:MiesSave") + JSON_AddString(jsonID, EXPCONFIG_JSON_SAVE_PATH, CONF_DEFAULT_SAVE_LOCATION) JSON_AddBoolean(jsonID, EXPCONFIG_JSON_LOGFILE_UPLOAD, EXPCONFIG_JSON_LOGFILE_UPLOAD_DEFAULT) jsonpath = "/" + EXPCONFIG_JSON_GLOBALPACKAGESETTINGBLOCK + "/" + PACKAGE_SETTINGS_USERPING diff --git a/Packages/MIES/MIES_Constants.ipf b/Packages/MIES/MIES_Constants.ipf index 3a4df7879b..5bea5ea5f2 100644 --- a/Packages/MIES/MIES_Constants.ipf +++ b/Packages/MIES/MIES_Constants.ipf @@ -2386,3 +2386,5 @@ Constant ABORTCODE_ABORT = -3 Constant ABORTCODE_STACKOVERFLOW = -2 Constant ABORTCODE_USERABORT = -1 ///@} + +StrConstant CONF_DEFAULT_SAVE_LOCATION = "C:MiesSave" From d13a088757c7f52871806333e873c108c92feae8 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 28 Jan 2025 19:25:39 +0100 Subject: [PATCH 2/3] Tests/TCONF_CheckTypedPanelRestore: Don't write into C:\MiesSave We already have FixupJSONConfig_IGNORE to change the saved into path for CI. So let's use that. And while at it we also remove the DeleteFile statement, the CI runner should cleanup after us. Close #2065 --- .../HardwareBasic/UTF_ConfigurationHardware.ipf | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Packages/tests/HardwareBasic/UTF_ConfigurationHardware.ipf b/Packages/tests/HardwareBasic/UTF_ConfigurationHardware.ipf index 398448ef4f..68aced78d6 100644 --- a/Packages/tests/HardwareBasic/UTF_ConfigurationHardware.ipf +++ b/Packages/tests/HardwareBasic/UTF_ConfigurationHardware.ipf @@ -155,14 +155,16 @@ End /// IUTF_TD_GENERATOR s1:DeviceNameGenerator static Function TCONF_CheckTypedPanelRestore([STRUCT IUTF_mData &md]) - string win, winRestored - string fName = GetFolder(FunctionPath("")) + "CheckTypedPanelRestore.json" + string win, winRestored, rewrittenConfig, device + variable jsonID, needsFixup + string fName = PrependExperimentFolder_IGNORE("CheckTypedPanelRestore.json") Execute/Q md.s0 + "()" win = WinName(0, -1) if(!CmpStr(win, BASE_WINDOW_NAME)) // special handling for DAEphys KillWindow $win + device = md.s1 CreateLockedDAEphys(md.s1) win = WinName(0, -1) PGC_SetAndActivateControl(win, "check_Settings_RequireAmpConn", val = 0) @@ -171,12 +173,20 @@ static Function TCONF_CheckTypedPanelRestore([STRUCT IUTF_mData &md]) PGC_SetAndActivateControl(win, "setvar_Settings_VC_DAgain", val = 20) PGC_SetAndActivateControl(win, "Gain_AD_00", val = 0.0025) PGC_SetAndActivateControl(win, "setvar_Settings_VC_ADgain", val = 0.0025) + needsFixup = 1 endif + CONF_SaveWindow(fName) KillWindow $win + + if(needsFixup) + [jsonID, rewrittenConfig] = FixupJSONConfig_IGNORE(fName, device) + JSON_Release(jsonID) + fName = rewrittenConfig + endif + CONF_RestoreWindow(fName) winRestored = WinName(0, -1) - DeleteFile fName CHECK_EQUAL_STR(win, winRestored) End From a4bc35ad0237b67cc28c136abc783d93e958b424 Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Tue, 28 Jan 2025 19:33:57 +0100 Subject: [PATCH 3/3] TestCaseEndCommon: Ensure that the default save location does not exist In that way the bug we fixed in the previous commit can not happen again. --- Packages/tests/UTF_HelperFunctions.ipf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Packages/tests/UTF_HelperFunctions.ipf b/Packages/tests/UTF_HelperFunctions.ipf index 4cfaef94a8..192f62a19c 100644 --- a/Packages/tests/UTF_HelperFunctions.ipf +++ b/Packages/tests/UTF_HelperFunctions.ipf @@ -908,6 +908,9 @@ Function TestCaseEndCommon(string testcase, [variable restartAsyncFramework]) ASYNC_Start(ThreadProcessorCount, disableTask = 1) endif endif + + INFO("The default save location for MIES json configuration \"%s\" must not exist for the tests.", s0 = CONF_DEFAULT_SAVE_LOCATION) + REQUIRE(!FolderExists(CONF_DEFAULT_SAVE_LOCATION)) End Function SetAsyncChannelProperties(string device, WAVE asyncChannels, variable minValue, variable maxValue)