MCPcopy Create free account
hub / github.com/GameTechDev/PresentMon / wmain

Function wmain

Tests/PresentMonTests.cpp:132–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132int wmain(
133 int argc,
134 wchar_t** argv)
135{
136 // Set defaults
137 std::wstring goldDir(L"../../Tests/Gold");
138
139 // Check for additional test directory from environment variable
140 // This allows developers to specify their own test directories without
141 // modifying the source code. Set PRESENTMON_ADDITIONAL_TEST_DIR environment
142 // variable or use a .runsettings.user file (see template).
143 std::wstring additionalTestDir;
144 wchar_t* envTestDir = nullptr;
145 size_t envTestDirLen = 0;
146 if (_wdupenv_s(&envTestDir, &envTestDirLen, L"PRESENTMON_ADDITIONAL_TEST_DIR") == 0 && envTestDir != nullptr) {
147 additionalTestDir = envTestDir;
148 free(envTestDir);
149 }
150
151 {
152 // If exe == <dir>/PresentMonTests-<ver>-<platform>.exe use
153 // <dir>/PresentMon-<ver>-<platform>.exe as the default PresentMon
154 // path. Otherwise use same the same <dir> but reconstruct
155 // <ver>/<platform> from version header and compiler macros.
156 wchar_t path[MAX_PATH];
157 GetModuleFileName(NULL, path, _countof(path));
158 PresentMon::exePath_.assign(path);
159 size_t i = PresentMon::exePath_.size();
160 for (; i > 0; --i) {
161 if (PresentMon::exePath_[i] == '/' || PresentMon::exePath_[i] == '\\') {
162 i += 1;
163 break;
164 }
165 }
166 if (PresentMon::exePath_.compare(i, 15, L"PresentMonTests") == 0) {
167 PresentMon::exePath_.erase(i + 10, 5);
168 } else {
169 PresentMon::exePath_.erase(i);
170 PresentMon::exePath_ += L"PresentMon-";
171 if (isdigit(*PRESENT_MON_VERSION)) {
172 PresentMon::exePath_ += L"dev";
173 } else {
174 PresentMon::exePath_ += Convert(PRESENT_MON_VERSION);
175 }
176 #ifdef _WIN64
177 #ifdef _M_ARM64
178 PresentMon::exePath_ += L"-ARM64.exe";
179 #else
180 PresentMon::exePath_ += L"-x64.exe";
181 #endif
182 #else
183 #ifdef _M_ARM
184 PresentMon::exePath_ += L"-ARM.exe";
185 #else
186 PresentMon::exePath_ += L"-x86.exe";
187 #endif
188 #endif
189 }

Callers

nothing calls this directly

Calls 7

CheckPathFunction · 0.85
AddGoldEtlCsvTestsFunction · 0.85
EnsureDirectoryCreatedFunction · 0.85
DeleteDirectoryFunction · 0.85
emptyMethod · 0.80
ConvertFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected