From d03a4d43af93e34010eebf28a153f87e5c6b76c3 Mon Sep 17 00:00:00 2001 From: Martin Kinkelin Date: Fri, 22 Dec 2023 03:33:33 +0100 Subject: [PATCH] DMD tests on Windows: Default CC to cl.exe in PATH for MSVC models Instead of defaulting to some old hardcoded version. --- .azure-pipelines/windows-msbuild.bat | 2 +- compiler/test/tools/d_do_test.d | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.azure-pipelines/windows-msbuild.bat b/.azure-pipelines/windows-msbuild.bat index a36295257d..8c8834164b 100644 --- a/.azure-pipelines/windows-msbuild.bat +++ b/.azure-pipelines/windows-msbuild.bat @@ -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") diff --git a/compiler/test/tools/d_do_test.d b/compiler/test/tools/d_do_test.d index b642c4d993..62ec4ee46e 100755 --- a/compiler/test/tools/d_do_test.d +++ b/compiler/test/tools/d_do_test.d @@ -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";