SWDEV-389689 - Rework oversubscription test to use threads instead of process. Also consider system memory when oversubscribing (#317)
Change-Id: If063552e9e2815f07e944259237310f6fef37ad5
This commit is contained in:
committed by
GitHub
parent
15c91808cc
commit
329a350ec0
@@ -31,6 +31,8 @@ THE SOFTWARE.
|
||||
#include <random>
|
||||
#include <fstream>
|
||||
#include <streambuf>
|
||||
#include <thread>
|
||||
#include <future>
|
||||
|
||||
namespace hip {
|
||||
/*
|
||||
@@ -46,6 +48,7 @@ class SpawnProc {
|
||||
std::string exeName;
|
||||
std::string resultStr;
|
||||
std::string tmpFileName;
|
||||
std::future<int> ret_from_run;
|
||||
bool captureOutput;
|
||||
|
||||
std::string getRandomString(size_t len = 6) {
|
||||
@@ -68,7 +71,7 @@ class SpawnProc {
|
||||
exeName = dir.string();
|
||||
// On Windows, fs::exists returns false without extension.
|
||||
if (TestContext::get().isWindows()) {
|
||||
if(fs::path(exeName).extension().empty()) {
|
||||
if (fs::path(exeName).extension().empty()) {
|
||||
exeName += ".exe";
|
||||
}
|
||||
}
|
||||
@@ -112,6 +115,15 @@ class SpawnProc {
|
||||
#endif
|
||||
}
|
||||
|
||||
void run_async(std::string commandLineArgs = "") {
|
||||
ret_from_run = std::async(std::launch::async, &hip::SpawnProc::run, this, commandLineArgs);
|
||||
}
|
||||
|
||||
int wait() {
|
||||
ret_from_run.wait();
|
||||
return ret_from_run.get();
|
||||
}
|
||||
|
||||
std::string getOutput() { return resultStr; }
|
||||
};
|
||||
} // namespace hip
|
||||
|
||||
Reference in New Issue
Block a user