Commit 678dad5abe6c95ffa087b799922c2114b18c8541

Hood Chatham 2023-02-02T14:48:07

Use libffi-dg-prune to handle Emscripten INFO messages rather than patching emcc.py (#766)

diff --git a/.circleci/config.yml b/.circleci/config.yml
index aaf6556..7da0eaf 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -103,7 +103,6 @@ jobs:
           name: run tests
           command: |
             source ./emsdk/emsdk_env.sh
-            python3 testsuite/emscripten/quiet_emcc_info.py
             testsuite/emscripten/node-tests.sh << parameters.params >>
 
 workflows:
diff --git a/testsuite/emscripten/quiet_emcc_info.py b/testsuite/emscripten/quiet_emcc_info.py
deleted file mode 100644
index b2b3f06..0000000
--- a/testsuite/emscripten/quiet_emcc_info.py
+++ /dev/null
@@ -1,36 +0,0 @@
-"""
-Prevent emcc from printing info level logging
-
-dejagnu will fail tests because of these log statements and the messages depend
-on emscripten cache state so xfailing the right tests is very hard.
-
-See emscripten issue:
-https://github.com/emscripten-core/emscripten/issues/18607
-"""
-
-from pathlib import Path
-from shutil import which
-from sys import exit
-from textwrap import dedent
-
-EMCC_PATH = Path(which("emcc") + ".py")
-
-emcc_text = EMCC_PATH.read_text()
-if "# quiet_emcc_info patch" in emcc_text:
-    exit(0)
-
-emcc_lines = emcc_text.splitlines()
-emcc_lines.insert(
-    1,
-    dedent(
-        """
-        # quiet_emcc_info patch
-        import logging
-        for name in ["cache", "system_libs", "shared"]:
-            logger = logging.getLogger(name)
-            logger.setLevel(logging.WARN)
-        """
-    ),
-)
-
-EMCC_PATH.write_text("\n".join(emcc_lines))
diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp
index a84e533..b5731db 100644
--- a/testsuite/lib/libffi.exp
+++ b/testsuite/lib/libffi.exp
@@ -278,6 +278,8 @@ proc libffi-dg-prune { target_triplet text } {
     regsub -all "(^|\n)\[^\n\]*unable to perform all requested operations" $text "" text
     # We get this from sparc64 linux systems
     regsub -all "(^|\n)\[^\n\]*warning: .* has a LOAD segment with RWX permissions" $text "" text
+    # Ignore Emscripten INFO messages
+    regsub -all "(^|\n)(cache|shared):INFO:\[^\n\]*" $text "" text
     return $text
 }