Commit 55529322 authored by Simon Marlow's avatar Simon Marlow
Browse files

Look for .T files in packages too

This means we can put package-specific tests in the repository for the
package, rather than putting them in the testsuite.  There should be a
.T file to go with the tests, in the same way as for other tests in
the testsuite (but this could be in addition to a standalone test
driver that works with Cabal's 'setup test').
parent 2cec5487
......@@ -42,7 +42,7 @@ for opt,arg in opts:
exec arg
if opt == '--rootdir':
config.rootdir = arg
config.rootdirs.append(arg)
if opt == '--output-summary':
config.output_summary = arg
......@@ -88,7 +88,10 @@ if config.use_threads:
# -----------------------------------------------------------------------------
# The main dude
t_files = findTFiles(config.rootdir)
if config.rootdirs == []:
config.rootdirs = ['.']
t_files = findTFiles(config.rootdirs)
print 'Found', len(t_files), '.T files...'
......
......@@ -16,8 +16,8 @@
class TestConfig:
def __init__(self):
# Directory below which to look for test description files (foo.T)
self.rootdir = '.'
# Directories below which to look for test description files (foo.T)
self.rootdirs = []
# Run these tests only (run all tests if empty)
self.only = []
......
......@@ -1077,10 +1077,13 @@ def pretest_cleanup(name):
# -----------------------------------------------------------------------------
# Return a list of all the files ending in '.T' below the directory dir.
def findTFiles(path):
def findTFiles(roots):
return concat(map(findTFiles_,roots))
def findTFiles_(path):
if os.path.isdir(path):
paths = map(lambda x, p=path: p + '/' + x, os.listdir(path))
return concat(map(findTFiles, paths))
return findTFiles(paths)
elif path[-2:] == '.T':
return [path]
else:
......
......@@ -96,6 +96,7 @@ USETHREADS=0
endif
RUNTEST_OPTS += \
--rootdir=. \
--config=$(CONFIG) \
-e config.confdir=\"$(CONFIGDIR)\" \
-e config.compiler=\"$(TEST_HC)\" \
......
TOP=../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
# Add tests from packages
RUNTEST_OPTS += $(patsubst %, --rootdir=%, $(wildcard $(FPTOOLS_TOP)/libraries/*/tests))
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