aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorFabian Meumertzheim <fabian@meumertzhe.im>2021-10-15 13:16:41 +0200
committerFabian Meumertzheim <fabian@meumertzhe.im>2021-10-18 22:31:42 +0200
commit30730a60aeeca1d2ad20f14d0a0913bdef92bcb0 (patch)
tree31120c05fb4a9fef70dc2ada3d3d6cc2e6d42d40 /examples
parent994be115d6d7b8ffbef2f1e6cf822b673459a338 (diff)
downloadjazzer-api-30730a60aeeca1d2ad20f14d0a0913bdef92bcb0.tar.gz
Fix native library tests on Windows
ExampleFuzzerWithASan runs and passes, but ExampleFuzzerWithUBSan only builds and crashes at runtime with no error message. It remains disabled for now.
Diffstat (limited to 'examples')
-rw-r--r--examples/BUILD.bazel4
-rw-r--r--examples/src/main/native/com/example/BUILD.bazel10
2 files changed, 13 insertions, 1 deletions
diff --git a/examples/BUILD.bazel b/examples/BUILD.bazel
index 568103ee..060b0b6c 100644
--- a/examples/BUILD.bazel
+++ b/examples/BUILD.bazel
@@ -1,6 +1,6 @@
load("@io_bazel_rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library")
load("@fmeum_rules_jni//jni:defs.bzl", "java_library_with_native")
-load("//bazel:compat.bzl", "SKIP_ON_MACOS")
+load("//bazel:compat.bzl", "SKIP_ON_MACOS", "SKIP_ON_WINDOWS")
load("//bazel:fuzz_target.bzl", "java_fuzz_target_test")
java_fuzz_target_test(
@@ -44,6 +44,8 @@ java_fuzz_target_test(
fuzzer_args = ["--jvm_args=-Djazzer.native_lib=native_ubsan"],
sanitizer = "undefined",
target_class = "com.example.ExampleFuzzerWithNative",
+ # Crashes at runtime without an error message.
+ target_compatible_with = SKIP_ON_WINDOWS,
runtime_deps = [
":example_fuzzer_with_native_lib",
],
diff --git a/examples/src/main/native/com/example/BUILD.bazel b/examples/src/main/native/com/example/BUILD.bazel
index 8cf638f4..1224fe0a 100644
--- a/examples/src/main/native/com/example/BUILD.bazel
+++ b/examples/src/main/native/com/example/BUILD.bazel
@@ -12,6 +12,11 @@ java_native_library(
java_lib = "//examples:example_fuzzer_with_native_lib",
linkopts = select({
"//:clang_on_linux": ["-fuse-ld=lld"],
+ "@platforms//os:windows": [
+ # Windows requires all symbols that should be imported from the main
+ # executable to be defined by an import lib.
+ "/wholearchive:clang_rt.asan_dll_thunk-x86_64.lib",
+ ],
"//conditions:default": [],
}),
visibility = ["//examples:__pkg__"],
@@ -29,6 +34,11 @@ java_native_library(
java_lib = "//examples:example_fuzzer_with_native_lib",
linkopts = select({
"//:clang_on_linux": ["-fuse-ld=lld"],
+ "@platforms//os:windows": [
+ # Using the asan thunk is correct here as it contains symbols for
+ # UBSan and SanCov as well.
+ "/wholearchive:clang_rt.asan_dll_thunk-x86_64.lib",
+ ],
"//conditions:default": [],
}),
visibility = ["//examples:__pkg__"],