Azure CI: Migrate from legacy MODEL=32mscoff to MODEL=32

Incl. fixing up the d_do_test.d tool to work properly with MODEL=32
on Windows.

And somewhat improve the documentation of MODEL=32omf, nowadays used
for the 32-bit OMF toolchain.
This commit is contained in:
Martin Kinkelin 2023-12-10 19:39:36 +01:00 committed by The Dlang Bot
parent 0c43ef8254
commit f3ad118c61
5 changed files with 34 additions and 24 deletions

View file

@ -6,7 +6,7 @@ call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
set DMD_DIR=%cd%
if "%CONFIGURATION%" == "" set CONFIGURATION=RelWithAsserts
set PLATFORM=Win32
set MODEL=32mscoff
set MODEL=32
if "%ARCH%"=="x64" set PLATFORM=x64
if "%ARCH%"=="x64" set MODEL=64
set DMD=%DMD_DIR%\generated\Windows\%CONFIGURATION%\%PLATFORM%\dmd.exe
@ -49,6 +49,8 @@ cd "%DMD_DIR%\druntime"
echo [STEP]: Building phobos
cd "%DMD_DIR%\..\phobos"
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "AR=%MSVC_AR%" "MAKE=%DM_MAKE%" "DRUNTIME=%DMD_DIR%\druntime" || exit /B 3
:: The expected Phobos filename for 32-bit COFF is phobos32mscoff.lib, not phobos32.lib.
if "%MODEL%" == "32" ren phobos32.lib phobos32mscoff.lib || exit /B 3
echo [STEP]: Building run.d testrunner and its tools
REM needs to be done before tampering with LIB and DFLAGS env variables (affecting the ldmd2 host compiler too)
@ -74,8 +76,12 @@ if not "%C_RUNTIME%" == "mingw" goto not_mingw
:mingw_exists
set DFLAGS=-mscrtlib=msvcrt120
if "%MODEL%" == "32" (
set LIB=%DMD_DIR%\mingw\dmd2\windows\lib32mscoff\mingw
) else (
set LIB=%DMD_DIR%\mingw\dmd2\windows\lib%MODEL%\mingw
set REQUIRED_ARGS=-mscrtlib=msvcrt120 "-L/LIBPATH:%DMD_DIR%\mingw\dmd2\windows\lib%MODEL%\mingw"
)
set REQUIRED_ARGS=-mscrtlib=msvcrt120 "-L/LIBPATH:%LIB%"
rem skip runnable_cxx tests (incompatible MSVC runtime versions - 2017 (cl.exe) vs. 2013)
rem FIXME: unit_tests excluded too, see above
set DMD_TESTS=runnable compilable fail_compilation dshell
@ -99,7 +105,7 @@ rem FIXME: lld-link fails to link phobos unittests ("error: relocation against s
if "%C_RUNTIME%" == "mingw" exit /B 0
cd "%DMD_DIR%\..\phobos"
if "%D_COMPILER%_%MODEL%" == "ldc_64" copy %LDC_DIR%\lib64\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "ldc_32mscoff" copy %LDC_DIR%\lib32\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "ldc_32" copy %LDC_DIR%\lib32\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "dmd_64" copy %DMD_DIR%\dmd2\windows\bin64\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "dmd_32mscoff" copy %DMD_DIR%\dmd2\windows\bin\libcurl.dll .
if "%D_COMPILER%_%MODEL%" == "dmd_32" copy %DMD_DIR%\dmd2\windows\bin\libcurl.dll .
"%DM_MAKE%" -f win64.mak MODEL=%MODEL% "DMD=%DMD%" "VCDIR=%VCINSTALLDIR%." "CC=%MSVC_CC%" "MAKE=%DM_MAKE%" "DRUNTIME=%DMD_DIR%\druntime" unittest || exit /B 7

View file

@ -13,7 +13,6 @@ jobs:
strategy:
matrix:
x64:
OS: Win_64
MODEL: 64
ARCH: x64
steps:
@ -29,11 +28,9 @@ jobs:
strategy:
matrix:
x64:
OS: Win_64
MODEL: 64
ARCH: x64
x86-OMF:
OS: Win_32
MODEL: 32omf
ARCH: x86
steps:
@ -52,13 +49,11 @@ jobs:
strategy:
matrix:
x64:
OS: Win_64
MODEL: 64
ARCH: x64
# x64 only because 32bit causes weird linker errors for several tests???
# x86-OMF:
# OS: Win_32
# MODEL: 32omf
# ARCH: x86
steps:
@ -75,17 +70,14 @@ jobs:
strategy:
matrix:
x64_Debug:
OS: Win_64
MODEL: 64
ARCH: x64
CONFIGURATION: Debug
x86-mscoff:
OS: Win_32
MODEL: 32mscoff
MODEL: 32
ARCH: x86
x86-mscoff_MinGW:
OS: Win_32
MODEL: 32mscoff
MODEL: 32
ARCH: x86
C_RUNTIME: mingw
steps:

View file

@ -204,6 +204,7 @@ Valid platforms:
Valid models:
- 32
- 32mscoff (windows only)
- 32omf (windows only)
- 64
Note that test parameters *MUST* be followed by a colon (intermediate whitespace is allowed).
@ -423,7 +424,7 @@ depend on the current platform and target:
Supported conditions:
- OS: posix, windows, ...
- Model: 64, 32mscoff and 32 (also matches 32mscoff)
- Model: 64, 32mscoff, 32omf and 32 (also matches 32mscoff + 32omf)
$r:<regex>$ any text matching <regex> (using $ inside of <regex> is not
supported, use multiple regexes instead)

View file

@ -1,4 +1,4 @@
/* DISABLED: win32 win32mscoff win64 osx32 osx64
/* DISABLED: win osx
*/
/* https://issues.dlang.org/show_bug.cgi?id=23011

View file

@ -172,6 +172,15 @@ immutable(EnvData) processEnvironment()
envData.compiler = "dmd"; //should be replaced for other compilers
envData.ccompiler = environment.get("CC");
envData.model = envGetRequired("MODEL");
if (envData.os == "windows" && envData.model == "32")
{
// FIXME: we need to translate the default 32-bit model (COFF) on Windows to legacy `32mscoff`.
// Reason: OMF-specific tests are currently specified like this:
// DISABLED: win32mscoff win64 …
// and `DISABLED: win32` would disable it for `win32omf` too.
// So we'd need something like an `ENABLED: win32omf` parameter to restrict tests to specific platforms.
envData.model = "32mscoff";
}
envData.required_args = environment.get("REQUIRED_ARGS");
envData.dobjc = environment.get("D_OBJC") == "1";
envData.coverage_build = environment.get("DMD_TEST_COVERAGE") == "1";
@ -190,6 +199,8 @@ immutable(EnvData) processEnvironment()
envData.ccompiler = "dmc";
else if (envData.model == "64")
envData.ccompiler = `C:\"Program Files (x86)"\"Microsoft Visual Studio 10.0"\VC\bin\amd64\cl.exe`;
else if (envData.model == "32mscoff")
envData.ccompiler = `C:\"Program Files (x86)"\"Microsoft Visual Studio 10.0"\VC\bin\amd64_x86\cl.exe`;
else
{
writeln("Unknown $OS$MODEL combination: ", envData.os, envData.model);
@ -519,8 +530,8 @@ private bool consumeNextToken(ref string file, const string token, ref const Env
file = file.stripLeft!(ch => ch == ' '); // Don't read line breaks
// Check if the current environment matches an entry in oss, which can either
// be an OS (e.g. "linux") or a combination of OS + MODEL (e.g. "windows32").
// The latter is important on windows because m32 might require other
// be an OS (e.g. "linux") or a combination of OS + MODEL (e.g. "windows32omf").
// The latter is important on windows because m32omf might require other
// parameters than m32mscoff/m64.
if (!oss.canFind!(o => o.skipOver(envData.os) && (o.empty || o == envData.model)))
continue; // Parameter was skipped
@ -618,9 +629,9 @@ string getDisabledReason(string[] disabledPlatforms, const ref EnvData envData)
unittest
{
immutable EnvData win32 = { os: "windows", model: "32", };
immutable EnvData win32mscoff = { os: "windows", model: "32mscoff", };
immutable EnvData win64 = { os: "windows", model: "64", };
immutable EnvData win32omf = { os: "windows", model: "32omf" };
immutable EnvData win32mscoff = { os: "windows", model: "32mscoff" };
immutable EnvData win64 = { os: "windows", model: "64" };
assert(getDisabledReason(null, win64) is null);
@ -631,10 +642,10 @@ unittest
assert(getDisabledReason([ "linux", "win32" ], win64) is null);
assert(getDisabledReason([ "win32mscoff" ], win32mscoff) == "on win32mscoff");
assert(getDisabledReason([ "win32mscoff" ], win32) is null);
assert(getDisabledReason([ "win32mscoff" ], win32omf) is null);
assert(getDisabledReason([ "win32" ], win32mscoff) == "on win32");
assert(getDisabledReason([ "win32" ], win32) == "on win32");
assert(getDisabledReason([ "win32" ], win32omf) == "on win32");
}
/**
* Reads the test configuration from the source code (using `findTestParameter` and