Skip to content

Commit e372f40

Browse files
committed
Use a different variant to compile all testsuite tools with the host compiler
1 parent 104f8cf commit e372f40

2 files changed

Lines changed: 14 additions & 15 deletions

File tree

.azure-pipelines/windows.sh

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,12 @@ clone_repos
6161
################################################################################
6262

6363
if [ "$MODEL" == "64" ] ; then
64-
export MODEL_FLAG="-m64"
6564
MAKE_FILE="win64.mak"
6665
LIBNAME=phobos64.lib
6766
elif [ "$MODEL" == "32mscoff" ] ; then
68-
export MODEL_FLAG="-m32mscoff"
6967
MAKE_FILE="win64.mak"
7068
LIBNAME=phobos32mscoff.lib
7169
else
72-
export MODEL_FLAG="-m32"
7370
export LIB="$PWD/dmd2/windows/lib"
7471
MAKE_FILE="win32.mak"
7572
LIBNAME=phobos.lib
@@ -115,20 +112,22 @@ cd "${DMD_DIR}/../druntime"
115112
cd "${DMD_DIR}/test"
116113

117114
if [ "$MODEL" == "32" ] ; then
118-
# Prebuild some tools (run & d_do_test, built by Makefile) with host compiler.
119-
"${GNU_MAKE}" -j1 test_results/run.exe MODEL="$MODEL" MODEL_FLAG="$MODEL_FLAG" N="$N"
120115
# WORKAROUND: Make Optlink use freshly built Phobos, not the host compiler's.
121-
# Optlink apparently prefers LIB in sc.ini over the LIB env variable (and `-conf=` for
122-
# DMD apparently doesn't prevent that).
123-
#rm "$LIB/../bin/sc.ini"
124-
cp "${DMD_DIR}/../phobos/$LIBNAME" .
125-
# This also requires to build the remaining tools (sanitize_json & unit_test_runner,
126-
# built by run.d, not the Makefile...) with the tested compiler, not the host compiler.
127-
"${GNU_MAKE}" -j1 start_all_tests ARGS="-O -inline -g" MODEL="$MODEL" MODEL_FLAG="$MODEL_FLAG" N="$N" HOST_DMD="$DMD_BIN_PATH"
128-
else
129-
"${GNU_MAKE}" -j1 start_all_tests ARGS="-O -inline -g" MODEL="$MODEL" MODEL_FLAG="$MODEL_FLAG" N="$N"
116+
# Optlink apparently prefers LIB in sc.ini over the LIB env variable (and
117+
# `-conf=` for DMD apparently doesn't prevent that).
118+
# There's apparently no sane way to specify a libdir for Optlink in the DMD
119+
# cmdline, so remove the sc.ini file and set the DFLAGS and LIB env variables
120+
# manually for the host compiler. These 2 variables are adapted for the
121+
# actual tests with the tested compiler (by run.d).
122+
HOST_DMD_DIR="$(cygpath -w "$DMD_DIR/tools/dmd2")"
123+
rm "$HOST_DMD_DIR/windows/bin/sc.ini"
124+
export DFLAGS="-I$HOST_DMD_DIR/src/phobos -I$HOST_DMD_DIR/src/druntime/import"
125+
export LIB="$HOST_DMD_DIR/windows/lib"
130126
fi
131127

128+
"$HOST_DC" -m$MODEL -g -i run.d
129+
./run --environment --jobs=$N all ARGS="-O -inline -g" MODEL="$MODEL"
130+
132131
################################################################################
133132
# Prepare artifacts
134133
################################################################################

test/run.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ string[string] getEnvironment()
488488
auto druntimePath = environment.get("DRUNTIME_PATH", testPath(`..\..\druntime`));
489489
auto phobosPath = environment.get("PHOBOS_PATH", testPath(`..\..\phobos`));
490490
env["DFLAGS"] = `-I%s\import -I%s`.format(druntimePath, phobosPath);
491-
env["LIB"] = phobosPath;
491+
env["LIB"] = phobosPath ~ ";" ~ environment.get("LIB");
492492
}
493493
else
494494
{

0 commit comments

Comments
 (0)