...
 
Commits (39)
This diff is collapsed.
This diff is collapsed.
#!/bin/bash
set -e
toolchain=`pwd`/toolchain
PATH="$toolchain/bin:$PATH"
if [ -d "`pwd`/cabal-cache" ]; then
cp -Rf cabal-cache $HOME/.cabal
fi
if [ ! -e $toolchain/bin/ghc ]; then
mkdir -p tmp
cd tmp
ghc_tarball="https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-x86_64-apple-darwin.tar.xz"
echo "Fetching GHC from $ghc_tarball"
curl $ghc_tarball | tar -xJ
cd ghc-$GHC_VERSION
./configure --prefix=$toolchain
make install
cd ../..
rm -Rf tmp
fi
if [ ! -e $toolchain/bin/cabal ]; then
cabal_tarball="https://downloads.haskell.org/~cabal/cabal-install-$CABAL_INSTALL_VERSION/cabal-install-$CABAL_INSTALL_VERSION-x86_64-apple-darwin-sierra.tar.xz"
echo "Fetching cabal-install from $cabal_tarball"
curl $cabal_tarball | tar -xz
mv cabal $toolchain/bin
fi
if [ ! -e $toolchain/bin/happy ]; then
cabal update
cabal new-install happy --symlink-bindir=$toolchain/bin
fi
if [ ! -e $toolchain/bin/alex ]; then
cabal update
cabal new-install alex --symlink-bindir=$toolchain/bin
fi
#!/usr/bin/env bash
# vim: sw=2 et
set -euo pipefail
fail() {
echo "ERROR: $*" >&2
exit 1
}
hackage_index_state="@1522046735"
if [[ -z ${BUILD_SPHINX_HTML:-} ]]; then BUILD_SPHINX_HTML=YES; fi
if [[ -z ${BUILD_SPHINX_PDF:-} ]]; then BUILD_SPHINX_PDF=YES; fi
if [[ -z ${INTEGER_LIBRARY:-} ]]; then INTEGER_LIBRARY=integer-gmp; fi
if [[ -z ${BUILD_FLAVOUR:-} ]]; then BUILD_FLAVOUR=perf; fi
if [[ -z ${XZ:-} ]]; then
if which pxz; then
XZ="pxz"
elif which xz; then
# Check whether --threads is supported
if echo "hello" | xz --threads=$CORES >/dev/null; then
XZ="xz --threads=$CORES"
else
XZ="xz"
fi
else
echo "error: neither pxz nor xz were found"
exit 1
fi
fi
echo "Using $XZ for compression..."
cat > mk/build.mk <<EOF
V=1
HADDOCK_DOCS=YES
LATEX_DOCS=YES
HSCOLOUR_SRCS=YES
BUILD_SPHINX_HTML=$BUILD_SPHINX_HTML
BUILD_SPHINX_PDF=$BUILD_SPHINX_PDF
BeConservative=YES
INTEGER_LIBRARY=$INTEGER_LIBRARY
XZ_CMD=$XZ
EOF
cat <<EOF >> mk/build.mk
BuildFlavour=$BUILD_FLAVOUR
ifneq "\$(BuildFlavour)" ""
include mk/flavours/\$(BuildFlavour).mk
endif
GhcLibHcOpts+=-haddock
EOF
case "$(uname)" in
Linux)
if [[ -n ${TARGET:-} ]]; then
if [[ $TARGET = FreeBSD ]]; then
# cross-compiling to FreeBSD
echo 'HADDOCK_DOCS = NO' >> mk/build.mk
echo 'WERROR=' >> mk/build.mk
# https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables
echo 'export PATH=/opt/ghc/bin:$PATH' >> $BASH_ENV
else
fail "TARGET=$target not supported"
fi
fi
;;
Darwin)
if [[ -n ${TARGET:-} ]]; then
fail "uname=$(uname) not supported for cross-compilation"
fi
# It looks like we already have python2 here and just installing python3
# does not work.
brew upgrade python
brew install ghc cabal-install ncurses gmp
pip3 install sphinx
# PDF documentation disabled as MacTeX apparently doesn't include xelatex.
#brew cask install mactex
cabal update
cabal install --reinstall alex happy haddock hscolour --index-state=$hackage_index_state
# put them on the $PATH, don't fail if already installed
ln -s $HOME/.cabal/bin/alex /usr/local/bin/alex || true
ln -s $HOME/.cabal/bin/happy /usr/local/bin/happy || true
ln -s $HOME/.cabal/bin/HsColour /usr/local/bin/HsColour || true
echo "libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-intree-gmp" >> mk/build.mk
;;
*)
fail "uname=$(uname) not supported"
esac
echo "================================================="
echo "Build.mk:"
echo ""
cat mk/build.mk
echo "================================================="
#!/bin/bash
set -e
toolchain=`pwd`/toolchain
PATH="$toolchain/bin:/mingw64/bin:$PATH"
if [ -d "`pwd`/cabal-cache" ]; then
cp -Rf cabal-cache $APPDATA/cabal
fi
if [ ! -e $toolchain/bin/ghc ]; then
case $MSYSTEM in
MINGW32)
triple="i386-unknown-mingw32"
;;
MINGW64)
triple="x86_64-unknown-mingw32"
;;
*)
echo "win32-init: Unknown MSYSTEM $MSYSTEM"
exit 1
;;
esac
curl https://downloads.haskell.org/~ghc/$GHC_VERSION/ghc-$GHC_VERSION-$triple.tar.xz | tar -xJ
mv ghc-$GHC_VERSION toolchain
fi
if [ ! -e $toolchain/bin/cabal ]; then
url="https://downloads.haskell.org/~cabal/cabal-install-2.4.1.0/cabal-install-2.4.1.0-x86_64-unknown-mingw32.zip"
curl $url > /tmp/cabal.zip
unzip /tmp/cabal.zip
mv cabal.exe $toolchain/bin
fi
if [ ! -e $toolchain/bin/happy ]; then
cabal update
cabal install happy
cp $APPDATA/cabal/bin/happy $toolchain/bin
fi
if [ ! -e $toolchain/bin/alex ]; then
cabal update
cabal install alex
cp $APPDATA/cabal/bin/alex $toolchain/bin
fi
......@@ -1836,7 +1836,9 @@ wayOptl :: Platform -> Way -> [String]
wayOptl _ (WayCustom {}) = []
wayOptl platform WayThreaded =
case platformOS platform of
OSFreeBSD -> ["-pthread"]
-- N.B. FreeBSD cc throws a warning if we pass -pthread without
-- actually using any pthread symbols.
OSFreeBSD -> ["-pthread", "-Wno-unused-command-line-argument"]
OSOpenBSD -> ["-pthread"]
OSNetBSD -> ["-pthread"]
_ -> []
......
......@@ -68,7 +68,7 @@ readProcessEnvWithExitCode
-> IO (ExitCode, String, String) -- ^ (exit_code, stdout, stderr)
readProcessEnvWithExitCode prog args env_update = do
current_env <- getEnvironment
readCreateProcessWithExitCode (proc prog args) {
readCreateProcessWithExitCode ((proc prog args) {use_process_jobs = True}) {
env = Just (replaceVar env_update current_env) } ""
-- Don't let gcc localize version info string, #8825
......@@ -220,8 +220,21 @@ builderMainLoop dflags filter_fn pgm real_args mb_cwd mb_env = do
-- unless an exception was raised.
let safely inner = mask $ \restore -> do
-- acquire
(hStdIn, hStdOut, hStdErr, hProcess) <- restore $
runInteractiveProcess pgm real_args mb_cwd mb_env
-- On Windows due to how exec is emulated the old process will exit and
-- a new process will be created. This means waiting for termination of
-- the parent process will get you in a race condition as the child may
-- not have finished yet. This caused #16450. To fix this use a
-- process job to track all child processes and wait for each one to
-- finish.
let procdata = (proc pgm real_args) { cwd = mb_cwd
, env = mb_env
, use_process_jobs = True
, std_in = CreatePipe
, std_out = CreatePipe
, std_err = CreatePipe
}
(Just hStdIn, Just hStdOut, Just hStdErr, hProcess) <- restore $
createProcess_ "builderMainLoop" procdata
let cleanup_handles = do
hClose hStdIn
hClose hStdOut
......
......@@ -142,7 +142,7 @@ state 61 contains 47 shift/reduce conflicts.
*** btype -> tyapps .
tyapps -> tyapps . tyapp
Conflicts: '_' ':' '~' '!' '.' '`' '{' '[' '[:' '(' '(#' '`' TYPEAPP
Conflicts: '_' ':' '~' '!' '.' '`' '{' '[' '(' '(#' '`' TYPEAPP
SIMPLEQUOTE VARID CONID VARSYM CONSYM QCONID QVARSYM QCONSYM
STRING INTEGER TH_ID_SPLICE '$(' TH_QUASIQUOTE TH_QQUASIQUOTE
and all the special ids.
......@@ -561,8 +561,6 @@ are the most common patterns, rewritten as regular expressions for clarity:
vccurly { L _ ITvccurly } -- virtual close curly (from layout)
'[' { L _ ITobrack }
']' { L _ ITcbrack }
'[:' { L _ ITopabrack }
':]' { L _ ITcpabrack }
'(' { L _ IToparen }
')' { L _ ITcparen }
'(#' { L _ IToubxparen }
......
......@@ -1291,8 +1291,7 @@ modificationTimeIfExists f = do
-- also results in a skip.
withAtomicRename :: (MonadIO m) => FilePath -> (FilePath -> m a) -> m a
withAtomicRename targetFile f
| enableAtomicRename = do
withAtomicRename targetFile f = do
-- The temp file must be on the same file system (mount) as the target file
-- to result in an atomic move on most platforms.
-- The standard way to ensure that is to place it into the same directory.
......@@ -1303,17 +1302,6 @@ withAtomicRename targetFile f
liftIO $ renameFile temp targetFile
return res
| otherwise = f targetFile
where
-- As described in #16450, enabling this causes spurious build failures due
-- to apparently missing files.
enableAtomicRename :: Bool
#if defined(mingw32_BUILD_OS)
enableAtomicRename = False
#else
enableAtomicRename = True
#endif
-- --------------------------------------------------------------
-- split a string at the last character where 'pred' is True,
-- returning a pair of strings. The first component holds the string
......
......@@ -347,7 +347,7 @@ set_up_tarballs() {
else
action="download"
fi
mk/get-win32-tarballs.sh $action $HostArch > missing-win32-tarballs
$PYTHON mk/get-win32-tarballs.py $action $mingw_arch > missing-win32-tarballs
case $? in
0)
rm missing-win32-tarballs
......@@ -359,7 +359,7 @@ set_up_tarballs() {
echo
echo " * run configure with the --enable-tarballs-autodownload option"
echo
echo " * run mk/get-win32-tarballs.sh download ${HostArch}"
echo " * run mk/get-win32-tarballs.py download $mingw_arch"
echo
echo " * manually download the files listed in ./missing-win32-tarballs and place"
echo " them in the ghc-tarballs directory."
......@@ -836,7 +836,7 @@ AC_PATH_PROG(SPHINXBUILD,sphinx-build)
AC_CACHE_CHECK([for version of sphinx-build], fp_cv_sphinx_version,
changequote(, )dnl
[if test -n "$SPHINXBUILD"; then
fp_cv_sphinx_version=`"$SPHINXBUILD" --version 2>&1 | sed 's/.* v\?\([0-9]\.[0-9]\.[0-9]\)/\1/' | head -n1`;
fp_cv_sphinx_version=`"$SPHINXBUILD" --version 2>&1 | sed 's/.* \([0-9]\.[0-9]\.[0-9]\)/\1/' | head -n1`;
fi;
changequote([, ])dnl
])
......
......@@ -61,12 +61,6 @@ dnl ** figure out how to do a BSD-ish install **
#
AC_PROG_INSTALL
#
dnl ** find `find`, used by get-win32-tarballs.sh (see #12502)
#
FP_PROG_FIND()
export FIND
#
dnl ** how to do symlinks **
#
......
......@@ -165,7 +165,7 @@ Language
good story for graceful degradation in these situations. These situations
should occur much less frequently now and degradation happens much more
smoothly, while still producing useful, sound results (see
:ghc-flag:`-fmax-pmcheck-models`).
:ghc-flag:`-fmax-pmcheck-models=⟨n⟩`).
Compiler
~~~~~~~~
......@@ -217,8 +217,8 @@ Compiler
and much more. See the :ref:`user guide <dynflags_plugins>` for
more details as well as an example.
- Deprecated flag :ghc-flag:`-fmax-pmcheck-iterations` in favor of
:ghc-flag:`-fmax-pmcheck-models`, which uses a completely different mechanism.
- Deprecated flag ``-fmax-pmcheck-iterations`` in favor of
:ghc-flag:`-fmax-pmcheck-models=⟨n⟩`, which uses a completely different mechanism.
GHCi
~~~~
......
......@@ -17,7 +17,7 @@ EXPECTED_UNDOCUMENTED_PATH = \
Path(__file__).parent / 'expected-undocumented-flags.txt'
EXPECTED_UNDOCUMENTED = \
{line for line in open(EXPECTED_UNDOCUMENTED_PATH).read().split()}
{line for line in EXPECTED_UNDOCUMENTED_PATH.read_text().split()}
def expected_undocumented(flag: str) -> bool:
if flag in EXPECTED_UNDOCUMENTED:
......@@ -48,13 +48,15 @@ def read_documented_flags(doc_flags) -> Set[str]:
if line != ''}
def read_ghc_flags(ghc_path: str) -> Set[str]:
ghc_output = subprocess.check_output([ghc_path, '--show-options'],
encoding='UTF-8')
ghc_output = subprocess.check_output([ghc_path, '--show-options'])
return {flag
for flag in ghc_output.split('\n')
for flag in ghc_output.decode('UTF-8').split('\n')
if not expected_undocumented(flag)
if flag != ''}
def error(s: str):
print(s, file=sys.stderr)
def main() -> None:
import argparse
parser = argparse.ArgumentParser()
......@@ -71,16 +73,16 @@ def main() -> None:
undocumented = ghc_flags - doc_flags
if len(undocumented) > 0:
print(f'Found {len(undocumented)} flags not documented in the users guide:')
print('\n'.join(f' {flag}' for flag in sorted(undocumented)))
print()
error('Found {len_undoc} flags not documented in the users guide:'.format(len_undoc=len(undocumented)), )
error('\n'.join(' {}'.format(flag) for flag in sorted(undocumented)))
error('')
failed = True
now_documented = EXPECTED_UNDOCUMENTED.intersection(doc_flags)
if len(now_documented) > 0:
print(f'Found flags that are documented yet listed in {EXPECTED_UNDOCUMENTED_PATH}:')
print('\n'.join(f' {flag}' for flag in sorted(now_documented)))
print()
error('Found flags that are documented yet listed in {}:'.format(EXPECTED_UNDOCUMENTED_PATH))
error('\n'.join(' {}'.format(flag) for flag in sorted(now_documented)))
error('')
failed = True
if failed:
......
......@@ -207,21 +207,32 @@ Furthermore GHC lets you specify the way event log data (see :rts-flag:`-l
To use an :c:type:`EventLogWriter` the RTS API provides the following functions:
.. c:func:: enum EventLogStatus eventLogStatus(void)
.. c:function:: EventLogStatus eventLogStatus(void)
Query whether the current runtime system supports the eventlog (e.g. whether
the current executable was linked with :ghc-flag:`-eventlog`) and, if it
is supported, whether it is currently logging.
.. c:func:: bool startEventLogging(const EventLogWriter *writer)
.. c:function:: bool startEventLogging(const EventLogWriter *writer)
Start logging events to the given :c:type:`EventLogWriter`. Returns true on
success or false is another writer has already been configured.
.. c:func:: void endEventLogging()
.. c:function:: void endEventLogging()
Tear down the active :c:type:`EventLogWriter`.
where the ``enum`` :c:type:`EventLogStatus` is:
.. c:type:: EventLogStatus
* ``EVENTLOG_NOT_SUPPORTED``: The runtime system wasn't compiled with
eventlog support.
* ``EVENTLOG_NOT_CONFIGURED``: An :c:type:`EventLogWriter` has not yet been
configured.
* ``EVENTLOG_RUNNING``: An :c:type:`EventLogWriter` has been configured and
is running.
.. _rts-options-misc:
......@@ -372,7 +383,7 @@ performance.
collections. Under this collection strategy oldest-generation garbage
collection can proceed concurrently with mutation.
Note that :rts-flag:`-nonmoving-gc` cannot be used with ``-G1``,
Note that :rts-flag:`--nonmoving-gc` cannot be used with ``-G1``,
:rts-flag:`profiling <-hc>` nor :rts-flag:`-c`.
.. rts-flag:: -xn
......
......@@ -1245,7 +1245,7 @@ sdist-windows-tarballs-prep :
mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_ROOT)
mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_DIR)
mkdir -p $(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs
cd $(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs && lndir $(TOP)/ghc-tarballs
cd $(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs && ln -s $(TOP)/ghc-tarballs/i686 . && ln -s $(TOP)/ghc-tarballs/x86_64
$(call removeTrees,$(SRC_DIST_WINDOWS_TARBALLS_DIR)/ghc-tarballs/.git)
.PHONY: sdist-testsuite-prep
......
......@@ -82,7 +82,7 @@ main = do
Rules.toolArgsTarget
shakeArgsWith options CommandLine.optDescrs $ \_ targets -> do
let targets' = removeKVs targets
let targets' = filter (not . null) $ removeKVs targets
Environment.setupEnvironment
return . Just $ if null targets'
then rules
......
......@@ -33,7 +33,8 @@ configureRules = do
-- We cannot use windowsHost here due to a cyclic dependency.
when windowsHost $ do
putBuild "| Checking for Windows tarballs..."
quietly $ cmd ["bash", "mk/get-win32-tarballs.sh", "download", System.arch]
pythonPath <- builderPath Python
quietly $ cmd [pythonPath, "mk/get-win32-tarballs.py", "download", System.arch]
let srcs = map (<.> "in") outs
context = vanillaContext Stage0 compiler
need srcs
......
Subproject commit b9253565ccf2fe4ad0124ca5a97a595edc1fbff6
Subproject commit b744cde70820841f4cfd0626bf99292f5e7edba0
......@@ -67,16 +67,13 @@ import System.Posix.Types
c_DEBUG_DUMP :: Bool
c_DEBUG_DUMP = False
-- Darwin limits the length of writes to 2GB. See
-- #17414.
-- Darwin limits the length of writes to 2GB. See #17414.
-- Moreover, Linux will only transfer up to 0x7ffff000 and interpreting the
-- result of write/read is tricky above 2GB due to its signed type. For
-- simplicity we therefore clamp on all platforms.
clampWriteSize, clampReadSize :: Int -> Int
#if defined(darwin_HOST_OS)
clampWriteSize = min 0x7fffffff
clampReadSize = min 0x7fffffff
#else
clampWriteSize = id
clampReadSize = id
#endif
clampWriteSize = min 0x7ffff000
clampReadSize = min 0x7ffff000
-- -----------------------------------------------------------------------------
-- The file-descriptor IO device
......
......@@ -143,4 +143,7 @@ data Extension
| ImportQualifiedPost
| CUSKs
| StandaloneKindSignatures
deriving (Eq, Enum, Show, Generic, Bounded)
deriving (Eq, Ord, Enum, Show, Generic, Bounded)
-- 'Ord' and 'Bounded' are provided for GHC API users (see
-- https://gitlab.haskell.org/ghc/ghc/merge_requests/2707 and
-- https://gitlab.haskell.org/ghc/ghc/merge_requests/826).
......@@ -59,7 +59,7 @@ ifneq "$(CLEANING)" "YES"
endif
gmp_CC_OPTS += $(addprefix -I,$(GMP_INCLUDE_DIRS))
gmp_CC_OPTS += $(addprefix -L,$(GMP_LIB_DIRS))
gmp_LD_OPTS += $(addprefix -L,$(GMP_LIB_DIRS))
# Compile GMP only if we don't have it already
#
......
Subproject commit bde9237b593e4f4a98f22ce05181480b8cee5526
Subproject commit 26ea79ceb2193a86f76a302a126be3319f22700d
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from pathlib import Path
import urllib.request
import subprocess
import argparse
TARBALL_VERSION = '0.1'
BASE_URL = "https://downloads.haskell.org/ghc/mingw/{}".format(TARBALL_VERSION)
BASE_URL = "http://home.smart-cactus.org/~ben/ghc/mingw/{}".format(TARBALL_VERSION)
DEST = Path('ghc-tarballs/mingw-w64')
ARCHS = ['i686', 'x86_64', 'sources']
def file_url(arch: str, fname: str) -> str:
return "{base}/{arch}/{fname}".format(
base=BASE_URL,
arch=arch,
fname=fname)
def fetch(url: str, dest: Path):
print('Fetching', url, '=>', dest)
urllib.request.urlretrieve(url, dest)
def fetch_arch(arch: str):
req = urllib.request.urlopen(file_url(arch, 'MANIFEST'))
files = req.read().decode('UTF-8').split('\n')
d = DEST / arch
if not d.is_dir():
d.mkdir(parents=True)
fetch(file_url(arch, 'SHA256SUMS'), d / 'SHA256SUMS')
for fname in files:
if not (d / fname).is_file():
fetch(file_url(arch, fname), d / fname)
verify(arch)
def verify(arch: str):
cmd = ['sha256sum', '--quiet', '--check', '--ignore-missing', 'SHA256SUMS']
subprocess.check_call(cmd, cwd=DEST / arch)
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument('mode', choices=['verify', 'download'])
parser.add_argument(
'arch',
choices=ARCHS + ['all'],
help="Architecture to fetch (either i686, x86_64, sources, or all)")
args = parser.parse_args()
action = fetch_arch if args.mode == 'download' else verify
if args.arch == 'all':
for arch in ARCHS:
action(arch)
else:
action(args.arch)
if __name__ == '__main__':
main()
This diff is collapsed.
......@@ -67,12 +67,13 @@ onIOComplete(unsigned int reqID,
dwRes = WaitForSingleObject(completed_table_sema, INFINITE);
switch (dwRes) {
case WAIT_OBJECT_0:
case WAIT_ABANDONED:
break;
default:
/* Not likely */
fprintf(stderr,
"onIOComplete: failed to grab table semaphore, "
"dropping request 0x%x\n", reqID);
"onIOComplete: failed to grab table semaphore (res=%d, err=%d), "
"dropping request 0x%x\n", reqID, dwRes, GetLastError());
fflush(stderr);
return;
}
......
......@@ -250,11 +250,11 @@ def allow_changes_string(changes: List[Tuple[MetricChange, PerfStat]]
# Decreasing group.
if groupDec:
msgs.append('Metric Decrease:' + nltab + nltab.join(groupDec))
msgs.append('Metric Decrease:' + nltab + nltab.join(sorted(groupDec)))
# Increasing group.
if groupInc:
msgs.append('Metric Increase:' + nltab + nltab.join(groupInc))
msgs.append('Metric Increase:' + nltab + nltab.join(sorted(groupInc)))
# Mixed group.
if groupMix:
......@@ -271,7 +271,7 @@ def allow_changes_string(changes: List[Tuple[MetricChange, PerfStat]]
for change_dir in [Dec, Inc]:
metric_to_tests = dir_to_metric_to_tests[change_dir]
for metric in sorted(metric_to_tests.keys()):
tests = metric_to_tests[metric]
tests = sorted(metric_to_tests[metric])
msgs.append('Metric ' + change_dir.value + ' \'' + metric + '\':' + nltab + nltab.join(tests))
return '\n\n'.join(msgs)
......
......@@ -501,7 +501,18 @@ def fast() -> bool:
def platform( plat: str ) -> bool:
return config.platform == plat
KNOWN_OPERATING_SYSTEMS = set([
'mingw32',
'freebsd',
'openbsd',
'aix',
'linux',
'darwin',
'solaris2',
])
def opsys( os: str ) -> bool:
assert os in KNOWN_OPERATING_SYSTEMS
return config.os == os
def arch( arch: str ) -> bool:
......
import os
import subprocess
import shutil
import tempfile
from pathlib import Path, PurePath
from term_color import Color, colored
......@@ -82,7 +83,28 @@ def testing_metrics():
#
# We define the following function to make this magic more
# explicit/discoverable. You are encouraged to use it instead of os.symlink.
if os.name == 'nt' and os.getenv('FORCE_SYMLINKS') == None:
def symlinks_work() -> bool:
if os.getenv('FORCE_SYMLINKS') is not None:
return True
elif os.name == 'nt':
# On Windows we try to create a symlink to test whether symlinks are
# usable.
works = False
with tempfile.NamedTemporaryFile() as tmp:
try:
tmp.write('hello')
os.symlink(tmp.name, '__symlink-test')
works = True
except OSError as e:
print('Saw {} during symlink test; assuming symlinks do not work.'.format(e))
finally:
os.unlink('__symlink-test')
return works
else:
return True
if not symlinks_work():
def link_or_copy_file(src: Path, dst: Path):
shutil.copyfile(str(src), str(dst))
else:
......
......@@ -7,9 +7,9 @@ include $(TOP)/mk/test.mk
T16930:
echo "testing -ddump-cmm-verbose for T16930 ..."
'$(TEST_HC)' $(TEST_HC_OPTS) T16930.hs -fforce-recomp -ddump-cmm-verbose -ddump-to-file
grep -rl "CAFEnv" . --include=\T16930.*
grep -rl "Post control-flow optimisations" . --include=\T16930.*
grep -rl "Post CPS Cmm" . --include=\T16930.*
grep -rl "after setInfoTableStackMap" . --include=\T16930.*
grep -rl "Layout Stack" . --include=\T16930.*
grep -rl "Post switch plan" . --include=\T16930.*
grep -rl "CAFEnv" `ls T16930.*`
grep -rl "Post control-flow optimisations" `ls T16930.*`
grep -rl "Post CPS Cmm" `ls T16930.*`
grep -rl "after setInfoTableStackMap" `ls T16930.*`
grep -rl "Layout Stack" `ls T16930.*`
grep -rl "Post switch plan" `ls T16930.*`
testing -ddump-cmm-verbose for T16930 ...
[1 of 1] Compiling Main ( T16930.hs, T16930.o )
Linking T16930 ...
./T16930.dump-cmm-caf
./T16930.dump-cmm-cfg
./T16930.dump-cmm-cps
./T16930.dump-cmm-info
./T16930.dump-cmm-sp
./T16930.dump-cmm-switch
T16930.dump-cmm-caf
T16930.dump-cmm-cfg
T16930.dump-cmm-cps
T16930.dump-cmm-info
T16930.dump-cmm-sp
T16930.dump-cmm-switch
......@@ -3,6 +3,8 @@ include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
T16608_1:
# FreeBSD's sed doesn't like operating in-place on symlinks. Un-symlinkify.
mv MyInteger.hs tmp.hs; cp tmp.hs MyInteger.hs
'$(TEST_HC)' $(TEST_HC_OPTS) --make -O0 T16608_1.hs
./T16608_1
sleep 1
......@@ -11,6 +13,8 @@ T16608_1:
./T16608_1
T16608_2:
# FreeBSD's sed doesn't like operating in-place on symlinks. Un-symlinkify.
mv MyInteger.hs tmp.hs; cp tmp.hs MyInteger.hs
'$(TEST_HC)' $(TEST_HC_OPTS) --make -O0 T16608_2.hs
./T16608_2
sleep 1
......
......@@ -10,7 +10,12 @@ test('ghcilink002', [extra_files(['TestLink.hs', 'f.c']),
unless(doing_ghci, skip)],
makefile_test, ['ghcilink002'])
test('ghcilink003', [unless(doing_ghci, skip)], makefile_test, ['ghcilink003'])
test('ghcilink003',
[unless(doing_ghci, skip),
# libstdc++ is named differently on FreeBSD
when(opsys('freebsd'), expect_broken(17739))],
makefile_test,
['ghcilink003'])
test('ghcilink004',
[extra_files(['TestLink.hs', 'f.c']),
......@@ -24,7 +29,12 @@ test('ghcilink005',
unless(doing_ghci, skip)],
makefile_test, ['ghcilink005'])
test('ghcilink006', [unless(doing_ghci, skip)], makefile_test, ['ghcilink006'])
test('ghcilink006',
[unless(doing_ghci, skip),
# libstdc++ is named differently on FreeBSD
when(opsys('freebsd'), expect_broken(17739))],
makefile_test,
['ghcilink006'])
test('T3333',
[unless(doing_ghci, skip),
......
......@@ -4,7 +4,9 @@ test('T8601', req_interp, makefile_test, [])
test('T11247', [req_interp, expect_broken(11247)], makefile_test, [])
test('T6132', [when(opsys('darwin'), expect_broken(6132))], compile, [''])
test('T6132', [
when(opsys('darwin') or opsys('freebsd'), expect_broken(6132))],
compile, [''])
test('T17171a',
[req_interp, exit_code(2), ignore_stdout, grep_errmsg(r'main')],
......
......@@ -144,7 +144,7 @@ test('T7702',
# a large effect on allocation which is hard to separate from the
# allocation done by the plugin... but a regression allocates > 90mb
collect_compiler_stats('peak_megabytes_allocated',70),
when(opsys('mingw'), expect_broken_for(16799, ['normal']))
when(opsys('mingw32'), fragile_for(16799, ['normal']))
],
compile,
['-v0 -package-db T7702plugin/pkg.T7702/local.package.conf -fplugin T7702Plugin -package T7702plugin ' + config.plugin_way_flags])
......
......@@ -390,7 +390,10 @@ test('T13123', normal, compile, ['-v0'])
test('T13098', normal, compile, ['-v0'])
test('T11046', normal, multimod_compile, ['T11046','-v0'])
test('T13366',
[expect_broken_for(13366, ['ghci']), when(opsys('darwin'), expect_broken(16083))],
[expect_broken_for(13366, ['ghci']),
# libstdc++ is named differently on FreeBSD
when(opsys('freebsd'), expect_broken(17739)),
when(opsys('darwin'), expect_broken(16083))],
compile_and_run,
['-lstdc++ -v0'])
test('T13473', normal, multimod_compile_and_run,
......