diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-06-05 20:36:41 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-06-23 22:48:18 -0400 |
commit | cad62ef11972490b180fad3cd4a5c7754fa218e4 (patch) | |
tree | e510c5ff00afe23a31d8dcd6c1894d3fdfa39a88 | |
parent | 5f6a0665512717271ac2b249d107e2a0cb18ae86 (diff) | |
download | haskell-cad62ef11972490b180fad3cd4a5c7754fa218e4.tar.gz |
Add tests for #17920
Metric Decrease:
T12150
T12234
-rw-r--r-- | testsuite/driver/testlib.py | 3 | ||||
-rw-r--r-- | testsuite/tests/cmm/should_compile/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_compile/all.T | 6 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_fail/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_run/T17920.cmm | 28 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_run/T17920.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/codeGen/should_run/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/driver/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/llvm/should_compile/T17920fail.cmm | 35 | ||||
-rw-r--r-- | testsuite/tests/llvm/should_compile/all.T | 3 |
10 files changed, 75 insertions, 9 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index bce6c1be0f..9d6fc27b95 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1547,8 +1547,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 71c838de09..f30123f07d 100644 --- a/testsuite/tests/codeGen/should_compile/all.T +++ b/testsuite/tests/codeGen/should_compile/all.T @@ -21,15 +21,15 @@ 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', normal, makefile_test, []) test('T9964', normal, compile, ['-O']) -test('T10518', [cmm_src], compile, ['']) +test('T10518', [cmm_src], compile, ['-no-hs-main']) test('T10667', normal, compile, ['-g']) test('T12115', normal, compile, ['']) test('T12355', normal, compile, ['']) diff --git a/testsuite/tests/codeGen/should_fail/all.T b/testsuite/tests/codeGen/should_fail/all.T index aae2dcee31..970c1577ca 100644 --- a/testsuite/tests/codeGen/should_fail/all.T +++ b/testsuite/tests/codeGen/should_fail/all.T @@ -2,6 +2,6 @@ # 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, ['']) test('T13233_elab', normal, compile_fail, ['-fprint-typechecker-elaboration']) 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 4a70914bb0..bfe8c5b0d2 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -205,3 +205,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 bb345c7ac9..ab89eb5656 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 fedf5ac96c..dca858dec8 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', normal, 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']) |