[recipes][clang_toolchain] Disable discard-value-names on Mac

This test fails on our 2 stage builder using an older MacOS sdk version.
Disable the test while debugging the issue upstream.

Bug: b/319105079
Change-Id: I9595e01567e65b0502980fc5a8bb9adaf04038a7
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/recipes/+/972798
Reviewed-by: Petr Hosek <phosek@google.com>
Commit-Queue: Auto-Submit <auto-submit@fuchsia-infra.iam.gserviceaccount.com>
Fuchsia-Auto-Submit: Caslyn Tonelli <caslyn@google.com>
diff --git a/recipes/contrib/clang_toolchain.expected/prod_mac_x64.json b/recipes/contrib/clang_toolchain.expected/prod_mac_x64.json
index 151bed9..bc0da2e 100644
--- a/recipes/contrib/clang_toolchain.expected/prod_mac_x64.json
+++ b/recipes/contrib/clang_toolchain.expected/prod_mac_x64.json
@@ -8673,6 +8673,7 @@
       "CLANG_MODULE_CACHE_PATH": "",
       "GOMA_TMP_DIR": "[CLEANUP]/goma",
       "GOMA_USE_LOCAL": "False",
+      "LIT_FILTER_OUT": "discard\\-value\\-names\\.ll",
       "NINJA_STATUS": "[%f/%t](%r) "
     },
     "env_prefixes": {
@@ -8710,7 +8711,8 @@
       "CLANG_CRASH_DIAGNOSTICS_DIR": "[START_DIR]/llvm_build/clang-crashreports",
       "CLANG_MODULE_CACHE_PATH": "",
       "GOMA_TMP_DIR": "[CLEANUP]/goma",
-      "GOMA_USE_LOCAL": "False"
+      "GOMA_USE_LOCAL": "False",
+      "LIT_FILTER_OUT": "discard\\-value\\-names\\.ll"
     },
     "env_prefixes": {
       "PATH": [
@@ -8759,7 +8761,8 @@
       "CLANG_CRASH_DIAGNOSTICS_DIR": "[START_DIR]/llvm_build/clang-crashreports",
       "CLANG_MODULE_CACHE_PATH": "",
       "GOMA_TMP_DIR": "[CLEANUP]/goma",
-      "GOMA_USE_LOCAL": "False"
+      "GOMA_USE_LOCAL": "False",
+      "LIT_FILTER_OUT": "discard\\-value\\-names\\.ll"
     },
     "env_prefixes": {
       "PATH": [
diff --git a/recipes/contrib/clang_toolchain.py b/recipes/contrib/clang_toolchain.py
index d0d24a2..8bac25d 100644
--- a/recipes/contrib/clang_toolchain.py
+++ b/recipes/contrib/clang_toolchain.py
@@ -1118,7 +1118,18 @@
                 and not props.do_2stage
             ):
                 projects += ["runtimes-" + host_triple]
-            maybe_run_tests("test", projects)
+            # TODO(b/319105079): Re-enable test once it is fixed upstream.
+            filter_regexps = []
+            if host_triple == "x86_64-apple-darwin" and props.do_2stage:
+                filter_regexps = [
+                    r"discard\-value\-names\.ll",
+                ]
+            with api.context(
+                env={"LIT_FILTER_OUT": "|".join(filter_regexps)}
+                if len(filter_regexps) > 0
+                else None
+            ):
+                maybe_run_tests("test", projects)
 
         def maybe_upload(name, pkg_dir):
             if props.upload_package and clang_version: