[tint][ir][fuzz] Disable building IR fuzzer when ASAN is enabled

There are false positives in libprotobuf occuring.

Issue: 345196552

Change-Id: I620affcd52e1642b181efb76c2768b6bb74c6b0b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/193641
Commit-Queue: James Price <jrprice@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Auto-Submit: Ryan Harrison <rharrison@chromium.org>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8bdae2a..ca53f46 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -360,6 +360,7 @@
 message(STATUS "Tint build checking [chromium-style]: ${TINT_CHECK_CHROMIUM_STYLE}")
 message(STATUS "Tint external benchmark corpus dir: ${TINT_EXTERNAL_BENCHMARK_CORPUS_DIR}")
 
+set(IS_ASAN ${DAWN_ENABLE_ASAN})
 
 if (NOT ${TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS} STREQUAL "")
   message(STATUS "Using provided LIB_FUZZING_ENGINE options: ${TINT_LIB_FUZZING_ENGINE_LINK_OPTIONS}")
diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn
index 771ee2f..746f8eb 100644
--- a/src/tint/BUILD.gn
+++ b/src/tint/BUILD.gn
@@ -343,7 +343,7 @@
     deps += [ "${tint_src_dir}/cmd/fuzz/wgsl" ]
   }
 
-  if (tint_build_ir_fuzzer) {
+  if (tint_build_ir_fuzzer && (!is_asan || build_with_chromium)) {
     deps += [ "${tint_src_dir}/cmd/fuzz/ir" ]
   }
 }
diff --git a/src/tint/cmd/fuzz/ir/BUILD.bazel b/src/tint/cmd/fuzz/ir/BUILD.bazel
index 68cf24d..2532c66 100644
--- a/src/tint/cmd/fuzz/ir/BUILD.bazel
+++ b/src/tint/cmd/fuzz/ir/BUILD.bazel
@@ -38,6 +38,16 @@
 load("@bazel_skylib//lib:selects.bzl", "selects")
 
 alias(
+  name = "build_with_chromium",
+  actual = "//src/tint:build_with_chromium_true",
+)
+
+alias(
+  name = "_not_is_asan_",
+  actual = "//src/tint:is_asan_false",
+)
+
+alias(
   name = "tint_build_glsl_writer",
   actual = "//src/tint:tint_build_glsl_writer_true",
 )
@@ -78,10 +88,19 @@
 )
 
 selects.config_setting_group(
-    name = "tint_build_ir_binary_and_tint_build_ir_fuzzer",
+    name = "_not_is_asan__or_build_with_chromium",
+    match_any = [
+        "_not_is_asan_",
+        "build_with_chromium",
+    ],
+)
+
+selects.config_setting_group(
+    name = "tint_build_ir_binary_and_tint_build_ir_fuzzer_and___not_is_asan__or_build_with_chromium_",
     match_all = [
         ":tint_build_ir_binary",
         ":tint_build_ir_fuzzer",
+        ":_not_is_asan__or_build_with_chromium",
     ],
 )
 
