This depends on !412, and might need some finishing touches before being ready.
-- v4: ci: Run shader tests on Windows. ci: Run cross tests on Windows.
From: Giovanni Mascellani gmascellani@codeweavers.com
--- gitlab/build-crosstest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gitlab/build-crosstest b/gitlab/build-crosstest index 38eb3e110..4a1341a09 100755 --- a/gitlab/build-crosstest +++ b/gitlab/build-crosstest @@ -14,7 +14,7 @@ set -Eeuxo pipefail rm -fr build mkdir build cd build -../configure CROSSCC32="i686-w64-mingw32-gcc" CROSSCC64="x86_64-w64-mingw32-gcc" CFLAGS="-g -O2 -Wno-array-bounds -Werror" && \ +../configure CROSSCC64="x86_64-w64-mingw32-gcc -Wno-array-bounds -Werror" CROSSCC32="i686-w64-mingw32-gcc -Wno-array-bounds -Werror" && \ make -j$(nproc) crosstest || \ touch ../pipeline_failed
From: Giovanni Mascellani gmascellani@codeweavers.com
They are not allowed by the native compiler, except in compatibility mode. --- Makefile.am | 1 + tests/hlsl/asfloat.shader_test | 4 ++-- tests/hlsl/asuint.shader_test | 4 ++-- tests/hlsl/cast-to-float.shader_test | 4 ++-- tests/hlsl/cast-to-int.shader_test | 4 ++-- tests/hlsl/cast-to-uint.shader_test | 4 ++-- tests/hlsl/half.shader_test | 23 +++++++++++++++++++++++ 7 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 tests/hlsl/half.shader_test
diff --git a/Makefile.am b/Makefile.am index 8364aaa37..2821ddc6f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -98,6 +98,7 @@ vkd3d_shader_tests = \ tests/hlsl/gather-offset.shader_test \ tests/hlsl/gather.shader_test \ tests/hlsl/getdimensions.shader_test \ + tests/hlsl/half.shader_test \ tests/hlsl/initializer-flatten.shader_test \ tests/hlsl/initializer-implicit-array.shader_test \ tests/hlsl/initializer-invalid-arg-count.shader_test \ diff --git a/tests/hlsl/asfloat.shader_test b/tests/hlsl/asfloat.shader_test index 00238164c..d2c0f9aab 100644 --- a/tests/hlsl/asfloat.shader_test +++ b/tests/hlsl/asfloat.shader_test @@ -5,7 +5,7 @@ shader model >= 4.0 uniform float f; uniform int i; uniform uint u; -uniform half h; +uniform float h;
float4 main() : sv_target { @@ -14,7 +14,7 @@ float4 main() : sv_target ret.x = asfloat(f); ret.y = asfloat(i); ret.z = asfloat(u); - ret.w = asfloat(h); + ret.w = asfloat((half)h); return ret; }
diff --git a/tests/hlsl/asuint.shader_test b/tests/hlsl/asuint.shader_test index 494229e7e..0a2e39e53 100644 --- a/tests/hlsl/asuint.shader_test +++ b/tests/hlsl/asuint.shader_test @@ -5,7 +5,7 @@ shader model >= 4.0 uniform float f; uniform int i; uniform uint u; -uniform half h; +uniform float h;
float4 main() : sv_target { @@ -14,7 +14,7 @@ float4 main() : sv_target ret.x = asuint(f); ret.y = asuint(i); ret.z = asuint(u); - ret.w = asuint(h); + ret.w = asuint((half)h); return ret; }
diff --git a/tests/hlsl/cast-to-float.shader_test b/tests/hlsl/cast-to-float.shader_test index 69786eccc..7c32acfa3 100644 --- a/tests/hlsl/cast-to-float.shader_test +++ b/tests/hlsl/cast-to-float.shader_test @@ -5,11 +5,11 @@ shader model >= 4.0 uniform int i; uniform uint u; uniform bool b; -uniform half h; +uniform float h;
float4 main() : sv_target { - return float4(((float)i) + 1.5, ((float)u) - 2.5, ((float)b) / 2, h); + return float4(((float)i) + 1.5, ((float)u) - 2.5, ((float)b) / 2, (half)h); }
[test] diff --git a/tests/hlsl/cast-to-int.shader_test b/tests/hlsl/cast-to-int.shader_test index efa60eed1..ae566a039 100644 --- a/tests/hlsl/cast-to-int.shader_test +++ b/tests/hlsl/cast-to-int.shader_test @@ -5,7 +5,7 @@ shader model >= 4.0 uniform float f; uniform uint u; uniform bool b; -uniform half h; +uniform float h;
float4 main() : sv_target { @@ -14,7 +14,7 @@ float4 main() : sv_target ret.x = ((float)(int)f) - 1.5; ret.y = ((float)(int)u) + 2.5; ret.z = ((float)(int)b) / 2; - ret.w = ((float)(int)h) + 3.5; + ret.w = ((float)(int)(half)h) + 3.5; return ret; }
diff --git a/tests/hlsl/cast-to-uint.shader_test b/tests/hlsl/cast-to-uint.shader_test index 668538554..dece99b75 100644 --- a/tests/hlsl/cast-to-uint.shader_test +++ b/tests/hlsl/cast-to-uint.shader_test @@ -5,7 +5,7 @@ shader model >= 4.0 uniform float f; uniform int i; uniform bool b; -uniform half h; +uniform float h;
float4 main() : sv_target { @@ -14,7 +14,7 @@ float4 main() : sv_target ret.x = ((float)(uint)f) - 1.5; ret.y = ((float)(uint)i) - 1.5; ret.z = ((float)(uint)b) / 2; - ret.w = ((float)(uint)h) + 0.5; + ret.w = ((float)(uint)(half)h) + 0.5; return ret; }
diff --git a/tests/hlsl/half.shader_test b/tests/hlsl/half.shader_test new file mode 100644 index 000000000..956102359 --- /dev/null +++ b/tests/hlsl/half.shader_test @@ -0,0 +1,23 @@ +[pixel shader fail(sm<6) todo] +uniform half h; + +float4 main() : sv_target +{ + return 0; +} + +[require] +options: backcompat + +[pixel shader] +uniform half h; + +float4 main() : sv_target +{ + return h; +} + +[test] +uniform 0 float 10.0 +todo(sm>=6) draw quad +probe all rgba (10.0, 10.0, 10.0, 10.0)
From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/hlsl/sign.shader_test | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tests/hlsl/sign.shader_test b/tests/hlsl/sign.shader_test index c56d90823..54b953681 100644 --- a/tests/hlsl/sign.shader_test +++ b/tests/hlsl/sign.shader_test @@ -44,6 +44,10 @@ uniform 4 float4 3.0 4.0 0.0 0.0 todo(sm>=6) draw quad probe all rgba (1.0, 1.0, 1.0, 1.0)
+[require] +% SM1-3 doesn't support integral types +shader model >= 4.0 + [pixel shader] uniform int f;
From: Giovanni Mascellani gmascellani@codeweavers.com
The irrelevant input caused the test to fail on D3D12 for reasons unrelated to the test's goal. --- tests/hlsl/object-references.shader_test | 1 - 1 file changed, 1 deletion(-)
diff --git a/tests/hlsl/object-references.shader_test b/tests/hlsl/object-references.shader_test index e7b2bef06..ff405559c 100644 --- a/tests/hlsl/object-references.shader_test +++ b/tests/hlsl/object-references.shader_test @@ -226,7 +226,6 @@ size (1, 1) [pixel shader todo fail(sm>=6)] struct apple { Texture2D tex; - float4 fo : COLOR; };
float4 main(struct apple input) : sv_target
From: Giovanni Mascellani gmascellani@codeweavers.com
They are reset each time "[require]" is encountered. --- tests/hlsl/combined-samplers.shader_test | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tests/hlsl/combined-samplers.shader_test b/tests/hlsl/combined-samplers.shader_test index 19038c34d..235537594 100644 --- a/tests/hlsl/combined-samplers.shader_test +++ b/tests/hlsl/combined-samplers.shader_test @@ -1,6 +1,7 @@ [require] shader model >= 4.0 shader model < 6.0 +options: backcompat
[sampler 0] @@ -35,10 +36,6 @@ size (1, 1) size (1, 1) 4.0 4.0 4.0 1.0
-[require] -shader model < 6.0 -options: backcompat - [pixel shader] sampler sam;
@@ -139,6 +136,7 @@ probe all rgba (1, 1, 1, 11) [require] shader model >= 5.0 shader model < 6.0 +options: backcompat
[pixel shader todo]
From: Giovanni Mascellani gmascellani@codeweavers.com
I'm not sure of what's happening here, but it seems that this change fixes a crash when running on Windows in the CI. Since most of the test excludes SM1-3 anyway, this shouldn't be a big loss. --- tests/hlsl/matrix-semantics.shader_test | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/hlsl/matrix-semantics.shader_test b/tests/hlsl/matrix-semantics.shader_test index 082c69c0c..e19b6b48c 100644 --- a/tests/hlsl/matrix-semantics.shader_test +++ b/tests/hlsl/matrix-semantics.shader_test @@ -1,3 +1,6 @@ +[require] +shader model >= 4.0 + [pixel shader] float4x1 main() : sv_target { @@ -18,9 +21,6 @@ row_major float1x4 main() : sv_target draw quad probe all rgba (1.0, 2.0, 3.0, 4.0)
-[require] -shader model >= 4.0 - [render target 0] format r32 float size (640, 480)
From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/shader_runner.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 423f42bd3..85987bfda 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -1081,7 +1081,13 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_o break;
case STATE_RESOURCE: - set_resource(runner, runner->ops->create_resource(runner, ¤t_resource)); + /* Not every backend supports every resource type + * (specifically, D3D9 doesn't support UAVs and + * textures with data type other than float). */ + if (!skip_tests) + { + set_resource(runner, runner->ops->create_resource(runner, ¤t_resource)); + } free(current_resource.data); break;
From: Giovanni Mascellani gmascellani@codeweavers.com
--- Makefile.am | 5 ++++- tests/driver.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 233f36423..657d4c941 100644 --- a/Makefile.am +++ b/Makefile.am @@ -580,7 +580,10 @@ endif tests/crosstests.txt: FORCE echo $(vkd3d_cross_tests) | tr ' ' '\n' > $@
-crosstest-lists: tests/crosstests.txt +tests/shader_tests.txt: FORCE + echo $(vkd3d_shader_tests) | tr ' ' '\n' > $@ + +crosstest-lists: tests/crosstests.txt tests/shader_tests.txt
FORCE:
diff --git a/tests/driver.c b/tests/driver.c index dd8092723..70e455016 100644 --- a/tests/driver.c +++ b/tests/driver.c @@ -19,19 +19,37 @@ #include <stdio.h> #include <stdbool.h> #include <windows.h> +#include <shlobj.h>
static bool run_program(const char *cmdline, const char *log_filename) { + char cmdline2[1024], log_dirname[1024], *file_part; HANDLE log = INVALID_HANDLE_VALUE; SECURITY_ATTRIBUTES attrs = {0}; PROCESS_INFORMATION info = {0}; STARTUPINFOA startup = {0}; - char cmdline2[1024]; DWORD exit_code; bool ret = true; + int res;
strcpy(cmdline2, cmdline);
+ if (GetFullPathNameA(log_filename, sizeof(log_dirname), log_dirname, &file_part) == 0) + { + fprintf(stderr, "Cannot extract the directory name for path %s, last error %ld.\n", log_filename, GetLastError()); + ret = false; + goto out; + } + *file_part = '\0'; + + res = SHCreateDirectoryExA(NULL, log_dirname, NULL); + if (res != ERROR_SUCCESS && res != ERROR_ALREADY_EXISTS) + { + fprintf(stderr, "Cannot create log directory %s, error %d.\n", log_dirname, res); + ret = false; + goto out; + } + attrs.nLength = sizeof(attrs); attrs.bInheritHandle = TRUE;
@@ -99,6 +117,36 @@ static bool run_tests_for_directory(const char *commit_dir) printf("Building %s\n", commit_dir); printf("---\n");
+ sprintf(list_filename, "artifacts/%s/tests/shader_tests.txt", commit_dir); + list_file = fopen(list_filename, "r"); + + if (!list_file) + { + fprintf(stderr, "Cannot open list file %s, errno %d.\n", list_filename, errno); + ret = false; + } + else + { + while (fgets(line, sizeof(line), list_file)) + { + size_t len = strlen(line); + + if (line[len - 1] == '\n') + line[--len] = '\0'; + + sprintf(cmdline, "artifacts/%s/tests/shader_runner.cross%s.exe %s", commit_dir, test_arch, line); + + /* Remove the .shader_test suffix. */ + line[len - 12] = '\0'; + sprintf(log_filename, "artifacts/%s/%s.log", commit_dir, line); + + ++test_count; + success_count += !!run_program(cmdline, log_filename); + } + + fclose(list_file); + } + sprintf(list_filename, "artifacts/%s/tests/crosstests.txt", commit_dir); list_file = fopen(list_filename, "r");
From: Giovanni Mascellani gmascellani@codeweavers.com
A driver program is introduced to coordinate test running on Windows, similarly to what "make test" does on Linux and macOS. --- .gitlab-ci.yml | 2 + Makefile.am | 26 ++++++- gitlab/README | 10 ++- gitlab/build-crosstest | 5 +- gitlab/test.yml | 35 +++++++++ tests/driver.c | 173 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 245 insertions(+), 6 deletions(-) create mode 100644 gitlab/test.yml create mode 100644 tests/driver.c
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8cc59d764..276c654ef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,9 @@ stages: - image - build + - test
include: - local: "/gitlab/image.yml" - local: "/gitlab/build.yml" + - local: "/gitlab/test.yml" diff --git a/Makefile.am b/Makefile.am index 2821ddc6f..233f36423 100644 --- a/Makefile.am +++ b/Makefile.am @@ -480,6 +480,9 @@ shader_runner_cross_sources = \ $(srcdir)/tests/shader_runner_d3d11.c \ $(srcdir)/tests/shader_runner_d3d12.c
+driver_cross_sources = \ + $(srcdir)/tests/driver.c + if HAVE_CROSSTARGET32 CROSS32_CC = @CROSSCC32@ CROSS32_DLLTOOL = @CROSSTARGET32@-dlltool @@ -495,6 +498,7 @@ endif CROSS32_FILES = $(CROSS32_EXEFILES) if BUILD_TESTS CROSS32_FILES += tests/shader_runner.cross32.exe +CROSS32_FILES += tests/driver.cross32.exe endif
CLEANFILES += $(CROSS32_IMPLIBS) $(CROSS32_FILES) @@ -517,6 +521,11 @@ tests/shader_runner.cross32.exe: $(shader_runner_cross_sources) $(CROSS32_IMPLIB $(CROSS32_CC) $(CROSS_CFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $(shader_runner_cross_sources) $(CROSS32_IMPLIBS) -ldxgi -lgdi32 -ld3dcompiler_47 && \ $(am__mv) $$depbase.Tpo $$depbase.Po
+tests/driver.cross32.exe: $(driver_cross_sources) + $(AM_V_CCLD)depbase=`echo $@ | sed 's![^/]*$$!$(DEPDIR)/&!;s!.exe$$!!'`; \ + $(CROSS32_CC) $(CROSS_CFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $(driver_cross_sources) && \ + $(am__mv) $$depbase.Tpo $$depbase.Po + else crosstest32: endif @@ -536,6 +545,7 @@ endif CROSS64_FILES = $(CROSS64_EXEFILES) if BUILD_TESTS CROSS64_FILES += tests/shader_runner.cross64.exe +CROSS64_FILES += tests/driver.cross64.exe endif
CLEANFILES += $(CROSS64_IMPLIBS) $(CROSS64_FILES) @@ -558,12 +568,24 @@ tests/shader_runner.cross64.exe: $(shader_runner_cross_sources) $(CROSS64_IMPLIB $(CROSS64_CC) $(CROSS_CFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $(shader_runner_cross_sources) $(CROSS64_IMPLIBS) -ldxgi -lgdi32 -ld3dcompiler_47 && \ $(am__mv) $$depbase.Tpo $$depbase.Po
+tests/driver.cross64.exe: $(driver_cross_sources) + $(AM_V_CCLD)depbase=`echo $@ | sed 's![^/]*$$!$(DEPDIR)/&!;s!.exe$$!!'`; \ + $(CROSS64_CC) $(CROSS_CFLAGS) -MT $@ -MD -MP -MF $$depbase.Tpo -o $@ $(driver_cross_sources) && \ + $(am__mv) $$depbase.Tpo $$depbase.Po + else crosstest64: endif
-.PHONY: crosstest crosstest32 crosstest64 -crosstest: crosstest32 crosstest64 +tests/crosstests.txt: FORCE + echo $(vkd3d_cross_tests) | tr ' ' '\n' > $@ + +crosstest-lists: tests/crosstests.txt + +FORCE: + +.PHONY: crosstest crosstest32 crosstest64 crosstest-lists FORCE +crosstest: crosstest32 crosstest64 crosstest-lists
if BUILD_DOC @DX_RULES@ diff --git a/gitlab/README b/gitlab/README index 04fd61119..310912be2 100644 --- a/gitlab/README +++ b/gitlab/README @@ -19,9 +19,10 @@ MoltenVK as the Vulkan driver. The llvmpipe and macOS jobs are currently allowed to fail.
Additionally, MinGW is used to build PE binaries for both vkd3d and -its crosstests, for both 32 and 64 bit. These builds are not currently -tested (but the pipeline still fails if the compilation is not -successful). +its crosstests, for both 32 and 64 bit. The PE crosstests are executed +on Windows 10 to check that behavior imposed by the tests corresponds +to Microsoft's D3D12 implementation. The rendering backend is +currently Window's WARP software implementation.
The testing logs are available as CI artifacts, as well as the PE modules built by the crosstest and MinGW jobs. @@ -58,3 +59,6 @@ environment for running the tests. All the software required to compile and run the tests will therefore have to be installed directly on the host system. Complete instructions to setup the macOS are currently not available. + +Finally, a runner tagged with `win10-21h2' must be available and +submit jobs to a Windows 10 virtual machine. diff --git a/gitlab/build-crosstest b/gitlab/build-crosstest index 4a1341a09..da59bc8da 100755 --- a/gitlab/build-crosstest +++ b/gitlab/build-crosstest @@ -19,6 +19,9 @@ cd build touch ../pipeline_failed
mkdir -p ../artifacts/$COMMIT -rsync -Rr config.log tests/*.exe ../artifacts/$COMMIT +rsync -Rr config.log tests/*.txt tests/*.exe ../artifacts/$COMMIT + +# Make the driver easily available to the Windows CI job +cp tests/driver.cross64.exe ../artifacts
git reset --hard diff --git a/gitlab/test.yml b/gitlab/test.yml new file mode 100644 index 000000000..97bebba53 --- /dev/null +++ b/gitlab/test.yml @@ -0,0 +1,35 @@ +test-win-64: + stage: test + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + interruptible: true + needs: + - job: build-crosstest + tags: + - win10-21h2 + script: + - ./artifacts/driver.cross64.exe + variables: + TEST_ARCH: "64" + artifacts: + when: always + paths: + - artifacts + +test-win-32: + stage: test + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + interruptible: true + needs: + - job: build-crosstest + tags: + - win10-21h2 + script: + - ./artifacts/driver.cross64.exe + variables: + TEST_ARCH: "32" + artifacts: + when: always + paths: + - artifacts diff --git a/tests/driver.c b/tests/driver.c new file mode 100644 index 000000000..dd8092723 --- /dev/null +++ b/tests/driver.c @@ -0,0 +1,173 @@ +/* + * Copyright 2023 Giovanni Mascellani for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdio.h> +#include <stdbool.h> +#include <windows.h> + +static bool run_program(const char *cmdline, const char *log_filename) +{ + HANDLE log = INVALID_HANDLE_VALUE; + SECURITY_ATTRIBUTES attrs = {0}; + PROCESS_INFORMATION info = {0}; + STARTUPINFOA startup = {0}; + char cmdline2[1024]; + DWORD exit_code; + bool ret = true; + + strcpy(cmdline2, cmdline); + + attrs.nLength = sizeof(attrs); + attrs.bInheritHandle = TRUE; + + log = CreateFileA(log_filename, GENERIC_WRITE, 0, &attrs, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (log == INVALID_HANDLE_VALUE) + { + fprintf(stderr, "Cannot create log file %s, last error %ld.\n", log_filename, GetLastError()); + ret = false; + goto out; + } + + startup.cb = sizeof(startup); + startup.dwFlags = STARTF_USESTDHANDLES; + startup.hStdInput = INVALID_HANDLE_VALUE; + startup.hStdOutput = log; + startup.hStdError = log; + + if (!CreateProcessA(NULL, cmdline2, NULL, NULL, TRUE, 0, NULL, NULL, &startup, &info)) + { + fprintf(stderr, "Cannot create process %s, last error %ld.\n", cmdline2, GetLastError()); + ret = false; + goto out; + } + + if (WaitForSingleObject(info.hProcess, INFINITE) != WAIT_OBJECT_0) + { + fprintf(stderr, "Cannot wait for process termination, last error %ld.\n", GetLastError()); + ret = false; + goto out; + } + + if (!GetExitCodeProcess(info.hProcess, &exit_code)) + { + fprintf(stderr, "Cannot retrive the process exit code, last error %ld.\n", GetLastError()); + ret = false; + goto out; + } + + ret = exit_code == 0; + + printf("%s: %s\n", ret ? "PASS" : "FAIL", cmdline); + +out: + if (info.hProcess && !CloseHandle(info.hProcess)) + fprintf(stderr, "Cannot close process, last error %ld.\n", GetLastError()); + if (info.hThread && !CloseHandle(info.hThread)) + fprintf(stderr, "Cannot close thread, last error %ld.\n", GetLastError()); + if (log != INVALID_HANDLE_VALUE && !CloseHandle(log)) + fprintf(stderr, "Cannot close log file, last error %ld.\n", GetLastError()); + + return ret; +} + +static bool run_tests_for_directory(const char *commit_dir) +{ + char cmdline[1024], log_filename[1024], list_filename[1024], line[1024]; + unsigned int success_count = 0, test_count = 0; + const char *test_arch = getenv("TEST_ARCH"); + FILE *list_file; + bool ret = true; + + if (!test_arch) + test_arch = "64"; + + printf("Building %s\n", commit_dir); + printf("---\n"); + + sprintf(list_filename, "artifacts/%s/tests/crosstests.txt", commit_dir); + list_file = fopen(list_filename, "r"); + + if (!list_file) + { + fprintf(stderr, "Cannot open list file %s, errno %d.\n", list_filename, errno); + ret = false; + } + else + { + while (fgets(line, sizeof(line), list_file)) + { + size_t len = strlen(line); + + if (line[len - 1] == '\n') + line[len - 1] = '\0'; + + sprintf(cmdline, "artifacts/%s/%s.cross%s.exe", commit_dir, line, test_arch); + sprintf(log_filename, "artifacts/%s/%s.log", commit_dir, line); + ++test_count; + success_count += !!run_program(cmdline, log_filename); + } + + fclose(list_file); + } + + printf("=======\n"); + printf("Summary\n"); + printf("=======\n"); + + printf("# TOTAL: %u\n", test_count); + printf("# PASS: %u\n", success_count); + printf("# FAIL: %u\n", test_count - success_count); + + if (test_count != success_count) + ret = false; + + return ret; +} + +int wmain(void) +{ + WIN32_FIND_DATAA find_data; + HANDLE find_handle; + bool ret = true; + + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); + + find_handle = FindFirstFileA("artifacts/*-*", &find_data); + if (find_handle == INVALID_HANDLE_VALUE) + { + fprintf(stderr, "Cannot list commits, last error %ld.\n", GetLastError()); + ret = false; + } + 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); + } + + return !ret; +}
On Wed Oct 18 11:04:24 2023 +0000, Henri Verbeet wrote:
+ +Finally, a runner tagged with `win10-21h2' must be available and +submit jobs to a Windows 10 virtual machine. \ No newline at end of file
Missing newline. I'm not sure whether it's worth it, but we could conceivably generate the list of tests to run from the build system, instead of hardcoding paths in the driver program. The main benefit would probably be that it would make it easier to keep things in sync.
The latest version should address both concerns.
+tests/crosstests.txt: FORCE + echo $(vkd3d_cross_tests) | tr ' ' '\n' > $@
We'll probably want a "$(AM_V_GEN)" in front of that. Note that we could avoid the "tr" dependency with something like "for i in $(vkd3d_cross_tests); do echo $$i; done > $@"
I haven't checked, but I imagine we'll want to add tests/crosstests.txt and tests/shader_tests.txt to .gitignore and CLEANFILES.