Return NOT_SUPPORT for set function in VM guest

Fix the unit tests which are fail in VM guest environment.

Change-Id: Id7c58887692bbdecba54f5d2d8463b292e19b4ad
Цей коміт міститься в:
Bill(Shuzhou) Liu authored and Galantsev, Dmitrii committed 2024-01-17 11:18:25 -06:00
1 джерело 147af192b5
коміт a0ec98c30d
3 files changed
+29

No files matched your search

+19
Переглянути файл
@@ -329,6 +329,25 @@ rsmi_status_t ErrnoToRsmiStatus(int err) {
}
}
bool is_vm_guest() {
// the cpuinfo will set hypervisor flag in VM guest
const std::string hypervisor = "hypervisor";
std::string line;
// default to false if cannot find the file
std::ifstream infile("/proc/cpuinfo");
if (infile.fail()) {
return false;
}
while (std::getline(infile, line)) {
if (line.find(hypervisor) != std::string::npos) {
return true;
}
}
return false;
}
std::string leftTrim(const std::string &s) {
if (!s.empty()) {
return std::regex_replace(s, std::regex("^\\s+"), "");