mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-20 08:53:55 +08:00
fix: sporadic in software tags test
Related-To: NEO-9272 Signed-off-by: Konstanty Misiak <konstanty.misiak@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
10a97548c2
commit
c160e6ff93
@@ -208,7 +208,11 @@ SWTagBXML::SWTagBXML() {
|
||||
str = ss.str();
|
||||
|
||||
if (DebugManager.flags.DumpSWTagsBXML.get()) {
|
||||
writeDataToFile("swtagsbxml_dump.xml", str.c_str(), str.size());
|
||||
FILE *fp = NEO::IoFunctions::fopenPtr("swtagsbxml_dump.xml", "wb");
|
||||
if (fp) {
|
||||
NEO::IoFunctions::fwritePtr(str.c_str(), sizeof(char), str.size(), fp);
|
||||
NEO::IoFunctions::fclosePtr(fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "shared/test/common/fixtures/device_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_io_functions.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
using namespace NEO;
|
||||
@@ -258,14 +259,21 @@ TEST(SoftwareTagsBXMLTests, givenDumpSWTagsBXMLWhenConstructingBXMLThenAFileIsDu
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
DebugManager.flags.DumpSWTagsBXML.set(true);
|
||||
|
||||
const char *filename = "swtagsbxml_dump.xml";
|
||||
SWTagBXML bxml;
|
||||
uint32_t mockFopenCalledBefore = IoFunctions::mockFopenCalled;
|
||||
uint32_t mockFwriteCalledBefore = IoFunctions::mockFwriteCalled;
|
||||
uint32_t mockFcloseCalledBefore = IoFunctions::mockFcloseCalled;
|
||||
{
|
||||
SWTagBXML bxml1;
|
||||
}
|
||||
EXPECT_EQ(IoFunctions::mockFopenCalled, mockFopenCalledBefore + 1);
|
||||
EXPECT_EQ(IoFunctions::mockFwriteCalled, mockFwriteCalledBefore + 1);
|
||||
EXPECT_EQ(IoFunctions::mockFcloseCalled, mockFcloseCalledBefore + 1);
|
||||
|
||||
size_t retSize;
|
||||
auto data = loadDataFromFile(filename, retSize);
|
||||
|
||||
EXPECT_EQ(retSize, bxml.str.size());
|
||||
EXPECT_EQ(0, strcmp(data.get(), bxml.str.c_str()));
|
||||
|
||||
writeDataToFile(filename, "", 1);
|
||||
VariableBackup<FILE *> backup(&IoFunctions::mockFopenReturned, nullptr);
|
||||
{
|
||||
SWTagBXML bxml2;
|
||||
}
|
||||
EXPECT_EQ(IoFunctions::mockFopenCalled, mockFopenCalledBefore + 2);
|
||||
EXPECT_EQ(IoFunctions::mockFwriteCalled, mockFwriteCalledBefore + 1);
|
||||
EXPECT_EQ(IoFunctions::mockFcloseCalled, mockFcloseCalledBefore + 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user