blob: 5c727aabedf02a1cb60dcfe903ccddf36ccb0b19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include "test-base.h"
#ifdef _WIN32
#include <windows.h>
#include <shellapi.h>
#endif
int TestBase::parseOption(int argc, char** argv)
{
// We only make the parse in a very loose way for only extracting the test option.
#ifdef _WIN32
wchar_t** szArglist;
szArglist = CommandLineToArgvW(GetCommandLineW(), &argc);
#endif
for (int i = 0; i < argc; i++)
{
#ifdef _WIN32
if (wcscmp(szArglist[i], L"--test-mode") == 0)
#else
if (strcmp(argv[i], "--test-mode") == 0)
#endif
{
m_isTestMode = true;
}
}
return 0;
}
void TestBase::printEntrypointHashes(int entryPointCount, int targetCount, ComPtr<slang::IComponentType>& composedProgram)
{
for (int targetIndex = 0; targetIndex < targetCount; targetIndex++)
{
for (int entryPointIndex = 0; entryPointIndex < entryPointCount; entryPointIndex++)
{
ComPtr<slang::IBlob> entryPointHashBlob;
composedProgram->getEntryPointHash(entryPointIndex, targetIndex, entryPointHashBlob.writeRef());
Slang::StringBuilder strBuilder;
strBuilder << "entrypoint: "<< entryPointIndex << ", target: " << targetIndex << ", hash: ";
uint8_t* buffer = (uint8_t*)entryPointHashBlob->getBufferPointer();
for (size_t i = 0; i < entryPointHashBlob->getBufferSize(); i++)
{
strBuilder<<Slang::StringUtil::makeStringWithFormat("%.2X", buffer[i]);
}
fprintf(stdout, "%s\n", strBuilder.begin());
}
}
}
|