Opened 5 years ago

Closed 5 years ago

#10126 closed feature request (fixed)

Test framework should not assume that GHC tools are in the same directory as GHC itself

Reported by: Rufflewind Owned by:
Priority: normal Milestone: 7.10.2
Component: Test Suite Version: 7.8.4
Keywords: test framework makefile Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Other Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D705
Wiki Page:


The GHC test framework assumes that the GHC tools (ghc-pkg, runghc, hsc2hs, etc) are always in the same directory as ghc itself

While this is probably a safe assumption for "in-tree" compilers, it's not necessarily true for "out-of-tree" compilers. For example, I currently have a thin wrapper of ghc in $HOME/bin/ghc, which causes the test framework to think that ghc-pkg is in $HOME/bin/ghc-pkg.

I think the restriction should be relaxed as long as TEST_HC is not specified and an out-of-tree compiler is used.

I suggest changing testsuite/mk/ in the following way:

@@ -56,6 +56,7 @@ TEST_HC := $(STAGE2_GHC)

+implicit_compiler = YES
 TEST_HC := $(shell which ghc)
@@ -87,24 +88,30 @@ endif
 # containing spaces
 BIN_ROOT = $(shell dirname '$(TEST_HC)')

+ifeq "$(implicit_compiler)" "YES"
+find_tool = $(shell which $(1))
+find_tool = $(BIN_ROOT)/$(1)
 ifeq "$(GHC_PKG)" ""
-GHC_PKG := $(BIN_ROOT)/ghc-pkg
+GHC_PKG := $(call find_tool,ghc-pkg)

 ifeq "$(RUNGHC)" ""
-RUNGHC := $(BIN_ROOT)/runghc
+RUNGHC := $(call find_tool,runghc)

 ifeq "$(HSC2HS)" ""
-HSC2HS := $(BIN_ROOT)/hsc2hs
+HSC2HS := $(call find_tool,hsc2hs)

 ifeq "$(HP2PS_ABS)" ""
-HP2PS_ABS := $(BIN_ROOT)/hp2ps
+HP2PS_ABS := $(call find_tool,hp2ps)

 ifeq "$(HPC)" ""
-HPC := $(BIN_ROOT)/hpc
+HPC := $(call find_tool,hpc)

 $(eval $(call canonicaliseExecutable,TEST_HC))

Change History (6)

comment:1 Changed 5 years ago by thomie

Differential Rev(s): Phab:D705
Milestone: 7.12.1
Status: newpatch

comment:2 Changed 5 years ago by Austin Seipp <austin@…>

In 504d8a4b183670830093a81d3c7a6d78416aed20/ghc:

Don't assume tools are in same directory as ghc in some cases

Summary: Tools such as `ghc-pkg` and `runghc` are no longer required to be in the same directory as `ghc` when running tests, provided that `TEST_HC` is not explicitly set and an in-tree compiler is not used.  Fixes #10126.

Reviewers: thomie, austin

Reviewed By: thomie, austin

Subscribers: thomie

Differential Revision:

GHC Trac Issues: #10126

comment:3 Changed 5 years ago by thoughtpolice

Resolution: fixed
Status: patchclosed

Merged, thanks!

comment:4 Changed 5 years ago by thomie

Owner: Rufflewind deleted
Resolution: fixed
Status: closednew

comment:5 Changed 5 years ago by thomie

Status: newmerge

This commit is also needed to make the two in #10449 function properly.

That changes the test failures in perf/haddock from:

      3 had missing libraries

To the correct (on my local devel2 build):

       3 unexpected stat failures
   .  haddock.Cabal [stat not good enough] (normal)
   .  haddock.base [stat not good enough] (normal)
   .  haddock.compiler [stat not good enough] (normal)

comment:6 Changed 5 years ago by thoughtpolice

Resolution: fixed
Status: mergeclosed

Merged to ghc-7.10.

Note: See TracTickets for help on using tickets.