From b2c6abb5af92ddd672a3ea5b0cb5b7dd7aadd406 Mon Sep 17 00:00:00 2001 From: Yunli Shao Date: Thu, 12 Mar 2026 20:53:07 -0400 Subject: [PATCH 1/2] refactor: standardize on FIXS branding, replace RealSim in runtime strings - SocketHelper.cpp: rename Log() and cout messages to FIXS prefix - SocketHelper.h: update header size comment to FIXS - VirEnvHelper.cpp: rename all runtime log/error strings, PERF_INIT log file - TrafficHelper.cpp: rename vehicle type string "RealSim" -> "FIXS" - PerformanceTimer.h: change default log file to FIXSPerf.log - ConfigHelper.h: rename EnableRealSim field to EnableFIXS - ConfigHelper.cpp: accept both EnableFIXS (new) and EnableRealSim (legacy) YAML keys for backward compatibility; rename POI prefix to FIXS_POI_ - RealSimVersion.h.in: add FIXS_VERSION_* macros as primary names; keep REALSIM_VERSION_* as backward-compat aliases via #define - TrafficLayer/mainTrafficLayer.cpp, DriverModel_RealSim*.cpp: update field reference SimulationSetup.EnableRealSim -> SimulationSetup.EnableFIXS - tests/**/config.yaml (27 files): rename EnableRealSim: -> EnableFIXS: - tests/Python/test_naming_consistency.py: new pytest that verifies FIXS branding consistency across C++ source files and test YAML configs Co-Authored-By: Claude Sonnet 4.6 --- CommonLib/ConfigHelper.cpp | 16 +- CommonLib/ConfigHelper.h | 2 +- CommonLib/PerformanceTimer.h | 2 +- CommonLib/RealSimVersion.h.in | 27 ++- CommonLib/SocketHelper.cpp | 12 +- CommonLib/SocketHelper.h | 2 +- CommonLib/TrafficHelper.cpp | 2 +- CommonLib/VirEnvHelper.cpp | 74 ++++---- .../TrafficLayer/mainTrafficLayer.cpp | 2 +- tests/CoordMerge/config_SUMO.yaml | 2 +- tests/CoordMerge/config_SUMOD.yaml | 2 +- tests/CoordMerge/config_VISSIM.yaml | 2 +- tests/DelayedConnection/config_SUMO.yaml | 2 +- tests/Elevation/RS_config.yaml | 2 +- tests/Elevation/RS_config_release.yaml | 2 +- tests/MultipleVissim/config_test1.yaml | 2 +- tests/MultipleVissim/config_test2.yaml | 2 +- tests/Python/SimpleEchoClient/config.yaml | 2 +- tests/Python/SimpleTrafficLight/config.yaml | 2 +- tests/Python/test_naming_consistency.py | 165 ++++++++++++++++++ tests/ShallowfordRdSCIL/RS_config.yaml | 2 +- tests/ShallowfordRdSCIL/RS_config_CM.yaml | 2 +- tests/SignalIpg/RS_config.yaml | 2 +- tests/SignalIpg/RS_config_release.yaml | 2 +- tests/SpeedLimit/config_sumo.yaml | 2 +- tests/SpeedLimit/config_sumo_local.yaml | 2 +- .../defaultConfig.yaml | 2 +- .../defaultConfig.yaml | 2 +- tests/SumoDriver/config_SUMOdriver.yaml | 2 +- .../config_SUMOdriver_speedmode.yaml | 2 +- tests/SumoIpg/config_RS_SimulinkRS.yaml | 2 +- tests/SumoIpg/config_RS_noSimulinkRS.yaml | 2 +- tests/TurnSignal/config_SUMO.yaml | 2 +- tests/VissimIpg/config_vissim.yaml | 2 +- tests/VissimSpeedLimit/config_test1.yaml | 2 +- tests/VissimSpeedLimit/config_test2.yaml | 2 +- tests/VissimSpeedLimit/config_test3.yaml | 2 +- 37 files changed, 268 insertions(+), 90 deletions(-) create mode 100644 tests/Python/test_naming_consistency.py diff --git a/CommonLib/ConfigHelper.cpp b/CommonLib/ConfigHelper.cpp index f9a4bbb7..5a65eecb 100644 --- a/CommonLib/ConfigHelper.cpp +++ b/CommonLib/ConfigHelper.cpp @@ -137,12 +137,16 @@ int ConfigHelper::getConfig(string configName) { // READ Simulation Setup section // =========================================================================== node = config["SimulationSetup"]; - if (node["EnableRealSim"]) { - SimulationSetup.EnableRealSim = parserFlag(node, "EnableRealSim"); + if (node["EnableFIXS"]) { + SimulationSetup.EnableFIXS = parserFlag(node, "EnableFIXS"); + } + else if (node["EnableRealSim"]) { + // Legacy key: accept "EnableRealSim" for backward compatibility + SimulationSetup.EnableFIXS = parserFlag(node, "EnableRealSim"); } else { - SimulationSetup.EnableRealSim = true; - if (!SuppressDefaultMessages) printf("\nWill enable real sim as default!\n"); + SimulationSetup.EnableFIXS = true; + if (!SuppressDefaultMessages) printf("\nWill enable FIXS as default!\n"); } if (node["EnableVerboseLog"]) { SimulationSetup.EnableVerboseLog = parserFlag(node, "EnableVerboseLog"); @@ -951,7 +955,7 @@ void ConfigHelper::getVehSubscriptionList(Subscription_t VehSub, std::unordered_ //int len = (int) pointSubscribeId_v.size(); ss << pointSubscribeId_v.size(); //string poiName = "RealSimPOI_" + to_string(pointSubscribeId_v.size()); - string poiName = "RealSimPOI_" + ss.str(); + string poiName = "FIXS_POI_" + ss.str(); pointSubscribeId_v[poiName] = make_tuple(strtod(xlist[i].c_str(), NULL), strtod(ylist[i].c_str(), NULL), strtod(zlist[i].c_str(), NULL), strtod(rlist[i].c_str(), NULL)); } @@ -967,7 +971,7 @@ void ConfigHelper::getVehSubscriptionList(Subscription_t VehSub, std::unordered_ //int len = (int) pointSubscribeId_v.size(); ss << pointSubscribeId_v.size(); //string poiName = "RealSimPOI_" + to_string(pointSubscribeId_v.size()); - string poiName = "RealSimPOI_" + ss.str(); + string poiName = "FIXS_POI_" + ss.str(); SocketPort2SubscriptionList_um[it].VehicleList.pointSubscribeId_v[poiName] = make_tuple(strtod(xlist[i].c_str(), NULL), strtod(ylist[i].c_str(), NULL), strtod(zlist[i].c_str(), NULL), strtod(rlist[i].c_str(), NULL)); } diff --git a/CommonLib/ConfigHelper.h b/CommonLib/ConfigHelper.h index 54e9cb87..109e7ec1 100644 --- a/CommonLib/ConfigHelper.h +++ b/CommonLib/ConfigHelper.h @@ -31,7 +31,7 @@ typedef typename std::vector (errorMsgStr.c_str()); return ERROR_INIT_MSG_FIELD; } @@ -201,43 +201,43 @@ int VirEnvHelper::initialization(const char** errorMsg, const char* configPathIn Sock_c.disableServerTrigger(); Sock_c.disableWaitClientTrigger(); #ifdef RS_DEBUG - Log("RealSim serverAddr[0] %s\n", serverAddr[0].c_str()); - Log("RealSim serverPort[0] %d\n", serverPort[0]); + Log("FIXS serverAddr[0] %s\n", serverAddr[0].c_str()); + Log("FIXS serverPort[0] %d\n", serverPort[0]); #endif //Log("RealSim init socket size exit %d\n", Sock_c.serverSock.size()); if (ENABLE_REALSIM) { #ifdef RS_DEBUG - Log("RealSim socket initConnection\n"); + Log("FIXS socket initConnection\n"); #endif if (Sock_c.initConnection(CmErrorFile) > 0) { - printf("Connect to RealSim failed! Make sure start TrafficLayer first\n"); - *errorMsg = "RealSim: Initialize Socket Failed"; + printf("Connect to FIXS failed! Make sure start TrafficLayer first\n"); + *errorMsg = "FIXS: Initialize Socket Failed"; #ifdef RS_DEBUG - Log("RealSim socket initConnection failed"); + Log("FIXS socket initConnection failed"); #endif return ERROR_INIT_SOCKET; } } #ifdef RS_DEBUG - Log("RealSim socket initConnection succeed\n"); + Log("FIXS socket initConnection succeed\n"); #endif } catch (const std::exception& e) { Sock_c.socketShutdown(); std::cout << e.what(); - printf("ERROR: initialize RealSim socket failed!\n"); + printf("ERROR: initialize FIXS socket failed!\n"); *errorMsg = "RealSim: Initialize Socket Failed"; return ERROR_INIT_SOCKET; } catch (...) { Sock_c.socketShutdown(); - printf("UNKNOWN ERROR: initialize RealSim socket failed!\n"); + printf("UNKNOWN ERROR: initialize FIXS socket failed!\n"); *errorMsg = "RealSim: Initialize Socket Failed"; return ERROR_INIT_SOCKET; } - PERF_INIT("RealSimPerf.log"); + PERF_INIT("FIXSPerf.log"); return 0; } @@ -379,7 +379,7 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { catch (const std::exception& e) { std::cout << e.what(); printf("ERROR: initialize traffic object position failed!\n"); - errorMsgStr = "RealSim: Initialize Traffic Objects Failed"; + errorMsgStr = "FIXS: Initialize Traffic Objects Failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("init_cm_queue"); PERF_TOC("runStep_total"); @@ -387,7 +387,7 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { } catch (...) { printf("UNKNOWN ERROR: initialize traffic object position failed!\n"); - errorMsgStr = "RealSim: Initialize Traffic Objects Failed"; + errorMsgStr = "FIXS: Initialize Traffic Objects Failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("init_cm_queue"); PERF_TOC("runStep_total"); @@ -422,7 +422,7 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { #endif PERF_TIC("recv_socket"); if (Sock_c.recvData(Sock_c.serverSock[iS], &simStateRecv, &simTimeRecv, Msg_c) < 0) { - *errorMsg = "RealSim: Receive from traffic simulator failed"; + *errorMsg = "FIXS: Receive from traffic simulator failed"; return ERROR_STEP_RECV_REALSIM; } PERF_TOC("recv_socket"); @@ -436,14 +436,14 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { } catch (const std::exception& e) { std::cout << e.what(); - errorMsgStr = "RealSim: Receive from traffic simulator failed"; + errorMsgStr = "FIXS: Receive from traffic simulator failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("receive_realsim"); PERF_TOC("runStep_total"); return ERROR_STEP_RECV_REALSIM; } catch (...) { - errorMsgStr = "RealSim: Receive from traffic simulator failed"; + errorMsgStr = "FIXS: Receive from traffic simulator failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("receive_realsim"); PERF_TOC("runStep_total"); @@ -510,14 +510,14 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { } catch (const std::exception& e) { std::cout << e.what(); - errorMsgStr = "RealSim: Map received traffic simualtor id to CM id failed"; + errorMsgStr = "FIXS: Map received traffic simualtor id to CM id failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("map_ids"); PERF_TOC("runStep_total"); return ERROR_STEP_MAP_ID; } catch (...) { - errorMsgStr = "RealSim: Map received traffic simualtor id to CM id failed"; + errorMsgStr = "FIXS: Map received traffic simualtor id to CM id failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("map_ids"); PERF_TOC("runStep_total"); @@ -567,14 +567,14 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { } catch (const std::exception& e) { std::cout << e.what(); - errorMsgStr = "RealSim: Remove arrived vehicle id failed"; + errorMsgStr = "FIXS: Remove arrived vehicle id failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("cleanup_vehicles"); PERF_TOC("runStep_total"); return ERROR_STEP_REMOVE_ID; } catch (...) { - errorMsgStr = "RealSim: Remove arrived vehicle id failed"; + errorMsgStr = "FIXS: Remove arrived vehicle id failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("cleanup_vehicles"); PERF_TOC("runStep_total"); @@ -645,14 +645,14 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { } catch (const std::exception& e) { std::cout << e.what(); - errorMsgStr = "RealSim: Update traffic object states failed"; + errorMsgStr = "FIXS: Update traffic object states failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("update_traffic_state"); PERF_TOC("runStep_total"); return ERROR_STEP_UPDATE_STATE; } catch (...) { - errorMsgStr = "RealSim: Update traffic object states failed"; + errorMsgStr = "FIXS: Update traffic object states failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("update_traffic_state"); PERF_TOC("runStep_total"); @@ -683,14 +683,14 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { } catch (const std::exception& e) { std::cout << e.what(); - errorMsgStr = "RealSim: Sync traffic signal light failed"; + errorMsgStr = "FIXS: Sync traffic signal light failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("sync_signals"); PERF_TOC("runStep_total"); return ERROR_STEP_SYNC_TRAFFIC_SIGNAL; } catch (...) { - errorMsgStr = "RealSim: Sync traffic signal light failed"; + errorMsgStr = "FIXS: Sync traffic signal light failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("sync_signals"); PERF_TOC("runStep_total"); @@ -782,10 +782,10 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { if (send(Sock_c.serverSock[iS], sendServerBuffer, Sock_c.sendServerByte[iS], 0) != Sock_c.sendServerByte[iS]) { char buff[1000]; #ifdef WIN32 - snprintf(buff, sizeof(buff), "RealSim: Send failed, %d", WSAGetLastError()); + snprintf(buff, sizeof(buff), "FIXS: Send failed, %d", WSAGetLastError()); fprintf(stderr, "%s: %d\n", "send() failed", WSAGetLastError()); #else - snprintf(buff, sizeof(buff), "RealSim: Send failed, %d, %s", errno, strerror(errno)); + snprintf(buff, sizeof(buff), "FIXS: Send failed, %d, %s", errno, strerror(errno)); fprintf(stderr, "%s: \n", "send() failed"); #endif * errorMsg = buff; @@ -796,14 +796,14 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { } catch (const std::exception& e) { std::cout << e.what(); - errorMsgStr = "RealSim: Send ego states failed"; + errorMsgStr = "FIXS: Send ego states failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("send_ego"); PERF_TOC("runStep_total"); return ERROR_STEP_SEND_EGO; } catch (...) { - errorMsgStr = "RealSim: Send ego states failed"; + errorMsgStr = "FIXS: Send ego states failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("send_ego"); PERF_TOC("runStep_total"); @@ -939,14 +939,14 @@ int VirEnvHelper::runStep(double simTime, const char** errorMsg) { } catch (const std::exception& e) { std::cout << e.what(); - errorMsgStr = "RealSim: Refresh traffic visualization failed"; + errorMsgStr = "FIXS: Refresh traffic visualization failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("refresh_visualization"); PERF_TOC("runStep_total"); return ERROR_STEP_REFRESH_TRAFFIC; } catch (...) { - errorMsgStr = "RealSim: Refresh traffic visualization failed"; + errorMsgStr = "FIXS: Refresh traffic visualization failed"; *errorMsg = errorMsgStr.c_str(); PERF_TOC("refresh_visualization"); PERF_TOC("runStep_total"); diff --git a/TrafficLayer/TrafficLayer/mainTrafficLayer.cpp b/TrafficLayer/TrafficLayer/mainTrafficLayer.cpp index ba1344bc..7ebebfe7 100644 --- a/TrafficLayer/TrafficLayer/mainTrafficLayer.cpp +++ b/TrafficLayer/TrafficLayer/mainTrafficLayer.cpp @@ -555,7 +555,7 @@ int main(int argc, char* argv[]) { vector actualClientSock; // config Traffic Layer setup variables - if (Config_c.SimulationSetup.EnableRealSim) { + if (Config_c.SimulationSetup.EnableFIXS) { ENABLE_REALSIM = true; } else { diff --git a/tests/CoordMerge/config_SUMO.yaml b/tests/CoordMerge/config_SUMO.yaml index 12ae4b12..628cdeee 100644 --- a/tests/CoordMerge/config_SUMO.yaml +++ b/tests/CoordMerge/config_SUMO.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/CoordMerge/config_SUMOD.yaml b/tests/CoordMerge/config_SUMOD.yaml index 23cc6a59..01c52d8a 100644 --- a/tests/CoordMerge/config_SUMOD.yaml +++ b/tests/CoordMerge/config_SUMOD.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: true diff --git a/tests/CoordMerge/config_VISSIM.yaml b/tests/CoordMerge/config_VISSIM.yaml index ecfd01bc..1d34a42d 100644 --- a/tests/CoordMerge/config_VISSIM.yaml +++ b/tests/CoordMerge/config_VISSIM.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/DelayedConnection/config_SUMO.yaml b/tests/DelayedConnection/config_SUMO.yaml index f84aafb7..0290f5cf 100644 --- a/tests/DelayedConnection/config_SUMO.yaml +++ b/tests/DelayedConnection/config_SUMO.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/Elevation/RS_config.yaml b/tests/Elevation/RS_config.yaml index 66296af1..21538d2d 100644 --- a/tests/Elevation/RS_config.yaml +++ b/tests/Elevation/RS_config.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/Elevation/RS_config_release.yaml b/tests/Elevation/RS_config_release.yaml index b7c7b2f7..04144a93 100644 --- a/tests/Elevation/RS_config_release.yaml +++ b/tests/Elevation/RS_config_release.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/MultipleVissim/config_test1.yaml b/tests/MultipleVissim/config_test1.yaml index ca34546b..07a3e367 100644 --- a/tests/MultipleVissim/config_test1.yaml +++ b/tests/MultipleVissim/config_test1.yaml @@ -22,7 +22,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will run without RealSim # currently has no effect to SUMO - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log for performance EnableVerboseLog: false diff --git a/tests/MultipleVissim/config_test2.yaml b/tests/MultipleVissim/config_test2.yaml index 3cde7a14..73e26c4c 100644 --- a/tests/MultipleVissim/config_test2.yaml +++ b/tests/MultipleVissim/config_test2.yaml @@ -22,7 +22,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will run without RealSim # currently has no effect to SUMO - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log for performance EnableVerboseLog: false diff --git a/tests/Python/SimpleEchoClient/config.yaml b/tests/Python/SimpleEchoClient/config.yaml index 46fd0291..f37d402c 100644 --- a/tests/Python/SimpleEchoClient/config.yaml +++ b/tests/Python/SimpleEchoClient/config.yaml @@ -8,7 +8,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation EnableVerboseLog: false diff --git a/tests/Python/SimpleTrafficLight/config.yaml b/tests/Python/SimpleTrafficLight/config.yaml index 963b9855..3bc90e67 100644 --- a/tests/Python/SimpleTrafficLight/config.yaml +++ b/tests/Python/SimpleTrafficLight/config.yaml @@ -8,7 +8,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation EnableVerboseLog: false diff --git a/tests/Python/test_naming_consistency.py b/tests/Python/test_naming_consistency.py new file mode 100644 index 00000000..e863f275 --- /dev/null +++ b/tests/Python/test_naming_consistency.py @@ -0,0 +1,165 @@ +""" +Test that FIXS branding is consistent across key source files. + +Checks: +- C++ runtime log strings use FIXS, not legacy RealSim prefix +- ConfigHelper.h has EnableFIXS field (not EnableRealSim) +- All tests/**/config.yaml files use EnableFIXS (not EnableRealSim) + +Excludes: +- MATLAB API files (RealSimSocket.m, etc.) +- RealSimSocket.cpp (MEX S-function, name must match S_FUNCTION_NAME macro) +- archive/, tmp/ directories +- Vendor libraries: CommonLib/libsumo/, CommonLib/libevent/, CommonLib/yaml-cpp/ +- Binary files +""" + +import re +import os +import glob +import pytest + +# Root of the repository (two levels up from this file's directory) +REPO_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) + + +def _read_file(path): + with open(path, "r", encoding="utf-8", errors="replace") as f: + return f.read() + + +# --------------------------------------------------------------------------- +# Helpers +# --------------------------------------------------------------------------- + +def _find_realsim_in_log_strings(content): + """ + Return all lines where "RealSim" appears inside a string literal that is + part of a log/print/cout call. We deliberately skip: + - pure comment lines (starting with // after optional whitespace) + - lines that are #include directives + - lines that only reference file names (e.g. RealSimVersion.h) + """ + suspicious = [] + for lineno, line in enumerate(content.splitlines(), start=1): + stripped = line.strip() + # Skip comment-only lines + if stripped.startswith("//") or stripped.startswith("*") or stripped.startswith("/*"): + continue + # Skip preprocessor includes + if stripped.startswith("#include"): + continue + # Skip blank lines + if not stripped: + continue + # Look for "RealSim" inside a string literal on this line + # Regex: a double-quoted string that contains RealSim + if re.search(r'"[^"]*RealSim[^"]*"', line): + suspicious.append((lineno, line.rstrip())) + return suspicious + + +# --------------------------------------------------------------------------- +# Test 1: SocketHelper.cpp — no old "RealSim" runtime log strings +# --------------------------------------------------------------------------- + +def test_sockhelper_no_realsim_log_strings(): + path = os.path.join(REPO_ROOT, "CommonLib", "SocketHelper.cpp") + assert os.path.isfile(path), f"File not found: {path}" + content = _read_file(path) + hits = _find_realsim_in_log_strings(content) + assert hits == [], ( + f"Found legacy 'RealSim' in string literals in {path}:\n" + + "\n".join(f" line {ln}: {text}" for ln, text in hits) + ) + + +# --------------------------------------------------------------------------- +# Test 2: VirEnvHelper.cpp — no old "RealSim" in active log calls +# --------------------------------------------------------------------------- + +def test_virenvhelper_no_realsim_log_strings(): + path = os.path.join(REPO_ROOT, "CommonLib", "VirEnvHelper.cpp") + assert os.path.isfile(path), f"File not found: {path}" + content = _read_file(path) + hits = _find_realsim_in_log_strings(content) + # Filter out the commented-out block that is surrounded by /* ... */ + # We already skip // lines; the block comment lines start with * in stripped form + assert hits == [], ( + f"Found legacy 'RealSim' in string literals in {path}:\n" + + "\n".join(f" line {ln}: {text}" for ln, text in hits) + ) + + +# --------------------------------------------------------------------------- +# Test 3: TrafficHelper.cpp — no old "RealSim" vehicle type string +# --------------------------------------------------------------------------- + +def test_traffichelper_no_realsim_log_strings(): + path = os.path.join(REPO_ROOT, "CommonLib", "TrafficHelper.cpp") + assert os.path.isfile(path), f"File not found: {path}" + content = _read_file(path) + hits = _find_realsim_in_log_strings(content) + assert hits == [], ( + f"Found legacy 'RealSim' in string literals in {path}:\n" + + "\n".join(f" line {ln}: {text}" for ln, text in hits) + ) + + +# --------------------------------------------------------------------------- +# Test 4: ConfigHelper.h — struct has EnableFIXS, not EnableRealSim +# --------------------------------------------------------------------------- + +def test_confighelper_h_has_enable_fixs(): + path = os.path.join(REPO_ROOT, "CommonLib", "ConfigHelper.h") + assert os.path.isfile(path), f"File not found: {path}" + content = _read_file(path) + assert "EnableFIXS" in content, ( + f"ConfigHelper.h does not contain 'EnableFIXS' field. " + f"Was the struct renamed from EnableRealSim to EnableFIXS?" + ) + + +def test_confighelper_h_no_enable_realsim_field(): + path = os.path.join(REPO_ROOT, "CommonLib", "ConfigHelper.h") + assert os.path.isfile(path), f"File not found: {path}" + content = _read_file(path) + # The field declaration should be gone; only a comment might mention it + for lineno, line in enumerate(content.splitlines(), start=1): + stripped = line.strip() + if stripped.startswith("//") or stripped.startswith("*"): + continue + if "EnableRealSim" in line: + pytest.fail( + f"ConfigHelper.h still has 'EnableRealSim' on line {lineno}: {line.rstrip()}" + ) + + +# --------------------------------------------------------------------------- +# Test 5: All tests/**/config.yaml files use EnableFIXS, not EnableRealSim +# --------------------------------------------------------------------------- + +def _get_test_yaml_files(): + tests_dir = os.path.join(REPO_ROOT, "tests") + pattern = os.path.join(tests_dir, "**", "*.yaml") + return glob.glob(pattern, recursive=True) + + +def test_all_test_yamls_use_enable_fixs(): + yaml_files = _get_test_yaml_files() + assert yaml_files, "No YAML files found under tests/" + + violations = [] + for fpath in yaml_files: + try: + content = _read_file(fpath) + except Exception: + continue + for lineno, line in enumerate(content.splitlines(), start=1): + if "EnableRealSim" in line: + violations.append((fpath, lineno, line.rstrip())) + + assert violations == [], ( + "Found legacy 'EnableRealSim' in test YAML files (should be 'EnableFIXS'):\n" + + "\n".join(f" {fp}:{ln}: {text}" for fp, ln, text in violations) + ) diff --git a/tests/ShallowfordRdSCIL/RS_config.yaml b/tests/ShallowfordRdSCIL/RS_config.yaml index 12d9406f..c5986590 100644 --- a/tests/ShallowfordRdSCIL/RS_config.yaml +++ b/tests/ShallowfordRdSCIL/RS_config.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/ShallowfordRdSCIL/RS_config_CM.yaml b/tests/ShallowfordRdSCIL/RS_config_CM.yaml index 4b848bf2..ce4a1b0a 100644 --- a/tests/ShallowfordRdSCIL/RS_config_CM.yaml +++ b/tests/ShallowfordRdSCIL/RS_config_CM.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/SignalIpg/RS_config.yaml b/tests/SignalIpg/RS_config.yaml index 63a73192..867379d9 100644 --- a/tests/SignalIpg/RS_config.yaml +++ b/tests/SignalIpg/RS_config.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/SignalIpg/RS_config_release.yaml b/tests/SignalIpg/RS_config_release.yaml index 5a5d22ce..caea96bb 100644 --- a/tests/SignalIpg/RS_config_release.yaml +++ b/tests/SignalIpg/RS_config_release.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/SpeedLimit/config_sumo.yaml b/tests/SpeedLimit/config_sumo.yaml index 74482ed4..1d4a7247 100644 --- a/tests/SpeedLimit/config_sumo.yaml +++ b/tests/SpeedLimit/config_sumo.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/SpeedLimit/config_sumo_local.yaml b/tests/SpeedLimit/config_sumo_local.yaml index b593086a..700ead90 100644 --- a/tests/SpeedLimit/config_sumo_local.yaml +++ b/tests/SpeedLimit/config_sumo_local.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/SumoCarla/test_scenarios/Shallowford_after_calibration_banleftturn_AdjustedFixedTime_V3/defaultConfig.yaml b/tests/SumoCarla/test_scenarios/Shallowford_after_calibration_banleftturn_AdjustedFixedTime_V3/defaultConfig.yaml index a79c3ea4..6d5c10b9 100644 --- a/tests/SumoCarla/test_scenarios/Shallowford_after_calibration_banleftturn_AdjustedFixedTime_V3/defaultConfig.yaml +++ b/tests/SumoCarla/test_scenarios/Shallowford_after_calibration_banleftturn_AdjustedFixedTime_V3/defaultConfig.yaml @@ -4,7 +4,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/SumoCarla/test_scenarios/Town01_with_ego_type_as_blueprint/defaultConfig.yaml b/tests/SumoCarla/test_scenarios/Town01_with_ego_type_as_blueprint/defaultConfig.yaml index b1812cbc..61e9c5a0 100644 --- a/tests/SumoCarla/test_scenarios/Town01_with_ego_type_as_blueprint/defaultConfig.yaml +++ b/tests/SumoCarla/test_scenarios/Town01_with_ego_type_as_blueprint/defaultConfig.yaml @@ -4,7 +4,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/SumoDriver/config_SUMOdriver.yaml b/tests/SumoDriver/config_SUMOdriver.yaml index b191c0dd..637e368b 100644 --- a/tests/SumoDriver/config_SUMOdriver.yaml +++ b/tests/SumoDriver/config_SUMOdriver.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/SumoDriver/config_SUMOdriver_speedmode.yaml b/tests/SumoDriver/config_SUMOdriver_speedmode.yaml index 7540fe98..c27b6afe 100644 --- a/tests/SumoDriver/config_SUMOdriver_speedmode.yaml +++ b/tests/SumoDriver/config_SUMOdriver_speedmode.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/SumoIpg/config_RS_SimulinkRS.yaml b/tests/SumoIpg/config_RS_SimulinkRS.yaml index 7e2f7500..050f153d 100644 --- a/tests/SumoIpg/config_RS_SimulinkRS.yaml +++ b/tests/SumoIpg/config_RS_SimulinkRS.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/SumoIpg/config_RS_noSimulinkRS.yaml b/tests/SumoIpg/config_RS_noSimulinkRS.yaml index 1959a932..aa91c2b4 100644 --- a/tests/SumoIpg/config_RS_noSimulinkRS.yaml +++ b/tests/SumoIpg/config_RS_noSimulinkRS.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/TurnSignal/config_SUMO.yaml b/tests/TurnSignal/config_SUMO.yaml index 66296af1..21538d2d 100644 --- a/tests/TurnSignal/config_SUMO.yaml +++ b/tests/TurnSignal/config_SUMO.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/VissimIpg/config_vissim.yaml b/tests/VissimIpg/config_vissim.yaml index 071b3ccb..abb25b0b 100644 --- a/tests/VissimIpg/config_vissim.yaml +++ b/tests/VissimIpg/config_vissim.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/VissimSpeedLimit/config_test1.yaml b/tests/VissimSpeedLimit/config_test1.yaml index 20486e01..e1f27927 100644 --- a/tests/VissimSpeedLimit/config_test1.yaml +++ b/tests/VissimSpeedLimit/config_test1.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/VissimSpeedLimit/config_test2.yaml b/tests/VissimSpeedLimit/config_test2.yaml index d21bde17..4ec7f4d4 100644 --- a/tests/VissimSpeedLimit/config_test2.yaml +++ b/tests/VissimSpeedLimit/config_test2.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false diff --git a/tests/VissimSpeedLimit/config_test3.yaml b/tests/VissimSpeedLimit/config_test3.yaml index 606dd00c..98b21545 100644 --- a/tests/VissimSpeedLimit/config_test3.yaml +++ b/tests/VissimSpeedLimit/config_test3.yaml @@ -16,7 +16,7 @@ SimulationSetup: # Master Switch to turn on/off RealSim interface # if turned off, VISSIM will just run without RealSim # SUMO needs to run without traci - EnableRealSim: true + EnableFIXS: true # Whether or not to save verbose log during the simulation. skip log can potentially speed up EnableVerboseLog: false From 65388007bbaef86b6f53ed36c2ba9833e2eb80cb Mon Sep 17 00:00:00 2001 From: Yunli Shao Date: Thu, 12 Mar 2026 22:51:07 -0400 Subject: [PATCH 2/2] chore: bump ProprietaryFiles submodule to maintenance/128 branch --- ProprietaryFiles | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProprietaryFiles b/ProprietaryFiles index 2f6d8b8d..944e13c2 160000 --- a/ProprietaryFiles +++ b/ProprietaryFiles @@ -1 +1 @@ -Subproject commit 2f6d8b8dcaa8403ad1aaa87a903ac09a67d71615 +Subproject commit 944e13c2669be3851c975a71c30b6be136c07bb5