From b71b392f2379b80a5bb3d98742247a6c3a594076 Mon Sep 17 00:00:00 2001
From: Sylvain Henry <sylvain@haskus.fr>
Date: Wed, 10 Jan 2024 10:18:44 +0100
Subject: [PATCH] JS: avoid EMCC logging spurious failure

emcc would sometime output messages like:

  cache:INFO: generating system asset: symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json... (this will be cached in "/emsdk/upstream/emscripten/cache/symbol_lists/424b44514e43d789148e69e4e7d1c7fdc0350b79.json" for subsequent builds)
  cache:INFO:  - ok

Cf https://github.com/emscripten-core/emscripten/issues/18607

This breaks our tests matching the stderr output. We avoid this by setting EMCC_LOGGING=0
---
 testsuite/driver/runtests.py | 5 +++++
 testsuite/driver/testlib.py  | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py
index 9a03601a1f09..0c3bb0a3c169 100644
--- a/testsuite/driver/runtests.py
+++ b/testsuite/driver/runtests.py
@@ -47,6 +47,11 @@ ghc_env['TERM'] = 'vt100'
 # Ensure that GHC doesn't go looking for environment files. See #21365.
 ghc_env['GHC_ENVIRONMENT'] = "-"
 
+# Ensure that EMCC doesn't output cache info
+# (cf https://github.com/emscripten-core/emscripten/issues/18607)
+os.environ['EMCC_LOGGING'] = '0'
+ghc_env['EMCC_LOGGING'] = '0'
+
 global config
 config = getConfig() # get it from testglobals
 config.validate()
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index d98a342a9d02..c183b656ac3b 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -2676,6 +2676,8 @@ def normalise_errmsg(s: str) -> str:
     s = re.sub('.*strip: changes being made to the file will invalidate the code signature in.*\n','',s)
     # clang may warn about unused argument when used as assembler
     s = re.sub('.*warning: argument unused during compilation:.*\n', '', s)
+    # Emscripten displays cache info and old emcc doesn't support EMCC_LOGGING=0
+    s = re.sub('cache:INFO: .*\n', '', s)
 
     return s
 
-- 
GitLab