Skip to content
Snippets Groups Projects
Commit 987180d4 authored by Ben Gamari's avatar Ben Gamari Committed by Marge Bot
Browse files

testsuite: Add broken testcase for #19350

parent 4a7f8d5f
No related branches found
No related tags found
No related merge requests found
TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
LOCAL_PKGCONF=local.package.conf
T19350:
echo "Building libhello..."
'$(TEST_HC)' -fPIC -c clib/lib.c -o clib/lib.o
'$(TEST_HC)' -shared -no-hs-main clib/lib.o -o clib/libhello$(dllext)
rm -Rf $(LOCAL_PKGCONF)
"$(GHC_PKG)" init $(LOCAL_PKGCONF)
echo "Building T19350-lib..."
cd lib && '$(TEST_HC)' -package Cabal Setup.hs
x="$$(pwd)//clib" && cd lib && ./Setup configure -v0 --extra-lib-dirs="$$x" --extra-lib-dirs="$$x-install" --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF) --disable-library-vanilla --enable-shared
cd lib && ./Setup build
cd lib && ./Setup register --inplace
# Move libhello from its original place to ensure it isn't found via RPATH
mkdir -p clib-install
mv clib/libhello$(dllext) clib-install
echo "Testing..."
'$(TEST_HC)' $(TEST_HC_OPTS_INTERACTIVE) -package-db '$(LOCAL_PKGCONF)' -package T19350-lib -interactive < T19350.script
import Hello
hello
:q
echo "Building libhello..."
Building libhello...
'/opt/exp/ghc/ghc-landing/_build/stage1/bin/ghc' -fPIC -c clib/lib.c -o clib/lib.o
'/opt/exp/ghc/ghc-landing/_build/stage1/bin/ghc' -shared -no-hs-main clib/lib.o -o clib/libhello.so
rm -Rf local.package.conf
"/opt/exp/ghc/ghc-landing/_build/stage1/bin/ghc-pkg" init local.package.conf
echo "Building T19350-lib..."
Building T19350-lib...
cd lib && '/opt/exp/ghc/ghc-landing/_build/stage1/bin/ghc' -package Cabal Setup.hs
cd lib && ./Setup configure -v0 --extra-lib-dirs="$(pwd)/../clib" --with-compiler="/opt/exp/ghc/ghc-landing/_build/stage1/bin/ghc" --with-hc-pkg="/opt/exp/ghc/ghc-landing/_build/stage1/bin/ghc-pkg" --package-db=../local.package.conf --disable-library-vanilla --enable-shared
cd lib && ./Setup build
Preprocessing library for T19350-lib-1.0..
Building library for T19350-lib-1.0..
[1 of 1] Compiling Hello ( Hello.hs, dist/build/Hello.dyn_o )
cd lib && ./Setup register --inplace
Registering library for T19350-lib-1.0..
echo "Testing..."
Testing...
'/opt/exp/ghc/ghc-landing/_build/stage1/bin/ghc' -dcore-lint -dstg-lint -dcmm-lint -no-user-package-db -rtsopts -fno-warn-missed-specialisations -fshow-warning-groups -fdiagnostics-color=never -fno-diagnostics-show-caret -Werror=compat -dno-debug-output --interactive -v0 -ignore-dot-ghci -fno-ghci-history -package-db 'local.package.conf' -package T19350-lib -interactive < T19350.script
hello world!
# Test for #19350
# ================
#
# The plan
# ---------
# We build a C shared library (`libhello`, contained in ./clib) and then build
# a Haskell library (`T19350-lib`, in ./lib) which depends upon it via `foreign
# import`. We make sure that the libhello shared object can only be found via
# the extra-lib-dirs from the package database registration (which we do by
# moving libhello.so from its original place).
#
# Finally, we enter GHCi, load the Haskell library, and try to use it to call
# into libhello.
#
test('T19350', [req_shared_libs, expect_broken(19350), extra_files(['clib', 'lib'])], makefile_test, [])
#include <stdio.h>
void hello_world(void) {
printf("hello world!");
}
module Hello (hello) where
foreign import ccall "hello_world" hello :: IO ()
import Distribution.Simple
main = defaultMain
cabal-version: >=1.10
name: T19350-lib
version: 1.0
build-type: Simple
library
build-depends: base
exposed-modules: Hello
default-language: Haskell2010
extra-libraries: hello
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment