tint/test-runner: Split expectations for FXC and DXC

Change tint's `--fxc` flag to take the path of the FXC compiler DLL.
Have tint attempt to validate with both FXC and DXC if `--validate` is
passed.

Fix the 'dirsWithNoPassExpectations' logic which looks like it got
broken with the tint -> dawn merge. It also incorrectly applied
filepath.FromSlash() on windows.

Change-Id: I0f46aa5c21bc48a2abc48402c41f846aff4a8633
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/96800
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
Ben Clayton
2022-07-22 17:43:27 +00:00
committed by Dawn LUCI CQ
parent 0778d9a48f
commit 7d34de88f1
5122 changed files with 73624 additions and 206 deletions

View File

@@ -16,9 +16,12 @@
#define WIN32_LEAN_AND_MEAN 1
#include <Windows.h>
#include <dbghelp.h>
#include <sstream>
#include <string>
#include "src/tint/utils/defer.h"
namespace tint::utils {
namespace {
@@ -97,9 +100,34 @@ class Pipe {
Handle write;
};
/// Queries whether the file at the given path is an executable or DLL.
bool ExecutableExists(const std::string& path) {
DWORD type = 0;
return GetBinaryTypeA(path.c_str(), &type);
auto file = Handle(CreateFileA(path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_READONLY, NULL));
if (!file) {
return false;
}
auto map = Handle(CreateFileMappingA(file, NULL, PAGE_READONLY, 0, 0, NULL));
if (map == INVALID_HANDLE_VALUE) {
return false;
}
void* addr_header = MapViewOfFileEx(map, FILE_MAP_READ, 0, 0, 0, NULL);
// Dynamically obtain the address of, and call ImageNtHeader. This is done to avoid tint.exe
// needing to statically link Dbghelp.lib.
static auto* dbg_help = LoadLibraryA("Dbghelp.dll"); // Leaks, but who cares?
if (dbg_help) {
if (FARPROC proc = GetProcAddress(dbg_help, "ImageNtHeader")) {
using ImageNtHeaderPtr = decltype(&ImageNtHeader);
auto* image_nt_header = reinterpret_cast<ImageNtHeaderPtr>(proc)(addr_header);
return image_nt_header != nullptr;
}
}
// Couldn't call ImageNtHeader, assume it is executable
return false;
}
std::string FindExecutable(const std::string& name) {
@@ -187,7 +215,8 @@ Command::Output Command::Exec(std::initializer_list<std::string> arguments) cons
&si, // Pointer to STARTUPINFO structure
&pi)) { // Pointer to PROCESS_INFORMATION structure
Output out;
out.err = "Command::Exec() CreateProcess() failed";
out.err = "Command::Exec() CreateProcess('" + args.str() + "') failed";
out.error_code = 1;
return out;
}