From de7c3acdf2c41687c8a5efec3f3fe161aa5ee0de Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Sat, 19 Oct 2024 03:47:28 +0000
Subject: [PATCH] testsuite: rest of ghc-9.6 fixes for wasm

---
 testsuite/tests/bytecode/T22376/all.T         |  2 +-
 .../tests/codeGen/should_run/T20137/T20137.hs |  2 +-
 .../should_run/T20137/T20137.stdout-ws-32     | 10 +++++-----
 .../tests/codeGen/should_run/T20137/T20137C.c | 20 +++++++++----------
 .../tests/codeGen/should_run/T20137/all.T     |  2 +-
 testsuite/tests/unboxedsums/all.T             |  1 +
 6 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/testsuite/tests/bytecode/T22376/all.T b/testsuite/tests/bytecode/T22376/all.T
index d72411d1d07..0b15e93e6d9 100644
--- a/testsuite/tests/bytecode/T22376/all.T
+++ b/testsuite/tests/bytecode/T22376/all.T
@@ -1,2 +1,2 @@
-test('T22376', [extra_files(['A.hs', 'B.hs'])], multimod_compile_and_run,
+test('T22376', [req_interp, extra_files(['A.hs', 'B.hs'])], multimod_compile_and_run,
      ['T22376', '-O1 -fwrite-if-simplified-core -fbyte-code-and-object-code -fprefer-byte-code'])
diff --git a/testsuite/tests/codeGen/should_run/T20137/T20137.hs b/testsuite/tests/codeGen/should_run/T20137/T20137.hs
index 2fa33b5cd97..78e6907187f 100644
--- a/testsuite/tests/codeGen/should_run/T20137/T20137.hs
+++ b/testsuite/tests/codeGen/should_run/T20137/T20137.hs
@@ -14,7 +14,7 @@ import Foreign.C.Types
 type FD = CInt
 type CString = Ptr CChar
 
-foreign import ccall unsafe "runInteractiveProcess"
+foreign import ccall unsafe "functionNameThatDoesntClash"
   c_runInteractiveProcess
         :: Ptr CString
         -> CString
diff --git a/testsuite/tests/codeGen/should_run/T20137/T20137.stdout-ws-32 b/testsuite/tests/codeGen/should_run/T20137/T20137.stdout-ws-32
index 85408b75a53..30e04a5cae8 100644
--- a/testsuite/tests/codeGen/should_run/T20137/T20137.stdout-ws-32
+++ b/testsuite/tests/codeGen/should_run/T20137/T20137.stdout-ws-32
@@ -5,9 +5,9 @@
 5
 6
 77777777
-ffffffff88888888
-ffffffff99999999
-ffffffffaaaaaaaa
-ffffffffbbbbbbbb
+88888888
+99999999
+aaaaaaaa
+bbbbbbbb
 cccccccc
-ffffffffdddddddd
+dddddddd
diff --git a/testsuite/tests/codeGen/should_run/T20137/T20137C.c b/testsuite/tests/codeGen/should_run/T20137/T20137C.c
index f68d88a0546..bf0362476dc 100644
--- a/testsuite/tests/codeGen/should_run/T20137/T20137C.c
+++ b/testsuite/tests/codeGen/should_run/T20137/T20137C.c
@@ -3,7 +3,7 @@
 #include <inttypes.h>
 
 int
-runInteractiveProcess (char *const * args,
+functionNameThatDoesntClash (char *const * args,
                        char *workingDirectory, char **environment,
                        // handles to use for the standard handles. -1 indicates
                        // create pipe, -2 indicates close.
@@ -16,19 +16,19 @@ runInteractiveProcess (char *const * args,
 {
         // N.B. We don't use %p here since the rendering of this varies across
         // libc implementations
-        printf("%" PRIx64 "\n", (uint64_t) args);
-        printf("%" PRIx64 "\n", (uint64_t) workingDirectory);
-        printf("%" PRIx64 "\n", (uint64_t) environment);
+        printf("%" PRIxPTR "\n", (uintptr_t) args);
+        printf("%" PRIxPTR "\n", (uintptr_t) workingDirectory);
+        printf("%" PRIxPTR "\n", (uintptr_t) environment);
         printf("%x\n", fdStdIn);
         printf("%x\n", fdStdOut);
         printf("%x\n", fdStdErr);
-        printf("%" PRIx64 "\n", (uint64_t) pfdStdInput);
-        printf("%" PRIx64 "\n", (uint64_t) pfdStdOutput);
-        printf("%" PRIx64 "\n", (uint64_t) pfdStdError);
-        printf("%" PRIx64 "\n", (uint64_t) childGroup);
-        printf("%" PRIx64 "\n", (uint64_t) childUser);
+        printf("%" PRIxPTR "\n", (uintptr_t) pfdStdInput);
+        printf("%" PRIxPTR "\n", (uintptr_t) pfdStdOutput);
+        printf("%" PRIxPTR "\n", (uintptr_t) pfdStdError);
+        printf("%" PRIxPTR "\n", (uintptr_t) childGroup);
+        printf("%" PRIxPTR "\n", (uintptr_t) childUser);
         printf("%x\n", flags);
-        printf("%" PRIx64 "\n", (uint64_t) failed_doing);
+        printf("%" PRIxPTR "\n", (uintptr_t) failed_doing);
         return 0;
 }
 
diff --git a/testsuite/tests/codeGen/should_run/T20137/all.T b/testsuite/tests/codeGen/should_run/T20137/all.T
index e9e65ebea26..6930e1bcf72 100644
--- a/testsuite/tests/codeGen/should_run/T20137/all.T
+++ b/testsuite/tests/codeGen/should_run/T20137/all.T
@@ -1 +1 @@
-test('T20137', req_c, compile_and_run, ['T20137C.c'])
+test('T20137', [req_c], compile_and_run, ['T20137C.c'])
diff --git a/testsuite/tests/unboxedsums/all.T b/testsuite/tests/unboxedsums/all.T
index 2c9110d7221..e56881a1f91 100644
--- a/testsuite/tests/unboxedsums/all.T
+++ b/testsuite/tests/unboxedsums/all.T
@@ -59,6 +59,7 @@ test('T22208', normal, compile, ['-dstg-lint -dcmm-lint'])
 test('ManyUbxSums',
      [ pre_cmd('{compiler} --run ./GenManyUbxSums.hs'),
        extra_files(['GenManyUbxSums.hs', 'ManyUbxSums_Addr.hs']),
+       req_interp
      ],
      multi_compile_and_run,
      ['ManyUbxSums',
-- 
GitLab