Commit b6d68d1b authored by Simon Peyton Jones's avatar Simon Peyton Jones

Merge branch 'master' of http://darcs.haskell.org/testsuite

parents 9cdff2b9 d6a1379c
......@@ -598,11 +598,12 @@ def test_common_work (name, opts, func, args):
if package_conf_cache_file_start_timestamp != package_conf_cache_file_end_timestamp:
framework_fail(name, 'whole-test', 'Package cache timestamps do not match: ' + str(package_conf_cache_file_start_timestamp) + ' ' + str(package_conf_cache_file_end_timestamp))
def clean(names):
clean_full_paths(map (lambda name: in_testdir(name), names))
def clean(strs):
for str in strs:
for name in glob.glob(in_testdir(str)):
clean_full_path(name)
def clean_full_paths(names):
for name in names:
def clean_full_path(name):
try:
# Remove files...
os.remove(name)
......@@ -1397,9 +1398,10 @@ def compare_outputs( kind, normaliser, extra_normaliser,
if os.path.exists(expected_file):
expected_raw = read_no_crs(expected_file)
expected_str = extra_normaliser(normaliser(expected_raw))
expected_file_for_diff = expected_file
else:
expected_str = ''
expected_file = '/dev/null'
expected_file_for_diff = '/dev/null'
actual_raw = read_no_crs(actual_file)
actual_str = extra_normaliser(normaliser(actual_raw))
......@@ -1407,12 +1409,12 @@ def compare_outputs( kind, normaliser, extra_normaliser,
if expected_str != actual_str:
print 'Actual ' + kind + ' output differs from expected:'
if expected_file == '/dev/null':
if expected_file_for_diff == '/dev/null':
expected_normalised_file = '/dev/null'
else:
expected_normalised_file = expected_file + ".normalised"
write_file(expected_normalised_file, expected_str)
actual_normalised_file = actual_file + ".normalised"
write_file(actual_normalised_file, actual_str)
......@@ -1424,24 +1426,18 @@ def compare_outputs( kind, normaliser, extra_normaliser,
# (including newlines) so the diff would be hard to read.
# This does mean that the diff might contain changes that
# would be normalised away.
r = os.system( 'diff -uw ' + expected_file + \
r = os.system( 'diff -uw ' + expected_file_for_diff + \
' ' + actual_file )
# If for some reason there were no non-whitespace differences,
# then do a full diff
if r == 0:
r = os.system( 'diff -u ' + expected_file + \
r = os.system( 'diff -u ' + expected_file_for_diff + \
' ' + actual_file )
if config.accept:
if expected_file == '':
print '*** cannot accept new output: ' + kind + \
' file does not exist.'
return 0
else:
print 'Accepting new output.'
write_file(expected_file, actual_raw)
return 1
print 'Accepting new output.'
write_file(expected_file, actual_raw)
return 0
return 1
......
......@@ -5,6 +5,7 @@ import ByteCodeLink
import CoreMonad
import Data.Array
import DataCon
import DebuggerUtils
import GHC
import HscTypes
import Linker
......
TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
LOCAL_GHC_PKG = '$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF)
# Test 1: ghci -Ldir -lfoo
# with dir/libfoo.a
.PHONY: ghcilink001
ghcilink001 :
$(RM) -rf dir001
mkdir dir001
"$(TEST_HC)" -c f.c -o dir001/foo.o
ar cqs dir001/libfoo.a dir001/foo.o
echo "test" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -Ldir001 -lfoo TestLink.hs
# Test 2: ghci -Ldir -lfoo
# with dir/libfoo.so
ifeq "$(WINDOWS)" "YES"
DLL = $1.dll
else
DLL = lib$1.so
endif
.PHONY: ghcilink002
ghcilink002 :
$(RM) -rf dir002
mkdir dir002
"$(TEST_HC)" -c -dynamic f.c -o dir002/foo.o
"$(TEST_HC)" -shared -v0 -o dir002/$(call DLL,foo) dir002/foo.o
echo "test" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -Ldir002 -lfoo TestLink.hs
# Test 3: ghci -lstdc++
# where libstdc++.so is normally found in a directory private to gcc,
# so only gcc can find it (see #5289)
.PHONY: ghcilink003
ghcilink003 :
echo ":q" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -lstdc++
# Test 4:
# package P
# library-dirs: `pwd`/dir004
# extra-libraries: foo
# with
# dir004/libfoo.a
LOCAL_PKGCONF004=dir004/local.package.conf
PKG004=dir004/pkg.conf
ghcilink004 :
$(RM) -rf dir004
mkdir dir004
#
rm -f $(PKG004)
echo "name: test" >>$(PKG004)
echo "version: 1.0" >>$(PKG004)
echo "id: test-XXX" >>$(PKG004)
echo "library-dirs: `pwd`/dir004" >>$(PKG004)
echo "extra-libraries: foo" >>$(PKG004)
echo "[]" >$(LOCAL_PKGCONF004)
'$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF004) register $(PKG004) -v0
#
"$(TEST_HC)" -c f.c -o dir004/foo.o
ar cqs dir004/libfoo.a dir004/foo.o
echo "test" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -package-conf $(LOCAL_PKGCONF004) -package test TestLink.hs
# Test 5:
# package P
# library-dirs: `pwd`/dir005
# extra-libraries: foo
# with
# dir005/libfoo.so
LOCAL_PKGCONF005=dir005/ghcilink005.package.conf
PKG005=dir005/pkg.conf
ghcilink005 :
$(RM) -rf dir005
mkdir dir005
#
rm -f $(PKG005)
echo "name: test" >>$(PKG005)
echo "version: 1.0" >>$(PKG005)
echo "id: test-XXX" >>$(PKG005)
echo "library-dirs: `pwd`/dir005" >>$(PKG005)
echo "extra-libraries: foo" >>$(PKG005)
echo "[]" >$(LOCAL_PKGCONF005)
'$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF005) register $(PKG005) -v0
#
"$(TEST_HC)" -c -dynamic f.c -o dir005/foo.o
"$(TEST_HC)" -shared -o dir005/$(call DLL,foo) dir005/foo.o
echo "test" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -package-conf $(LOCAL_PKGCONF005) -package test TestLink.hs
# Test 6:
# package P
# extra-libraries: stdc++
LOCAL_PKGCONF006=dir006/ghcilink006.package.conf
PKG006=dir006/pkg.conf
ghcilink006 :
$(RM) -rf dir006
mkdir dir006
#
rm -f $(PKG006)
echo "name: test" >>$(PKG006)
echo "version: 1.0" >>$(PKG006)
echo "id: test-XXX" >>$(PKG006)
echo "extra-libraries: stdc++" >>$(PKG006)
echo "[]" >$(LOCAL_PKGCONF006)
'$(GHC_PKG)' --no-user-package-conf -f $(LOCAL_PKGCONF006) register $(PKG006) -v0
#
echo ":q" | "$(TEST_HC)" --interactive -ignore-dot-ghci -v0 -package-conf $(LOCAL_PKGCONF006) -package test
module TestLink where
import Foreign.C
foreign import ccall "f" f :: CInt -> IO CInt
test :: IO ()
test = f 42 >>= print
test('ghcilink001',
[ if_os('mingw32', skip), # crashes; see #5371
extra_clean(['dir001/*','dir001'])
],
run_command,
['$MAKE -s --no-print-directory ghcilink001'])
test('ghcilink002',
extra_clean(['dir002/*','dir002']),
run_command,
['$MAKE -s --no-print-directory ghcilink002'])
test('ghcilink003',
[
if_os('mingw32', expect_broken(5289)), # still cannot load libstdc++
# on Windows. See also #4468.
extra_clean(['dir003/*','dir003'])
],
run_command,
['$MAKE -s --no-print-directory ghcilink003'])
test('ghcilink004',
[ if_os('mingw32', skip), # crashes; see #5371
extra_clean(['dir004/*','dir004'])
],
run_command,
['$MAKE -s --no-print-directory ghcilink004'])
test('ghcilink005',
extra_clean(['dir005/*','dir005']),
run_command,
['$MAKE -s --no-print-directory ghcilink005'])
test('ghcilink006',
extra_clean(['dir006/*','dir006']),
run_command,
['$MAKE -s --no-print-directory ghcilink006'])
int f(int x)
{
return x*2;
}
......@@ -117,8 +117,8 @@ test('T3064',
63000000)),
# expected value: 108937496 (amd64/Linux) (28/6/2011):
if_wordsize(64,
compiler_stats_num_field('bytes allocated', 100000000,
123000000)),
compiler_stats_num_field('bytes allocated', 110000000,
140000000)),
# expected value: 2247016 (x86/Linux) (28/6/2011):
if_wordsize(32,
compiler_stats_num_field('max_bytes_used', 2000000,
......
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