SWDEV-348686 - Add extension on windows platform for executable path. (#2845)
Change-Id: Id7a9b6ec49e8f210b0a74b5f5fd68d584f005b4e
[ROCm/hip commit: 768f186d69]
This commit is contained in:
committed by
GitHub
parent
532ebaf63e
commit
94f8b620e4
@@ -66,7 +66,12 @@ class SpawnProc {
|
|||||||
auto dir = fs::path(TestContext::get().currentPath());
|
auto dir = fs::path(TestContext::get().currentPath());
|
||||||
dir /= exeName;
|
dir /= exeName;
|
||||||
exeName = dir.string();
|
exeName = dir.string();
|
||||||
|
// On Windows, fs::exists returns false without extension.
|
||||||
|
if (TestContext::get().isWindows()) {
|
||||||
|
if(fs::path(exeName).extension().empty()) {
|
||||||
|
exeName += ".exe";
|
||||||
|
}
|
||||||
|
}
|
||||||
INFO("Testing that exe exists: " << exeName);
|
INFO("Testing that exe exists: " << exeName);
|
||||||
REQUIRE(fs::exists(exeName));
|
REQUIRE(fs::exists(exeName));
|
||||||
|
|
||||||
@@ -92,13 +97,13 @@ class SpawnProc {
|
|||||||
execCmd += " > ";
|
execCmd += " > ";
|
||||||
execCmd += tmpFileName;
|
execCmd += tmpFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto res = std::system(execCmd.c_str());
|
auto res = std::system(execCmd.c_str());
|
||||||
|
|
||||||
if (captureOutput) {
|
if (captureOutput) {
|
||||||
std::ifstream t(tmpFileName.c_str());
|
std::ifstream t(tmpFileName.c_str());
|
||||||
resultStr =
|
resultStr =
|
||||||
std::string((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
|
std::string((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
|
||||||
|
t.close();
|
||||||
}
|
}
|
||||||
#if HT_LINUX
|
#if HT_LINUX
|
||||||
return WEXITSTATUS(res);
|
return WEXITSTATUS(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user