diff --git a/src/tint/cmd/fuzz/ir/BUILD.cfg b/src/tint/cmd/fuzz/ir/BUILD.cfg
index 8728766..f90f83e 100644
--- a/src/tint/cmd/fuzz/ir/BUILD.cfg
+++ b/src/tint/cmd/fuzz/ir/BUILD.cfg
@@ -1,12 +1,13 @@
 {
     "proto": {
-        "Condition": "tint_build_ir_binary && tint_build_ir_fuzzer",
+        "Condition": "tint_build_ir_binary && tint_build_ir_fuzzer && (!is_asan || build_with_chromium)",
         "AdditionalDependencies": {
-        "Internal": [ "lang/core/ir/binary:proto" ]
+            "Internal": [ "lang/core/ir/binary:proto" ]
         }
     },
     "fuzz_cmd": {
-        "Condition": "tint_build_ir_binary && tint_build_ir_fuzzer",
+        /* Fuzzer has known false positive with ASAN in standalone builds */
+        "Condition": "tint_build_ir_binary && tint_build_ir_fuzzer && (!is_asan || build_with_chromium)",
         /* The Tint fuzzer executable for IR-input. */
         "OutputName": "tint_ir_fuzzer",
         "AdditionalDependencies": {
diff --git a/src/tint/cmd/fuzz/ir/BUILD.cmake b/src/tint/cmd/fuzz/ir/BUILD.cmake
index 356e8c4..a2bec0b 100644
--- a/src/tint/cmd/fuzz/ir/BUILD.cmake
+++ b/src/tint/cmd/fuzz/ir/BUILD.cmake
@@ -34,11 +34,11 @@
 #                       Do not modify this file directly
 ################################################################################
 
-if(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER)
+if(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER AND ((NOT IS_ASAN) OR BUILD_WITH_CHROMIUM))
 ################################################################################
 # Target:    tint_cmd_fuzz_ir_proto
 # Kind:      proto
-# Condition: TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER
+# Condition: TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER AND ((NOT IS_ASAN) OR BUILD_WITH_CHROMIUM)
 ################################################################################
 tint_add_target(tint_cmd_fuzz_ir_proto proto
   cmd/fuzz/ir/fuzz.proto
@@ -50,12 +50,12 @@
   )
 endif(TINT_BUILD_IR_BINARY)
 
-endif(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER)
-if(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER)
+endif(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER AND ((NOT IS_ASAN) OR BUILD_WITH_CHROMIUM))
+if(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER AND ((NOT IS_ASAN) OR BUILD_WITH_CHROMIUM))
 ################################################################################
 # Target:    tint_cmd_fuzz_ir_fuzz_cmd
 # Kind:      fuzz_cmd
-# Condition: TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER
+# Condition: TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER AND ((NOT IS_ASAN) OR BUILD_WITH_CHROMIUM)
 ################################################################################
 tint_add_target(tint_cmd_fuzz_ir_fuzz_cmd fuzz_cmd
   cmd/fuzz/ir/main_fuzz.cc
@@ -113,11 +113,11 @@
   )
 endif(TINT_BUILD_IR_BINARY)
 
-if(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER)
+if(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER AND ((NOT IS_ASAN) OR BUILD_WITH_CHROMIUM))
   tint_target_add_dependencies(tint_cmd_fuzz_ir_fuzz_cmd fuzz_cmd
     tint_cmd_fuzz_ir_proto
   )
-endif(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER)
+endif(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER AND ((NOT IS_ASAN) OR BUILD_WITH_CHROMIUM))
 
 if(TINT_BUILD_MSL_WRITER)
   tint_target_add_dependencies(tint_cmd_fuzz_ir_fuzz_cmd fuzz_cmd
@@ -146,7 +146,7 @@
 
 tint_target_set_output_name(tint_cmd_fuzz_ir_fuzz_cmd fuzz_cmd "tint_ir_fuzzer")
 
-endif(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER)
+endif(TINT_BUILD_IR_BINARY AND TINT_BUILD_IR_FUZZER AND ((NOT IS_ASAN) OR BUILD_WITH_CHROMIUM))
 ################################################################################
 # Target:    tint_cmd_fuzz_ir_fuzz
 # Kind:      fuzz
diff --git a/src/tint/cmd/fuzz/ir/BUILD.gn b/src/tint/cmd/fuzz/ir/BUILD.gn
index 222afe1..265c344 100644
--- a/src/tint/cmd/fuzz/ir/BUILD.gn
+++ b/src/tint/cmd/fuzz/ir/BUILD.gn
@@ -37,7 +37,8 @@
 import("../../../../../scripts/tint_overrides_with_defaults.gni")
 
 import("${tint_src_dir}/tint.gni")
-if (tint_build_ir_binary && tint_build_ir_fuzzer) {
+if (tint_build_ir_binary && tint_build_ir_fuzzer &&
+    (!is_asan || build_with_chromium)) {
   tint_proto_library("proto") {
     sources = [ "fuzz.proto" ]
     deps = []
@@ -90,7 +91,8 @@
     ]
   }
 }
-if (tint_build_ir_binary && tint_build_ir_fuzzer) {
+if (tint_build_ir_binary && tint_build_ir_fuzzer &&
+    (!is_asan || build_with_chromium)) {
   tint_fuzzer_test("ir") {
     output_name = "tint_ir_fuzzer"
     sources = [ "main_fuzz.cc" ]
@@ -139,7 +141,8 @@
       ]
     }
 
-    if (tint_build_ir_binary && tint_build_ir_fuzzer) {
+    if (tint_build_ir_binary && tint_build_ir_fuzzer &&
+        (!is_asan || build_with_chromium)) {
       deps += [ "${tint_src_dir}/cmd/fuzz/ir:proto" ]
     }