added Windows target testing
This commit is contained in:
committed by
Motiejus Jakštys
parent
72475ee012
commit
6f2ae838cd
24
test/c/BUILD
24
test/c/BUILD
@@ -1,4 +1,4 @@
|
||||
load("@bazel-zig-cc//rules:platform.bzl", "platform_binary")
|
||||
load("@bazel-zig-cc//rules:platform.bzl", "platform_binary", "platform_test")
|
||||
|
||||
cc_binary(
|
||||
name = "which_libc",
|
||||
@@ -34,3 +34,25 @@ cc_binary(
|
||||
("linux_arm64", "//platform:linux_arm64", "glibc_2.28"),
|
||||
]
|
||||
]
|
||||
|
||||
cc_binary(
|
||||
name = "winver",
|
||||
srcs = ["main_winver.c"],
|
||||
target_compatible_with = [
|
||||
"@platforms//os:windows",
|
||||
],
|
||||
)
|
||||
|
||||
platform_test(
|
||||
name = "winver_windows_amd64",
|
||||
src = "winver",
|
||||
platform = "//platform:windows_amd64",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
platform_binary(
|
||||
name = "winver_windows_arm64",
|
||||
src = "winver",
|
||||
platform = "//platform:windows_arm64",
|
||||
tags = ["manual"],
|
||||
)
|
||||
|
||||
16
test/c/main_winver.c
Normal file
16
test/c/main_winver.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
int main() {
|
||||
DWORD version = GetVersion();
|
||||
DWORD majorVersion = (DWORD)(LOBYTE(LOWORD(version)));
|
||||
DWORD minorVersion = (DWORD)(HIBYTE(LOWORD(version)));
|
||||
|
||||
DWORD build = 0;
|
||||
if (version < 0x80000000) {
|
||||
build = (DWORD)(HIWORD(version));
|
||||
}
|
||||
|
||||
printf("Running Windows version %d.%d (%d).\n", majorVersion, minorVersion, build);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user