From 7b4c19983bf6bc11b519b437a6204c38672721ea Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Sun, 12 May 2024 21:52:23 +0000
Subject: [PATCH] testsuite: fix T17920 for wasm backend

T17920 was marked as fragile on wasm before; it can be trivially fixed
by avoiding calling variadic printf() in cmm.
---
 testsuite/tests/codeGen/should_run/T17920.cmm | 9 +++++++--
 testsuite/tests/codeGen/should_run/all.T      | 3 +--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/testsuite/tests/codeGen/should_run/T17920.cmm b/testsuite/tests/codeGen/should_run/T17920.cmm
index 2cfe5eb92a54..5823518c74d8 100644
--- a/testsuite/tests/codeGen/should_run/T17920.cmm
+++ b/testsuite/tests/codeGen/should_run/T17920.cmm
@@ -1,5 +1,9 @@
 #include "Cmm.h"
 
+#if !defined(UnregisterisedCompiler)
+import CLOSURE msg;
+#endif
+
 section "rodata" { msg : bits8[] "Test\n"; }
 section "data" { faketso : bits8[1000]; }
 
@@ -8,12 +12,13 @@ stg_myExit {
 }
 
 stg_foo {
-  
+   CInt _unused;
+
    BaseReg = faketso;
 
    SAVE_REGS();
 
-   foreign "C" printf(msg "ptr");
+   (_unused) = ccall puts(msg "ptr");
 
    RESTORE_REGS();
 
diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T
index af2dda809034..40ddadecde14 100644
--- a/testsuite/tests/codeGen/should_run/all.T
+++ b/testsuite/tests/codeGen/should_run/all.T
@@ -207,7 +207,7 @@ test('T16617', normal, compile_and_run, [''])
 test('T16449_2', exit_code(0), compile_and_run, [''])
 test('T16846', [only_ways(['optasm']), exit_code(1)], compile_and_run, [''])
 
-test('T17920', [cmm_src, when(arch('wasm32'), fragile(22854))], compile_and_run, [''])
+test('T17920', [cmm_src], compile_and_run, [''])
 test('T18527', req_c, compile_and_run, ['T18527FFI.c'])
 test('T19149', [req_c,only_ways('sanity')], compile_and_run, ['T19149_c.c'])
 test('T20275', normal, compile_and_run, [''])
@@ -246,4 +246,3 @@ test('T24295a', normal, compile_and_run, ['-O -floopification'])
 test('T24295b', normal, compile_and_run, ['-O -floopification -fpedantic-bottoms'])
 test('T24664a', normal, compile_and_run, ['-O'])
 test('T24664b', normal, compile_and_run, ['-O'])
-
-- 
GitLab