Commit d268747e authored by igloo's avatar igloo
Browse files

[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'])
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