Commit d268747e authored by igloo's avatar igloo

[project @ 2004-09-09 16:15:24 by igloo]

Testsuite cleaning.
parent fd396161
......@@ -177,6 +177,7 @@ these steps:
set_stdin(file) use a different file for stdin
exit_code(n) expect an exit code of 'n' from the prog
extra_run_opts(opts) pass some extra opts to the prog
no_clean don't clean up after this test
you can compose two of these functions together by
saying compose(f,g). For example, to expect an exit
......
......@@ -8,6 +8,7 @@ import string
import re
import traceback
import copy
import glob
from string import join
from testutil import *
......@@ -134,6 +135,10 @@ class TestOptions:
# expected exit code
self.exit_code = 0
# should we clean up after ourselves?
self.cleanup = ''
# The default set of options
global default_testopts
......@@ -243,6 +248,9 @@ def extra_run_opts( val ):
def _extra_run_opts( opts, v ):
opts.extra_run_opts = v
def no_clean( opts ):
opts.cleanup = '';
# ----
# Function for composing two opt-fns together
......@@ -291,6 +299,24 @@ def test( name, setup, func, args ):
for way in ways:
do_test( name, way, setup, func, args )
clean(map (lambda suff: name + suff,
['', '.genscript', '.run.stderr', '.run.stdout',
'.comp.stderr', '.comp.stdout',
'.interp.stderr', '.interp.stdout',
'.hi', '.o', '.prof', '.hc', '_stub.h', '_stub.c',
'_stub.o']))
def clean(names):
clean_full_paths(map (lambda name: in_testdir(name), names))
def clean_o_hi():
clean_full_paths(glob.glob(in_testdir('*.o')) + glob.glob(in_testdir('*.hi')))
def clean_full_paths(names):
if testopts.cleanup != '':
for name in names:
if os.access(name, os.F_OK) :
os.remove(name)
def do_test(name, way, setup, func, args):
full_name = name + '(' + way + ')'
......
......@@ -67,6 +67,7 @@ RUNTEST_OPTS += \
-e config.compiler_always_flags.append"(\"$(EXTRA_HC_OPTS)\")" \
-e config.platform=\"$(TARGETPLATFORM)\" \
-e config.wordsize=\"$(WORDSIZE)\" \
-e default_testopts.cleanup=\"$(CLEANUP)\" \
$(EXTRA_RUNTEST_OPTS)
TESTS =
......
......@@ -15,6 +15,7 @@ test('fed001', expect_fail_for(['extcore','optextcore']), compile_and_run, [''])
# Omit GHCi for these two, as they use foreign export
test('ffi001', omit_ways(['ghci']), compile_and_run, [''])
test('ffi002', omit_ways(['ghci']), compile_and_run, ['ffi002_c.c -no-hs-main'])
clean(['ffi002_c.o'])
if config.platform == 'alpha-dec-osf3':
f = skip
......
......@@ -4,5 +4,6 @@ def f( opts ):
setTestOpts(f)
test('Cpr001_imp', normal, compile, [''])
test('Cpr001_imp', no_clean, compile, [''])
test('Cpr001', normal, compile, [''])
clean(['Cpr001_imp.hi', 'Cpr001_imp.o', 'Cpr001_imp.comp.stderr'])
......@@ -23,3 +23,10 @@ test('driver060', normal, run_command_ignore_output, ['$MAKE test060'])
test('driver061', normal, run_command_ignore_output, ['$MAKE test061'])
test('driver062', normal, run_command_ignore_output, ['$MAKE test062'])
test('driver063', normal, run_command, ['$MAKE -s --no-print-directory test063'])
clean(['B/C.hi', 'B/C.o', 'B/C.ooo', 'B/C.xhi',
'd1/P/Q.o', 'd2/R/S.o', 'd1/P/Q.hi', 'd2/R/S.hi',
'A.ooo', 'A.xhi', 'Hello.hi', 'Hello.o', 'hello'])
if default_testopts.cleanup != '':
os.spawnlp(os.P_WAIT, 'rm', 'rm', '-rf', in_testdir('obj'))
os.spawnlp(os.P_WAIT, 'rm', 'rm', '-rf', in_testdir('hi'))
test('prog001', normal, ghci_script, ['prog001.script'])
clean(['D.hi', 'D.o'])
test('prog002', normal, ghci_script, ['prog002.script'])
clean(['A.hi'])
test('prog003', normal, ghci_script, ['prog003.script'])
clean(['D.hi', 'C.hi', 'C.o', 'B.hi', 'B.o', 'A.hi', 'A.o', 'a.out'])
......@@ -3,3 +3,4 @@ test( 'bits',
multimod_compile_and_run,
['Main','']
)
clean(['CompanyDatatypes.hi', 'CompanyDatatypes.o', 'Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'ext1',
multimod_compile_and_run,
['Main','']
)
clean(['Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'freeNames',
multimod_compile_and_run,
['Main','']
)
clean(['FunDatatypes.hi', 'FunDatatypes.o', 'Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'genUpTo',
multimod_compile_and_run,
['Main','']
)
clean(['LittleLanguage.hi', 'LittleLanguage.o', 'Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'geq',
multimod_compile_and_run,
['Main','']
)
clean(['CompanyDatatypes.hi', 'CompanyDatatypes.o', 'Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'gshow',
multimod_compile_and_run,
['Main','']
)
clean(['CompanyDatatypes.hi', 'CompanyDatatypes.o', 'Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'gzip',
multimod_compile_and_run,
['Main','']
)
clean(['CompanyDatatypes.hi', 'CompanyDatatypes.o', 'Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'paradise',
multimod_compile_and_run,
['Main','']
)
clean(['CompanyDatatypes.hi', 'CompanyDatatypes.o', 'Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'reify',
multimod_compile_and_run,
['Main','']
)
clean(['CompanyDatatypes.hi', 'CompanyDatatypes.o', 'Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'strings',
multimod_compile_and_run,
['Main','']
)
clean(['CompanyDatatypes.hi', 'CompanyDatatypes.o', 'Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'tree',
multimod_compile_and_run,
['Main','']
)
clean(['CompanyDatatypes.hi', 'CompanyDatatypes.o', 'Main.hi', 'Main.o'])
......@@ -3,3 +3,4 @@ test( 'xmlish',
multimod_compile_and_run,
['Main','']
)
clean(['CompanyDatatypes.hi', 'CompanyDatatypes.o', 'Main.hi', 'Main.o'])
......@@ -8,9 +8,12 @@ test('IOError001', compose(omit_ways(['ghci']), set_stdin('IOError001.hs')),
test('IOError002', normal, compile_and_run, [''])
test('finalization001', normal, compile_and_run, [''])
test('hClose001', normal, compile_and_run, [''])
clean(['hClose001.tmp'])
test('hFileSize001', normal, compile_and_run, [''])
test('hFileSize002', omit_ways(['ghci']), compile_and_run, [''])
clean(['hFileSize002.out'])
test('hFlush001', normal, compile_and_run, [''])
clean(['hFlush001.out'])
test('hGetBuffering001',
compose(omit_ways(['ghci']), set_stdin('hGetBuffering001.hs')),
......@@ -21,8 +24,10 @@ test('hGetLine001', set_stdin('hGetLine001.hs'), compile_and_run, ['-cpp'])
test('hGetLine002', normal, compile_and_run, [''])
test('hGetLine003', normal, compile_and_run, [''])
test('hGetPosn001', normal, compile_and_run, ['-cpp'])
clean(['hGetPosn001.out'])
test('hIsEOF001', normal, compile_and_run, [''])
test('hIsEOF002', normal, compile_and_run, ['-cpp'])
clean(['hIsEOF002.out'])
# hReady doesn't work at the end of a file in GHC
test('hReady001', expect_fail, compile_and_run, ['-cpp'])
......@@ -31,6 +36,7 @@ test('hSeek001', normal, compile_and_run, ['-cpp'])
test('hSeek002', normal, compile_and_run, ['-cpp'])
test('hSeek003', normal, compile_and_run, ['-cpp'])
test('hSeek004', normal, compile_and_run, ['-cpp'])
clean(['hSeek004.out'])
test('hSetBuffering002', set_stdin('hSetBuffering002.hs'), compile_and_run, [''])
......@@ -45,19 +51,27 @@ test('isEOF001', normal, compile_and_run, [''])
test('misc001', extra_run_opts('misc001.hs misc001.out'), \
compile_and_run, [''])
clean(['misc001.out'])
test('openFile001', normal, compile_and_run, [''])
test('openFile002', exit_code(1), compile_and_run, [''])
test('openFile003', normal, compile_and_run, [''])
test('openFile004', normal, compile_and_run, [''])
clean(['openFile004.out'])
test('openFile005', expect_fail_if_windows, compile_and_run, [''])
clean(['openFile005.out1', 'openFile005.out2'])
test('openFile006', normal, compile_and_run, [''])
clean(['openFile006.out'])
test('openFile007', expect_fail_if_windows, compile_and_run, [''])
clean(['openFile007.out'])
test('putStr001', normal, compile_and_run, [''])
test('readFile001', expect_fail_if_windows, compile_and_run, [''])
clean(['readFile001.out'])
test('readwrite001', normal, compile_and_run, ['-cpp'])
clean(['readwrite001.inout'])
test('readwrite002', compose(omit_ways(['ghci']), set_stdin('readwrite002.hs')),
compile_and_run, ['-cpp'])
clean(['readwrite002.inout'])
test('hGetBuf001', expect_fail_if_windows, compile_and_run, ['-package unix'])
......@@ -19,3 +19,4 @@ test('trace001', omit_ways(['opt','optasm','optextcore']), compile_and_run, ['']
test('hGetBuf001', normal, compile_and_run, [''])
test('hPutBuf001', normal, compile_and_run, [''])
test('hPutBuf002', normal, compile_and_run, [''])
clean(['hPutBuf002.out'])
......@@ -120,7 +120,9 @@ test('mod98', normal, compile_fail, [''])
test('mod99', normal, compile, [''])
test('mod100', normal, compile, [''])
test('mod101', normal, multimod_compile_fail, ['mod101', '-v0'])
clean(['Mod101_AuxA.hi', 'Mod101_AuxA.o', 'Mod101_AuxB.hi', 'Mod101_AuxB.o'])
test('mod102', normal, multimod_compile_fail, ['mod102', '-v0'])
clean(['Mod102_AuxA.hi', 'Mod102_AuxA.o', 'Mod102_AuxB.hi', 'Mod102_AuxB.o'])
test('mod103', normal, compile, [''])
test('mod104', normal, compile, [''])
test('mod105', normal, compile, [''])
......@@ -133,24 +135,40 @@ test('mod111', normal, compile, [''])
test('mod112', normal, compile, [''])
test('mod113', normal, compile, [''])
test('mod114', normal, multimod_compile_fail, ['mod114', '-v0'])
clean(['Mod114_Help.hi', 'Mod114_Help.o'])
test('mod115', normal, multimod_compile, ['mod115', '-v0'])
clean(['Mod115_A.hi', 'Mod115_A.o', 'Mod115_B.hi', 'Mod115_B.o'])
test('mod116', normal, compile_fail, [''])
test('mod117', normal, multimod_compile, ['mod117', '-v0'])
clean(['Mod117_A.hi', 'Mod117_A.o', 'Mod117_B.hi', 'Mod117_B.o'])
test('mod118', normal, multimod_compile, ['mod118', '-v0'])
clean(['Mod118_A.hi', 'Mod118_A.o', 'Mod118_B.hi', 'Mod118_B.o'])
test('mod119', normal, multimod_compile, ['mod119', '-v0'])
clean(['Mod119_A.hi', 'Mod119_A.o', 'Mod119_B.hi', 'Mod119_B.o'])
test('mod120', normal, multimod_compile_fail, ['mod120', '-v0'])
clean(['Mod120_A.hi', 'Mod120_A.o'])
test('mod121', normal, multimod_compile_fail, ['mod121', '-v0'])
clean(['Mod121_A.hi', 'Mod121_A.o'])
test('mod122', normal, multimod_compile_fail, ['mod122', '-v0'])
clean(['Mod122_A.hi', 'Mod122_A.o'])
test('mod123', normal, multimod_compile_fail, ['mod123', '-v0'])
clean(['Mod123_A.hi', 'Mod123_A.o'])
test('mod124', normal, multimod_compile_fail, ['mod124', '-v0'])
clean(['Mod124_A.hi', 'Mod124_A.o'])
test('mod125', normal, multimod_compile_fail, ['mod125', '-v0'])
clean(['Mod124_A.hi', 'Mod124_A.o'])
test('mod126', normal, multimod_compile_fail, ['mod126', '-v0'])
clean(['Mod126_A.hi', 'Mod126_A.o'])
test('mod127', normal, multimod_compile_fail, ['mod127', '-v0'])
clean(['Mod126_A.hi', 'Mod126_A.o'])
test('mod128', normal, multimod_compile, ['mod128', '-v0'])
clean(['Mod128_A.hi', 'Mod128_A.o'])
test('mod129', normal, compile, [''])
test('mod130', normal, compile_fail, [''])
test('mod131', normal, multimod_compile_fail, ['mod131', '-v0'])
clean(['Mod131_A.hi', 'Mod131_A.o', 'Mod131_B.hi', 'Mod131_B.o'])
test('mod132', normal, multimod_compile_fail, ['mod132', '-v0'])
clean(['Mod132_A.hi', 'Mod132_A.o', 'Mod132_B.hi', 'Mod132_B.o'])
test('mod133', normal, compile, [''])
test('mod134', normal, compile_fail, [''])
......
test('parser.prog001', normal, multimod_compile, \
['Read007', '-v0'])
clean(['Read006.hi', 'Read006.o', 'Read007.hi', 'Read007.o'])
test('10queens', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('andre_monad', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('andy_cherry', extra_run_opts('.'), multimod_compile_and_run, \
['Main', '-cpp'])
clean_o_hi()
# Expect failure when running the optasm way, due to floating-point
# differences.
test('barton-mangler-bug', expect_fail_for(['optasm']), multimod_compile_and_run, ['Main', ''])
clean_o_hi()
# Expect failure when running the optasm way, due to floating-point
# differences.
test('cholewo-eval', expect_fail_for(['optasm']), multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('cvh_unboxing', normal, multimod_compile_and_run, \
['Main', '-fglasgow-exts'])
clean_o_hi()
test('fast2haskell', normal, multimod_compile_and_run, \
['Main', '-fglasgow-exts -package lang'])
clean_o_hi()
test('fun_insts', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
......@@ -6,4 +6,5 @@ test('galois_raytrace', \
compose(omit_ways(['normal']), expect_fail_for(['optasm'])), \
multimod_compile_and_run, \
['Main', '-O -package lang -package text'])
clean_o_hi()
test('jl_defaults', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('joao-circular', extra_run_opts('inp 40'), multimod_compile_and_run, ['Main', '-O'])
clean_o_hi()
test('jq_readsPrec', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('jtod_circint', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('jules_xref', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('jules_xref2', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('launchbury', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('lennart_range', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('lex', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('life_space_leak', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('north_array', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
......@@ -10,3 +10,4 @@ def set_opts( opts ):
test('okeefe_neural', set_opts, multimod_compile_and_run, \
['Main', '-package lang +RTS -M64m -RTS'])
clean(['Main.hi'])
test('record_upd', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('rittri', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('sanders_array', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('seward-space-leak', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('strict_anns', normal, multimod_compile_and_run, ['Main', ''])
clean_o_hi()
test('thurston-modular-arith', normal, multimod_compile_and_run, \
['Main', ''])
clean_o_hi()
test('rename.prog001', normal, multimod_compile, \
['rn037', '-v0'])
clean(['Rn037Help.hi', 'Rn037Help.o', 'rn037.hi', 'rn037.o'])
test('rename.prog002', normal, multimod_compile_fail, \
['rnfail037', '-v0'])
clean(['Rn037Help.hi', 'Rn037Help.o'])
test('rename.prog003', normal, multimod_compile_fail, \
['B', '-v0'])
clean(['A.hi', 'A.o'])
test('rename.prog004', normal, multimod_compile, \
['C', '-v0'])
clean(['A.hi', 'A.o', 'B.hi', 'B.o', 'C.hi', 'C.o'])
......@@ -34,8 +34,11 @@ test('rn039', normal, compile, [''])
test('rn040', normal, compile, ['-fwarn-unused-binds -fwarn-unused-matches'])
test('rn041', normal, compile, [''])
test('rn042', normal, multimod_compile, ['rn042', '-v0'])
test('rn043', normal, multimod_compile, ['rn042', '-v0'])
test('rn044', normal, multimod_compile, ['rn042', '-v0'])
clean(['Rn042_A.hi', 'Rn042_A.o'])
test('rn043', normal, multimod_compile, ['rn043', '-v0'])
clean(['Rn043_A.hi', 'Rn043_A.o', 'Rn043_B.hi', 'Rn043_B.o'])
test('rn044', normal, multimod_compile, ['rn044', '-v0'])
clean(['Rn043_A.hi', 'Rn043_A.o', 'Rn043_B.hi', 'Rn043_B.o'])
test('rn045', normal, compile, [''])
test('rn046', normal, compile, ['-W'])
......
......@@ -40,5 +40,6 @@ test('rnfail038', normal, compile_fail, [''])
test('rnfail039', normal, compile_fail, [''])
test('rnfail040', normal, multimod_compile_fail, ['rnfail040', '-v0'])
clean(['Rnfail040_A.hi', 'Rnfail040_A.o'])
test('rnfail041', normal, compile_fail, [''])
test('rnfail042', normal, compile_fail, [''])
test('simplCore.prog001', normal, multimod_compile, ['simpl006', '-v0'])
clean(['Simpl006Help.hi', 'Simpl006Help.o', 'simpl006.hi', 'simpl006.o'])
test('simplCore.prog002', normal, multimod_compile, \
['simpl009', '-v0'])
clean(['Simpl009Help.hi', 'Simpl009Help.o', 'simpl009.hi', 'simpl009.o'])
......@@ -21,6 +21,7 @@ test('TH_reifyType2', normal, compile, [''])
test('TH_spliceDecl1', normal, compile, ['-v0'])
test('TH_spliceDecl2', normal, compile, ['-v0'])
test('TH_spliceDecl3', normal, multimod_compile, ['TH_spliceDecl3', '-v0'])
clean(['TH_spliceDecl3_Lib.hi', 'TH_spliceDecl3_Lib.o'])
test('TH_spliceE1', normal, compile_and_run, [''])
test('TH_spliceExpr1', normal, compile, ['-v0'])
......
test('typecheck.prog001', normal, multimod_compile, \
['C', '-v0 -fglasgow-exts'])
clean(['A.hi', 'A.o', 'B.hi', 'B.o', 'C.hi', 'C.o'])
......@@ -172,14 +172,16 @@ test('tc169', normal, compile, [''])
# which we do by steam here, with a pair of tests. Make sure
# we run one way only, so we can be sure to have the right kind
# of interface file for the second part of the test.
test('Tc170_Aux', only_ways(['opt']), compile, [''])
test('Tc170_Aux', compose(no_clean, only_ways(['opt'])), compile, [''])
test('tc170', only_ways(['opt']), compile, [''])
clean(['Tc170_Aux.comp.stderr', 'Tc170_Aux.hi', 'Tc170_Aux.o'])
test('tc171', normal, compile, [''])
test('tc172', normal, compile, [''])
# The point about this test is that it compiles Tc173a and Tc173b *separately*
test('tc173', normal, run_command_ignore_output, ['make tc173'])
clean(['Tc173a.hi', 'Tc173a.o', 'Tc173b.hi', 'Tc173b.o'])
test('tc174', normal, compile, [''])
test('tc175', expect_fail, compile, [''])
......
......@@ -29,6 +29,7 @@ test('tcrun022', normal, compile_and_run, ['-O -fglasgow-exts'])
test('tcrun023', normal, compile_and_run, ['-O'])
test('tcrun024', normal, compile_and_run, ['-O'])
test('tcrun025', normal, multimod_compile_and_run, ['tcrun025',''])
clean(['TcRun025_B.hi', 'TcRun025_B.o'])
test('tcrun026', normal, compile_and_run, [''])
test('tcrun027', normal, compile_and_run, [''])
# Doesn't work with External Core due to datatype with no constructors
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment