at master 12 kB view raw
1diff --git a/common/LsHw.cpp b/common/LsHw.cpp 2index 8d0f35cd89..12fe26957f 100644 3--- a/common/LsHw.cpp 4+++ b/common/LsHw.cpp 5@@ -145,7 +145,7 @@ 6 { 7 static std::string const cmd = "lshw -json"; 8 std::string cmdOutput; 9- static std::array<std::string, 2> const cmdPathPrefix { "/usr/bin/", "/usr/sbin/" }; 10+ static std::array<std::string, 1> const cmdPathPrefix { "@lshw@/bin/" }; 11 12 dcgmReturn_t result = DCGM_ST_OK; 13 for (auto const &prefix : cmdPathPrefix) 14@@ -162,4 +162,4 @@ 15 } 16 17 return cmdOutput; 18-} 19\ No newline at end of file 20+} 21diff --git a/common/tests/LsHwTests.cpp b/common/tests/LsHwTests.cpp 22index edb65e599e..5950fb8d9e 100644 23--- a/common/tests/LsHwTests.cpp 24+++ b/common/tests/LsHwTests.cpp 25@@ -609,7 +609,7 @@ 26 std::unique_ptr<MockRunningUserChecker> checker = std::make_unique<MockRunningUserChecker>(); 27 checker->MockIsRoot(true); 28 std::unique_ptr<MockRunCmdHelper> runCmdHelper = std::make_unique<MockRunCmdHelper>(); 29- runCmdHelper->MockCmdOutput("/usr/bin/lshw -json", DCGM_ST_OK, lshwMultipleCpusAbridgedValidJson); 30+ runCmdHelper->MockCmdOutput("@lshw@/bin/lshw -json", DCGM_ST_OK, lshwMultipleCpusAbridgedValidJson); 31 32 LsHw lshw; 33 lshw.SetChecker(std::move(checker)); 34@@ -626,7 +626,7 @@ 35 std::unique_ptr<MockRunningUserChecker> checker = std::make_unique<MockRunningUserChecker>(); 36 checker->MockIsRoot(true); 37 std::unique_ptr<MockRunCmdHelper> runCmdHelper = std::make_unique<MockRunCmdHelper>(); 38- runCmdHelper->MockCmdOutput("/usr/bin/lshw -json", DCGM_ST_OK, lshwSingleCpuAbridgedValidJson); 39+ runCmdHelper->MockCmdOutput("@lshw@/bin/lshw -json", DCGM_ST_OK, lshwSingleCpuAbridgedValidJson); 40 41 LsHw lshw; 42 lshw.SetChecker(std::move(checker)); 43@@ -642,7 +642,7 @@ 44 std::unique_ptr<MockRunningUserChecker> checker = std::make_unique<MockRunningUserChecker>(); 45 checker->MockIsRoot(true); 46 std::unique_ptr<MockRunCmdHelper> runCmdHelper = std::make_unique<MockRunCmdHelper>(); 47- runCmdHelper->MockCmdOutput("/usr/bin/lshw -json", DCGM_ST_OK, lshwSingleCpuNoSerialNumberAbridgedValidJson); 48+ runCmdHelper->MockCmdOutput("@lshw@/bin/lshw -json", DCGM_ST_OK, lshwSingleCpuNoSerialNumberAbridgedValidJson); 49 50 LsHw lshw; 51 lshw.SetChecker(std::move(checker)); 52@@ -658,7 +658,7 @@ 53 std::unique_ptr<MockRunningUserChecker> checker = std::make_unique<MockRunningUserChecker>(); 54 checker->MockIsRoot(true); 55 std::unique_ptr<MockRunCmdHelper> runCmdHelper = std::make_unique<MockRunCmdHelper>(); 56- runCmdHelper->MockCmdOutput("/usr/bin/lshw -json", DCGM_ST_OK, lshwSingleNonNvidiaCpuAbridgedValidJson); 57+ runCmdHelper->MockCmdOutput("@lshw@/bin/lshw -json", DCGM_ST_OK, lshwSingleNonNvidiaCpuAbridgedValidJson); 58 59 LsHw lshw; 60 lshw.SetChecker(std::move(checker)); 61@@ -673,7 +673,7 @@ 62 std::unique_ptr<MockRunningUserChecker> checker = std::make_unique<MockRunningUserChecker>(); 63 checker->MockIsRoot(true); 64 std::unique_ptr<MockRunCmdHelper> runCmdHelper = std::make_unique<MockRunCmdHelper>(); 65- runCmdHelper->MockCmdOutput("/usr/bin/lshw -json", DCGM_ST_OK, lshwIncorrectIdValueTypeJson); 66+ runCmdHelper->MockCmdOutput("@lshw@/bin/lshw -json", DCGM_ST_OK, lshwIncorrectIdValueTypeJson); 67 68 LsHw lshw; 69 lshw.SetChecker(std::move(checker)); 70@@ -687,7 +687,7 @@ 71 std::unique_ptr<MockRunningUserChecker> checker = std::make_unique<MockRunningUserChecker>(); 72 checker->MockIsRoot(true); 73 std::unique_ptr<MockRunCmdHelper> runCmdHelper = std::make_unique<MockRunCmdHelper>(); 74- runCmdHelper->MockCmdOutput("/usr/bin/lshw -json", DCGM_ST_OK, lshwMissingCpuJson); 75+ runCmdHelper->MockCmdOutput("@lshw@/bin/lshw -json", DCGM_ST_OK, lshwMissingCpuJson); 76 77 LsHw lshw; 78 lshw.SetChecker(std::move(checker)); 79@@ -702,7 +702,7 @@ 80 std::unique_ptr<MockRunningUserChecker> checker = std::make_unique<MockRunningUserChecker>(); 81 checker->MockIsRoot(true); 82 std::unique_ptr<MockRunCmdHelper> runCmdHelper = std::make_unique<MockRunCmdHelper>(); 83- runCmdHelper->MockCmdOutput("/usr/bin/lshw -json", DCGM_ST_OK, lshwBadSyntaxJson); 84+ runCmdHelper->MockCmdOutput("@lshw@/bin/lshw -json", DCGM_ST_OK, lshwBadSyntaxJson); 85 86 LsHw lshw; 87 lshw.SetChecker(std::move(checker)); 88@@ -716,6 +716,7 @@ 89 { 90 SECTION("Will try /usr/sbin/") 91 { 92+ SKIP("Nixpkgs patches this out"); 93 std::unique_ptr<MockRunningUserChecker> checker = std::make_unique<MockRunningUserChecker>(); 94 checker->MockIsRoot(true); 95 std::unique_ptr<MockRunCmdHelper> runCmdHelper = std::make_unique<MockRunCmdHelper>(); 96@@ -730,4 +731,4 @@ 97 REQUIRE(cpuSerials.value()[0] == "0x000000017820B1C80400000015FF81C0"); 98 REQUIRE(cpuSerials.value()[1] == "0x000000017820B1C8040000000A0200C0"); 99 } 100-} 101\ No newline at end of file 102+} 103diff --git a/modules/diag/DcgmDiagManager.cpp b/modules/diag/DcgmDiagManager.cpp 104index d0a75dcede..ccd4347719 100644 105--- a/modules/diag/DcgmDiagManager.cpp 106+++ b/modules/diag/DcgmDiagManager.cpp 107@@ -253,7 +253,7 @@ 108 int result; 109 110 // Default NVVS binary path 111- cmd = "/usr/libexec/datacenter-gpu-manager-4/nvvs"; 112+ cmd = "@dcgm_out@/libexec/datacenter-gpu-manager-4/nvvs"; 113 114 // Check for NVVS binary path enviroment variable 115 value = std::getenv("NVVS_BIN_PATH"); 116diff --git a/modules/mndiag/dcgm_mndiag_structs.hpp b/modules/mndiag/dcgm_mndiag_structs.hpp 117index 40e61a8fd0..7e43ce8bed 100644 118--- a/modules/mndiag/dcgm_mndiag_structs.hpp 119+++ b/modules/mndiag/dcgm_mndiag_structs.hpp 120@@ -33,8 +33,8 @@ 121 constexpr std::string_view ENV_ALLOW_RUN_AS_ROOT = "DCGM_MPIRUN_ALLOW_RUN_AS_ROOT"; 122 123 // Default paths 124-constexpr std::string_view DEFAULT_MPIRUN_PATH = "/usr/bin/mpirun"; 125-constexpr std::string_view DEFAULT_MNUBERGEMM_PATH = "/usr/libexec/datacenter-gpu-manager-4/plugins/cuda12/mnubergemm"; 126+constexpr std::string_view DEFAULT_MPIRUN_PATH = "@mpi@/bin/mpirun"; 127+constexpr std::string_view DEFAULT_MNUBERGEMM_PATH = "@dcgm_out@/libexec/datacenter-gpu-manager-4/plugins/cuda12/mnubergemm"; 128 } //namespace MnDiagConstants 129 130 // Message types 131diff --git a/modules/mndiag/tests/MnDiagManagerTests.cpp b/modules/mndiag/tests/MnDiagManagerTests.cpp 132index 40dbda3b72..5ec8dafa1c 100644 133--- a/modules/mndiag/tests/MnDiagManagerTests.cpp 134+++ b/modules/mndiag/tests/MnDiagManagerTests.cpp 135@@ -2228,7 +2228,7 @@ 136 mockStateMachine->SetMnubergemmPathCallback([&capturedPath](std::string const &path) { capturedPath = path; }); 137 138 // Set env to custom path 139- std::string customPath = "/bin/true"; 140+ std::string customPath = "@coreutils@/bin/true"; 141 setenv(MnDiagConstants::ENV_MNUBERGEMM_PATH.data(), customPath.c_str(), 1); 142 143 auto mockCoreProxy = std::make_unique<MockDcgmCoreProxy>(); 144@@ -3112,7 +3112,7 @@ 145 { 146 // Save current environment state 147 auto savedPath = saveEnvVar(MnDiagConstants::ENV_MNUBERGEMM_PATH.data()); 148- std::string customPath = "/bin/true"; 149+ std::string customPath = "@coreutils@/bin/true"; 150 setenv(MnDiagConstants::ENV_MNUBERGEMM_PATH.data(), customPath.c_str(), 1); 151 152 // Setup mock DCGM API with callback to inspect request 153@@ -3251,7 +3251,7 @@ 154 auto savedPath = saveEnvVar(MnDiagConstants::ENV_MNUBERGEMM_PATH.data()); 155 156 // Use a known executable that exists 157- std::string customPath = "/bin/true"; 158+ std::string customPath = "@coreutils@/bin/true"; 159 setenv(MnDiagConstants::ENV_MNUBERGEMM_PATH.data(), customPath.c_str(), 1); 160 161 // Call the method and verify path 162diff --git a/modules/mndiag/tests/MnDiagProcessUtilsTests.cpp b/modules/mndiag/tests/MnDiagProcessUtilsTests.cpp 163index 633e327c42..168ed91db2 100644 164--- a/modules/mndiag/tests/MnDiagProcessUtilsTests.cpp 165+++ b/modules/mndiag/tests/MnDiagProcessUtilsTests.cpp 166@@ -71,7 +71,7 @@ 167 { 168 // Start a long-running process 169 DcgmNs::Common::Subprocess::ChildProcessBuilder builder; 170- builder.SetExecutable("/bin/sleep").AddArg("0.5"); 171+ builder.SetExecutable("@coreutils@/bin/sleep").AddArg("0.5"); 172 173 IoContext ioContext {}; 174 auto process = std::make_unique<DcgmNs::Common::Subprocess::ChildProcess>(builder.Build(ioContext)); 175@@ -155,4 +155,4 @@ 176 177 REQUIRE(result.empty()); 178 } 179-} 180\ No newline at end of file 181+} 182diff --git a/modules/mndiag/tests/MpiRunnerTests.cpp b/modules/mndiag/tests/MpiRunnerTests.cpp 183index 526c80fd47..1e8596d3b7 100755 184--- a/modules/mndiag/tests/MpiRunnerTests.cpp 185+++ b/modules/mndiag/tests/MpiRunnerTests.cpp 186@@ -60,7 +60,7 @@ 187 188 std::string GetMpiBinPath() const override 189 { 190- return "/bin/bash"; 191+ return "@shell@"; 192 } 193 194 private: 195@@ -138,9 +138,9 @@ 196 runner.ConstructMpiCommand(&config); 197 198 // Verify command construction 199- REQUIRE(runner.GetMpiBinPath() == "/bin/bash"); 200+ REQUIRE(runner.GetMpiBinPath() == "@shell@"); 201 std::string fullCommand = runner.GetLastCommand(); 202- REQUIRE(fullCommand.find("/bin/bash -c") != std::string::npos); 203+ REQUIRE(fullCommand.find("@shell@ -c") != std::string::npos); 204 REQUIRE(fullCommand.find("sleep 1") != std::string::npos); 205 REQUIRE(fullCommand.find("Output from sleep process") != std::string::npos); 206 207@@ -244,4 +244,4 @@ 208 // Test with invalid parameter (null pointer) 209 REQUIRE(runner.PopulateResponse(nullptr, nodeInfoMap_t()) == DCGM_ST_BADPARAM); 210 } 211-} 212\ No newline at end of file 213+} 214diff --git a/modules/sysmon/DcgmCpuTopology.cpp b/modules/sysmon/DcgmCpuTopology.cpp 215index 786d3877fc..ccbeccc81d 100644 216--- a/modules/sysmon/DcgmCpuTopology.cpp 217+++ b/modules/sysmon/DcgmCpuTopology.cpp 218@@ -136,7 +136,7 @@ 219 { 220 static std::string cmd = "lscpu --json"; 221 std::string cmdOutput; 222- static std::array<std::string, 2> cmdPathPrefix = { "/usr/bin/", "/usr/sbin/" }; 223+ static std::array<std::string, 1> cmdPathPrefix = { "@util-linux@/bin/" }; 224 225 dcgmReturn_t result = DCGM_ST_OK; 226 for (auto const &prefix : cmdPathPrefix) 227diff --git a/nvvs/plugin_src/nvbandwidth/NVBandwidthPlugin.cpp b/nvvs/plugin_src/nvbandwidth/NVBandwidthPlugin.cpp 228index 261bba4490..4d439ad452 100644 229--- a/nvvs/plugin_src/nvbandwidth/NVBandwidthPlugin.cpp 230+++ b/nvvs/plugin_src/nvbandwidth/NVBandwidthPlugin.cpp 231@@ -238,7 +238,7 @@ 232 std::vector<std::string> const search_paths 233 = { GetCurrentModuleLocation(), 234 fmt::format("./apps/nvvs/plugins/cuda{}", m_cudaDriverMajorVersion), 235- fmt::format("/usr/libexec/datacenter-gpu-manager-4/plugins/cuda{}", m_cudaDriverMajorVersion), 236+ fmt::format("@dcgm_out@/libexec/datacenter-gpu-manager-4/plugins/cuda{}", m_cudaDriverMajorVersion), 237 GetNvvsBinCheckPath(m_cudaDriverMajorVersion) }; 238 std::stringstream path_buf; 239 240diff --git a/testing/TestDiagManager.cpp b/testing/TestDiagManager.cpp 241index 8087123a49..a6333b3a3d 100644 242--- a/testing/TestDiagManager.cpp 243+++ b/testing/TestDiagManager.cpp 244@@ -236,7 +236,7 @@ 245 if (nvvsPathEnv) 246 nvvsBinPath = std::string(nvvsPathEnv) + "/nvvs"; 247 else 248- nvvsBinPath = "/usr/libexec/datacenter-gpu-manager-4/nvvs"; 249+ nvvsBinPath = "@dcgm_out@/libexec/datacenter-gpu-manager-4/nvvs"; 250 251 std::string diagResponseVersionArg = fmt::format("--response-version {}", dcgmDiagResponse_version12); 252 expected.push_back(nvvsBinPath + " --channel-fd 3 " + diagResponseVersionArg