ci: Execute the shader runner on the correct test data on Windows.

This commit is contained in:
Giovanni Mascellani 2023-11-15 11:08:36 +01:00 committed by Alexandre Julliard
parent 50a56f6aeb
commit f0a16d84ce
Notes: Alexandre Julliard 2023-11-23 22:49:33 +01:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/474
2 changed files with 31 additions and 26 deletions

View File

@ -8,7 +8,8 @@
tags: tags:
- win10-21h2 - win10-21h2
script: script:
- ./artifacts/driver.cross64.exe - git rebase $CI_MERGE_REQUEST_DIFF_BASE_SHA --exec './artifacts/driver.cross64.exe $(git cherry $CI_MERGE_REQUEST_DIFF_BASE_SHA HEAD^ | wc -l) $(git rev-parse --short HEAD)'
- if (Test-Path "pipeline_failed") { exit 1 }
artifacts: artifacts:
when: always when: always
paths: paths:

View File

@ -18,6 +18,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h>
#include <windows.h> #include <windows.h>
#include <shlobj.h> #include <shlobj.h>
@ -215,40 +216,43 @@ static bool run_tests_for_directory(const char *commit_dir)
printf("# FAIL: %u\n", test_count - success_count); printf("# FAIL: %u\n", test_count - success_count);
if (test_count != success_count) if (test_count != success_count)
ret = false;
return ret;
}
int wmain(void)
{ {
WIN32_FIND_DATAA find_data; HANDLE handle;
HANDLE find_handle;
bool ret = true;
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); handle = CreateFileA("pipeline_failed", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (handle == INVALID_HANDLE_VALUE)
find_handle = FindFirstFileA("artifacts/*-*", &find_data);
if (find_handle == INVALID_HANDLE_VALUE)
{ {
fprintf(stderr, "Cannot list commits, last error %ld.\n", GetLastError()); fprintf(stderr, "Cannot create failure file, last error %ld.\n", GetLastError());
ret = false; ret = false;
} }
else else
{ {
do if (!CloseHandle(handle))
fprintf(stderr, "Cannot close failure file, last error %ld.\n", GetLastError());
}
}
return ret;
}
int wmain(int argc, WCHAR **wargv)
{ {
ret &= run_tests_for_directory(find_data.cFileName); char commit_num[16], commit_hash[16], commit_dir[16];
} while (FindNextFileA(find_handle, &find_data));
if (GetLastError() != ERROR_NO_MORE_FILES) SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
if (argc != 3)
{ {
fprintf(stderr, "Cannot list tests, last error %ld.\n", GetLastError()); fprintf(stderr, "Call with commit number and hash.\n");
ret = false; return 1;
} }
FindClose(find_handle); WideCharToMultiByte(CP_ACP, 0, wargv[1], -1, commit_num, sizeof(commit_num), NULL, NULL);
} WideCharToMultiByte(CP_ACP, 0, wargv[2], -1, commit_hash, sizeof(commit_hash), NULL, NULL);
commit_num[sizeof(commit_num) - 1] = '\0';
commit_hash[sizeof(commit_hash) - 1] = '\0';
snprintf(commit_dir, sizeof(commit_dir), "%03d-%s", atoi(commit_num), commit_hash);
commit_dir[sizeof(commit_dir) - 1] = '\0';
return !ret; return !run_tests_for_directory(commit_dir);
} }