summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-06-05 20:36:41 +0200
committerBen Gamari <ben@smart-cactus.org>2020-07-22 22:57:10 -0400
commit36656d70d9c06d6315aeb81ca511ead235944ca1 (patch)
treec8ff00932c6e10c5cd6db06bcd57c9fc07e30964
parentf96a4b2c32a405966527a282c180dd04408161fc (diff)
downloadhaskell-36656d70d9c06d6315aeb81ca511ead235944ca1.tar.gz
Add tests for #17920
Metric Decrease: T12150 T12234 (cherry picked from commit aa54d1a2b2d2c89107cfa77d8c14a50d6ee9c140)
-rw-r--r--testsuite/driver/testlib.py3
-rw-r--r--testsuite/tests/cmm/should_compile/all.T2
-rw-r--r--testsuite/tests/codeGen/should_compile/all.T6
-rw-r--r--testsuite/tests/codeGen/should_fail/all.T2
-rw-r--r--testsuite/tests/codeGen/should_run/T17920.cmm28
-rw-r--r--testsuite/tests/codeGen/should_run/T17920.stdout1
-rw-r--r--testsuite/tests/codeGen/should_run/all.T2
-rw-r--r--testsuite/tests/driver/all.T2
-rw-r--r--testsuite/tests/llvm/should_compile/T17920fail.cmm35
-rw-r--r--testsuite/tests/llvm/should_compile/all.T3
10 files changed, 75 insertions, 9 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 8ff730938e..a29a75106d 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -1504,8 +1504,7 @@ def simple_build(name: Union[TestName, str],
# Required by GHC 7.3+, harmless for earlier versions:
if (getTestOpts().c_src or
getTestOpts().objc_src or
- getTestOpts().objcpp_src or
- getTestOpts().cmm_src):
+ getTestOpts().objcpp_src):
extra_hc_opts += ' -no-hs-main '
if getTestOpts().compile_cmd_prefix == '':
diff --git a/testsuite/tests/cmm/should_compile/all.T b/testsuite/tests/cmm/should_compile/all.T
index 4eba959ba9..5ae7c51726 100644
--- a/testsuite/tests/cmm/should_compile/all.T
+++ b/testsuite/tests/cmm/should_compile/all.T
@@ -1,4 +1,4 @@
#
-test('selfloop', [cmm_src], compile, [''])
+test('selfloop', [cmm_src], compile, ['-no-hs-main'])
test('T16930', normal, makefile_test, ['T16930'])
test('T17442', normal, compile, [''])
diff --git a/testsuite/tests/codeGen/should_compile/all.T b/testsuite/tests/codeGen/should_compile/all.T
index f69986e9b8..701942f208 100644
--- a/testsuite/tests/codeGen/should_compile/all.T
+++ b/testsuite/tests/codeGen/should_compile/all.T
@@ -19,17 +19,17 @@ test('massive_array',
[ when(arch('i386'), omit_ways(llvm_ways)) ],
compile, ['-fPIC'])
test('T7237', normal, compile, [''])
-test('T7574', [cmm_src, omit_ways(llvm_ways)], compile, [''])
+test('T7574', [cmm_src, omit_ways(llvm_ways)], compile, ['-no-hs-main'])
test('T8205', normal, compile, ['-O0'])
test('T9155', normal, compile, ['-O2'])
test('T9303', normal, compile, ['-O2'])
-test('T9329', [when(unregisterised(), expect_broken(15467)), cmm_src], compile, [''])
+test('T9329', [when(unregisterised(), expect_broken(15467)), cmm_src], compile, ['-no-hs-main'])
test('debug',
[when((arch('powerpc64') or arch('powerpc64le')), expect_broken(11261))],
makefile_test, [])
test('T9964', normal, compile, ['-O'])
-test('T10518', [cmm_src], compile, [''])
+test('T10518', [cmm_src], compile, ['-no-hs-main'])
test('T10667', [ when((arch('powerpc64') or arch('powerpc64le')),
expect_broken(11261))],
compile, ['-g'])
diff --git a/testsuite/tests/codeGen/should_fail/all.T b/testsuite/tests/codeGen/should_fail/all.T
index 1fe2141caf..050ac58902 100644
--- a/testsuite/tests/codeGen/should_fail/all.T
+++ b/testsuite/tests/codeGen/should_fail/all.T
@@ -2,5 +2,5 @@
# Only the LLVM code generator consistently forces the alignment of
# memcpy operations
-test('T8131', [cmm_src, only_ways(llvm_ways)], compile_fail, [''])
+test('T8131', [cmm_src, only_ways(llvm_ways)], compile_fail, ['-no-hs-main'])
test('T13233', normal, compile_fail, [''])
diff --git a/testsuite/tests/codeGen/should_run/T17920.cmm b/testsuite/tests/codeGen/should_run/T17920.cmm
new file mode 100644
index 0000000000..2cfe5eb92a
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T17920.cmm
@@ -0,0 +1,28 @@
+#include "Cmm.h"
+
+section "rodata" { msg : bits8[] "Test\n"; }
+section "data" { faketso : bits8[1000]; }
+
+stg_myExit {
+ foreign "C" stg_exit(0);
+}
+
+stg_foo {
+
+ BaseReg = faketso;
+
+ SAVE_REGS();
+
+ foreign "C" printf(msg "ptr");
+
+ RESTORE_REGS();
+
+ jump stg_myExit [*]; // all registers live
+}
+
+INFO_TABLE_CONSTR(ZCMain_main,0,0,0,CONSTR_NOCAF,"MAIN","MAIN")
+{
+ jump stg_foo [];
+}
+
+CLOSURE(ZCMain_main_closure,ZCMain_main);
diff --git a/testsuite/tests/codeGen/should_run/T17920.stdout b/testsuite/tests/codeGen/should_run/T17920.stdout
new file mode 100644
index 0000000000..345e6aef71
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T17920.stdout
@@ -0,0 +1 @@
+Test
diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T
index 3d114d9f55..f9d530552b 100644
--- a/testsuite/tests/codeGen/should_run/all.T
+++ b/testsuite/tests/codeGen/should_run/all.T
@@ -203,3 +203,5 @@ test('T15892',
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, compile_and_run, [''])
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 11796951f2..0556177a19 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -195,7 +195,7 @@ test('T8101b', normal, multimod_compile,
test('T10600', normal, compile_fail, ['-fno-code'])
# Should not panic when compiling cmm file together with -outputdir.
-test('T9050', cmm_src, compile, ['-outputdir=.'])
+test('T9050', cmm_src, compile, ['-outputdir=. -no-hs-main'])
test('write_interface_oneshot', [extra_files(['A011.hs'])], makefile_test, [])
diff --git a/testsuite/tests/llvm/should_compile/T17920fail.cmm b/testsuite/tests/llvm/should_compile/T17920fail.cmm
new file mode 100644
index 0000000000..d070cfcd7a
--- /dev/null
+++ b/testsuite/tests/llvm/should_compile/T17920fail.cmm
@@ -0,0 +1,35 @@
+#include "Cmm.h"
+
+section "rodata" { msg : bits8[] "Test\n"; }
+section "data" { faketso : bits8[1000]; }
+
+stg_myExit {
+ foreign "C" exit(0);
+}
+
+stg_foo {
+
+ BaseReg = faketso;
+
+ SAVE_REGS();
+
+ D_ d1;
+ F_ f1;
+
+ d1 = D1;
+ f1 = F1;
+
+ foreign "C" printf(msg "ptr");
+
+ D1 = d1;
+ F1 = f1;
+
+ RESTORE_REGS();
+
+ jump stg_myExit [*]; // all registers live
+}
+
+main {
+ jump stg_foo [];
+}
+
diff --git a/testsuite/tests/llvm/should_compile/all.T b/testsuite/tests/llvm/should_compile/all.T
index 070861565b..50743d2131 100644
--- a/testsuite/tests/llvm/should_compile/all.T
+++ b/testsuite/tests/llvm/should_compile/all.T
@@ -8,7 +8,8 @@ setTestOpts(f)
# test('T5486', reqlib('integer-gmp'), compile, [''])
test('T5681', normal, compile, [''])
test('T6158', [reqlib('vector'), reqlib('primitive')], compile, ['-package vector -package primitive'])
-test('T7571', cmm_src, compile, [''])
+test('T7571', cmm_src, compile, ['-no-hs-main'])
test('T7575', unless(wordsize(32), skip), compile, [''])
test('T8131b', normal, compile, [''])
test('T11649', normal, compile, [''])
+test('T17920fail', cmm_src, compile_fail, ['-no-hs-main'])