Commit 6694ccf9 authored by thomie's avatar thomie

testsuite: handle missing stats files gracefully (#10305)

The following tests would result in framework failures when using a ghc
build with HADDOCK_DOCS=NO in mk/build.mk or mk/validate.mk:

  * haddock.Cabal
  * haddock.base
  * haddock.compiler

Test Plan: run make in tests/perf/haddock

Differential Revision: https://phabricator.haskell.org/D899
parent 4d6c0ee1
......@@ -9,6 +9,7 @@ config.compiler_type = 'ghc'
config.compiler = 'ghc'
config.compiler_always_flags = ghc_compiler_always_flags.split()
config.haddock = 'haddock'
config.hp2ps = 'hp2ps'
config.hpc = 'hpc'
config.gs = 'gs'
......
......@@ -123,6 +123,10 @@ def _reqlib( name, opts, lib ):
if not got_it:
opts.expect = 'missing-lib'
def req_haddock( name, opts ):
if not config.haddock:
opts.expect = 'missing-lib'
def req_profiling( name, opts ):
if not config.have_profiling:
opts.expect = 'fail'
......@@ -1128,7 +1132,10 @@ def checkStats(name, way, stats_file, range_fields):
result = passed()
if len(range_fields) > 0:
f = open(in_testdir(stats_file))
try:
f = open(in_testdir(stats_file))
except IOError as e:
return failBecause(str(e))
contents = f.read()
f.close()
......
......@@ -108,6 +108,10 @@ ifeq "$(RUNGHC)" ""
RUNGHC := $(call find_tool,runghc)
endif
ifeq "$(HADDOCK)" ""
HADDOCK := $(call find_tool,haddock)
endif
ifeq "$(HSC2HS)" ""
HSC2HS := $(call find_tool,hsc2hs)
endif
......@@ -130,6 +134,12 @@ ifeq "$(shell test -x '$(GHC_PKG)' && echo exists)" ""
$(error Cannot find ghc-pkg: $(GHC_PKG))
endif
$(eval $(call canonicaliseExecutable,HADDOCK))
ifeq "$(shell test -x '$(HADDOCK)' && echo exists)" ""
# haddock is optional.
HADDOCK :=
endif
$(eval $(call canonicaliseExecutable,HSC2HS))
ifeq "$(shell test -x '$(HSC2HS)' && echo exists)" ""
$(error Cannot find hsc2hs: $(HSC2HS))
......
......@@ -205,15 +205,17 @@ RUNTEST_OPTS += \
-e 'config.exeext="$(exeext)"' \
-e 'config.top="$(TOP_ABS)"'
# Put an extra pair of quotes around program paths,
# Put an extra pair of quotes around non-empty program paths,
# so we don't have to in .T scripts or driver/testlib.py.
quote_path = $(if $1,"\"$1\"","")
RUNTEST_OPTS += \
-e 'config.compiler="\"$(TEST_HC)\""' \
-e 'config.ghc_pkg="\"$(GHC_PKG)\""' \
-e 'config.hp2ps="\"$(HP2PS_ABS)\""' \
-e 'config.hpc="\"$(HPC)\""' \
-e 'config.gs="\"$(GS)\""' \
-e 'config.timeout_prog="\"$(TIMEOUT_PROGRAM)\""'
-e 'config.compiler=$(call quote_path,$(TEST_HC))' \
-e 'config.ghc_pkg=$(call quote_path,$(GHC_PKG))' \
-e 'config.haddock=$(call quote_path,$(HADDOCK))' \
-e 'config.hp2ps=$(call quote_path,$(HP2PS_ABS))' \
-e 'config.hpc=$(call quote_path,$(HPC))' \
-e 'config.gs=$(call quote_path,$(GS))' \
-e 'config.timeout_prog=$(call quote_path,$(TIMEOUT_PROGRAM))'
ifneq "$(OUTPUT_SUMMARY)" ""
RUNTEST_OPTS += \
......
......@@ -3,7 +3,7 @@
# detect outliers, as described in Note [residency]. See #9556.
test('haddock.base',
[unless(in_tree_compiler(), skip)
[unless(in_tree_compiler(), skip), req_haddock
,stats_num_field('bytes allocated',
[(wordsize(64), 9014511528, 5)
# 2012-08-14: 5920822352 (amd64/Linux)
......@@ -43,7 +43,7 @@ test('haddock.base',
['../../../../libraries/base/dist-install/doc/html/base/base.haddock.t'])
test('haddock.Cabal',
[unless(in_tree_compiler(), skip)
[unless(in_tree_compiler(), skip), req_haddock
,stats_num_field('bytes allocated',
[(wordsize(64), 6710234312, 5)
# 2012-08-14: 3255435248 (amd64/Linux)
......@@ -84,7 +84,7 @@ test('haddock.Cabal',
['../../../../libraries/Cabal/Cabal/dist-install/doc/html/Cabal/Cabal.haddock.t'])
test('haddock.compiler',
[unless(in_tree_compiler(), skip)
[unless(in_tree_compiler(), skip), req_haddock
,stats_num_field('bytes allocated',
[(wordsize(64), 33562468736, 10)
# 2012P-08-14: 26070600504 (amd64/Linux)
......
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