DMD tests on Windows: Default CC to cl.exe in PATH for MSVC models

Instead of defaulting to some old hardcoded version.
This commit is contained in:
Martin Kinkelin 2023-12-22 03:33:33 +01:00 committed by Nicholas Wilson
parent 174bbc5cd1
commit d03a4d43af
2 changed files with 9 additions and 12 deletions

View file

@ -91,7 +91,7 @@ make -j%N% MODEL=%MODEL% "DMD=%DMD%" %DRUNTIME_TESTS_TARGET% || exit /B 5
echo [STEP]: Running DMD testsuite
cd "%DMD_DIR%\compiler\test"
run.exe --environment --jobs=%N% %DMD_TESTS% "ARGS=-O -inline -g" "BUILD=%CONFIGURATION%" "DMD_MODEL=%PLATFORM%" CC=cl.exe || exit /B 6
run.exe --environment --jobs=%N% %DMD_TESTS% "ARGS=-O -inline -g" "BUILD=%CONFIGURATION%" "DMD_MODEL=%PLATFORM%" || exit /B 6
echo [STEP]: Building and running Phobos unittests
rem FIXME: lld-link fails to link phobos unittests ("error: relocation against symbol in discarded section: __TMP2427")

View file

@ -138,7 +138,6 @@ struct EnvData
bool coverage_build; /// `COVERAGE`: coverage build, skip linking & executing to save time
bool autoUpdate; /// `AUTO_UPDATE`: update `(TEST|RUN)_OUTPUT` on missmatch
bool printRuntime; /// `PRINT_RUNTIME`: Print time spent on a single test
bool usingMicrosoftCompiler; /// Using Visual Studio toolchain
bool tryDisabled; /// `TRY_DISABLED`:Silently try disabled tests (ignore failure and report success)
}
@ -198,9 +197,9 @@ immutable(EnvData) processEnvironment()
else if (envData.model == "32omf")
envData.ccompiler = "dmc";
else if (envData.model == "64")
envData.ccompiler = `C:\"Program Files (x86)"\"Microsoft Visual Studio 10.0"\VC\bin\amd64\cl.exe`;
envData.ccompiler = "cl";
else if (envData.model == "32mscoff")
envData.ccompiler = `C:\"Program Files (x86)"\"Microsoft Visual Studio 10.0"\VC\bin\amd64_x86\cl.exe`;
envData.ccompiler = "cl";
else
{
writeln("Unknown $OS$MODEL combination: ", envData.os, envData.model);
@ -208,8 +207,6 @@ immutable(EnvData) processEnvironment()
}
}
envData.usingMicrosoftCompiler = envData.ccompiler.toLower.endsWith("cl.exe");
version (Windows) {} else
{
version(X86_64)
@ -1098,14 +1095,14 @@ bool collectExtraSources (in string input_dir, in string output_dir, in string[]
auto curSrc = input_dir ~ envData.sep ~"extra-files" ~ envData.sep ~ cur;
auto curObj = output_dir ~ envData.sep ~ cur ~ envData.obj;
string command = quoteSpaces(compiler);
if (envData.usingMicrosoftCompiler)
{
command ~= ` /c /nologo `~curSrc~` /Fo`~curObj;
}
else if (envData.compiler == "dmd" && envData.os == "windows" && envData.model == "32omf")
if (envData.model == "32omf") // dmc.exe
{
command ~= " -c "~curSrc~" -o"~curObj;
}
else if (envData.os == "windows") // cl.exe
{
command ~= ` /c /nologo `~curSrc~` /Fo`~curObj;
}
else
{
command ~= " -m"~envData.model~" -c "~curSrc~" -o "~curObj;
@ -1832,7 +1829,7 @@ int tryMain(string[] args)
{
toCleanup ~= test_app_dmd;
version(Windows)
if (envData.usingMicrosoftCompiler)
if (envData.model != "32omf")
{
toCleanup ~= test_app_dmd_base ~ to!string(permuteIndex) ~ ".ilk";
toCleanup ~= test_app_dmd_base ~ to!string(permuteIndex) ~ ".pdb";