Module: vkd3d Branch: master Commit: f0a16d84ce939716defe41268340757da3900055 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/f0a16d84ce939716defe4126834075...
Author: Giovanni Mascellani gmascellani@codeweavers.com Date: Wed Nov 15 11:08:36 2023 +0100
ci: Execute the shader runner on the correct test data on Windows.
---
gitlab/test.yml | 3 ++- tests/driver.c | 52 ++++++++++++++++++++++++++++------------------------ 2 files changed, 30 insertions(+), 25 deletions(-)
diff --git a/gitlab/test.yml b/gitlab/test.yml index cfc4906f..65a75d0e 100644 --- a/gitlab/test.yml +++ b/gitlab/test.yml @@ -8,7 +8,8 @@ tags: - win10-21h2 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: when: always paths: diff --git a/tests/driver.c b/tests/driver.c index 504f51df..95f39adb 100644 --- a/tests/driver.c +++ b/tests/driver.c @@ -18,6 +18,7 @@
#include <stdio.h> #include <stdbool.h> +#include <stdlib.h> #include <windows.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);
if (test_count != success_count) - ret = false; + { + HANDLE handle; + + handle = CreateFileA("pipeline_failed", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (handle == INVALID_HANDLE_VALUE) + { + fprintf(stderr, "Cannot create failure file, last error %ld.\n", GetLastError()); + ret = false; + } + else + { + if (!CloseHandle(handle)) + fprintf(stderr, "Cannot close failure file, last error %ld.\n", GetLastError()); + } + }
return ret; }
-int wmain(void) +int wmain(int argc, WCHAR **wargv) { - WIN32_FIND_DATAA find_data; - HANDLE find_handle; - bool ret = true; + char commit_num[16], commit_hash[16], commit_dir[16];
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
- find_handle = FindFirstFileA("artifacts/*-*", &find_data); - if (find_handle == INVALID_HANDLE_VALUE) + if (argc != 3) { - fprintf(stderr, "Cannot list commits, last error %ld.\n", GetLastError()); - ret = false; + fprintf(stderr, "Call with commit number and hash.\n"); + return 1; } - else - { - do - { - ret &= run_tests_for_directory(find_data.cFileName); - } while (FindNextFileA(find_handle, &find_data));
- if (GetLastError() != ERROR_NO_MORE_FILES) - { - fprintf(stderr, "Cannot list tests, last error %ld.\n", GetLastError()); - ret = false; - } - - 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); }