Simon Jakobi pushed to branch wip/sjakobi/T2057 at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • testsuite/tests/driver/T2057/Makefile
    ... ... @@ -19,29 +19,41 @@ clean:
    19 19
     # Dependency graph:
    
    20 20
     #   pkgB is built against pkgA1, where A exports f1.
    
    21 21
     #   We then rebuild the same installed unit id (pkgA-1) from the pkgA2 sources,
    
    22
    -#   where A instead exports f2.
    
    23
    -#   Reading B.hi therefore finds an unfolding for g that still refers to f1,
    
    24
    -#   and compiling Main against pkgB should stop at the interface error.
    
    22
    +#   where A instead exports f2. Reading B.hi therefore finds an unfolding for g
    
    23
    +#   that still refers to f1, and compiling Main against pkgB should stop at the
    
    24
    +#   interface error.
    
    25 25
     T2057: clean
    
    26
    +
    
    26 27
     	# Create an isolated package DB and output directories for the repro.
    
    27 28
     	mkdir -p '$(PKGA1)' '$(PKGA2)' '$(PKGB)' '$(APP)'
    
    28 29
     	'$(GHC_PKG)' init '$(PKGDB)'
    
    30
    +
    
    29 31
     	# Build and register pkgA1, the original version of A.
    
    30
    -	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -package-db '$(PKGDB)' -this-unit-id pkgA-1 -O -c pkgA1/A.hs -outputdir '$(PKGA1)'
    
    32
    +	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -package-db '$(PKGDB)' \
    
    33
    +	    -this-unit-id pkgA-1 -O -c pkgA1/A.hs -outputdir '$(PKGA1)'
    
    31 34
     	ar q '$(PKGA1)/libHSpkgA-1.a' '$(PKGA1)/A.o' >/dev/null 2>&1
    
    32 35
     	sed "s|@BASE_ID@|$(BASE_ID)|g" pkgA1.conf.in >'$(WORK)/pkgA1.conf'
    
    33 36
     	'$(GHC_PKG)' --package-db '$(PKGDB)' register '$(WORK)/pkgA1.conf' >/dev/null
    
    37
    +
    
    34 38
     	# Build and register pkgB against pkgA1 so B.hi records the unfolding of g = f1.
    
    35
    -	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -package-db '$(PKGDB)' -package pkgA1 -this-unit-id pkgB-1 -O -c pkgB/B.hs -outputdir '$(PKGB)'
    
    39
    +	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -package-db '$(PKGDB)' \
    
    40
    +	    -package pkgA1 -this-unit-id pkgB-1 -O -c pkgB/B.hs \
    
    41
    +	    -outputdir '$(PKGB)'
    
    36 42
     	ar q '$(PKGB)/libHSpkgB-1.a' '$(PKGB)/B.o' >/dev/null 2>&1
    
    37 43
     	sed "s|@BASE_ID@|$(BASE_ID)|g" pkgB.conf.in >'$(WORK)/pkgB.conf'
    
    38 44
     	'$(GHC_PKG)' --package-db '$(PKGDB)' register '$(WORK)/pkgB.conf' >/dev/null
    
    45
    +
    
    39 46
     	# Rebuild the same installed unit id from pkgA2, replacing f1 with f2.
    
    40
    -	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -package-db '$(PKGDB)' -this-unit-id pkgA-1 -O -c pkgA2/A.hs -outputdir '$(PKGA2)'
    
    47
    +	'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -package-db '$(PKGDB)' \
    
    48
    +	    -this-unit-id pkgA-1 -O -c pkgA2/A.hs -outputdir '$(PKGA2)'
    
    41 49
     	ar q '$(PKGA2)/libHSpkgA-1.a' '$(PKGA2)/A.o' >/dev/null 2>&1
    
    42 50
     	sed "s|@BASE_ID@|$(BASE_ID)|g" pkgA2.conf.in >'$(WORK)/pkgA2.conf'
    
    43 51
     	'$(GHC_PKG)' --package-db '$(PKGDB)' update '$(WORK)/pkgA2.conf' >/dev/null
    
    52
    +
    
    44 53
     	# Compiling Main against pkgB should now fail while loading the stale B.hi.
    
    45
    -	! '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make app/Main.hs -O -fforce-recomp -package-db '$(PKGDB)' -package pkgB >'$(OUT)' 2>&1 || { echo "expected compilation failure" >&2; exit 1; }
    
    54
    +	! '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make app/Main.hs \
    
    55
    +	    -O -fforce-recomp -package-db '$(PKGDB)' -package pkgB \
    
    56
    +	    >'$(OUT)' 2>&1 || { echo "expected compilation failure" >&2; exit 1; }
    
    57
    +
    
    46 58
     	# Strip the absolute test directory prefix before comparing against T2057.stderr.
    
    47 59
     	sed "s#$(CURDIR)/##g" '$(OUT)' >&2

  • testsuite/tests/driver/T2057/README.md
    ... ... @@ -6,8 +6,3 @@ against one version of package `A`, then the same unit id is replaced by an
    6 6
     incompatible build of `A`. When `Main` imports `B`, GHC has to read `B.hi`,
    
    7 7
     finds an unfolding that still mentions the old `A`, and should fail while
    
    8 8
     loading interfaces.
    9
    -
    
    10
    -The golden [`T2057.stderr`](T2057.stderr) captures the expected behaviour on a
    
    11
    -fixed compiler: report the missing declaration from the stale interface and
    
    12
    -then abort with `Cannot continue after interface file error`. Any linker output
    
    13
    -would be a regression.