Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions src/Platform/Microsoft.Testing.Platform/Builder/TestApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -341,17 +341,57 @@ private static ApplicationLoggingState CreateFileLoggerIfDiagnosticIsEnabled(
prefixName = prefixNameArg[0];
}

// Override the prefix name
string? environmentFilePrefix = environment.GetEnvironmentVariable(EnvironmentVariableConstants.TESTINGPLATFORM_DIAGNOSTIC_OUTPUT_FILEPREFIX);
// Override the prefix name.
// Prefer the new TESTINGPLATFORM_DIAGNOSTIC_FILE_PREFIX env var (matching the --diagnostic-file-prefix CLI option),
// but fall back to the legacy TESTINGPLATFORM_DIAGNOSTIC_OUTPUT_FILEPREFIX for backward compatibility.
// See https://github.com/microsoft/testfx/issues/7159.
string? environmentFilePrefix = environment.GetEnvironmentVariable(EnvironmentVariableConstants.TESTINGPLATFORM_DIAGNOSTIC_FILE_PREFIX);
#pragma warning disable CS0618 // Type or member is obsolete - intentional back-compat fallback to the legacy env var.
string? legacyEnvironmentFilePrefix = environment.GetEnvironmentVariable(EnvironmentVariableConstants.TESTINGPLATFORM_DIAGNOSTIC_OUTPUT_FILEPREFIX);
if (!RoslynString.IsNullOrEmpty(legacyEnvironmentFilePrefix))
{
console.WriteLine(string.Format(
CultureInfo.InvariantCulture,
PlatformResources.DeprecatedEnvironmentVariableWarning,
EnvironmentVariableConstants.TESTINGPLATFORM_DIAGNOSTIC_OUTPUT_FILEPREFIX,
EnvironmentVariableConstants.TESTINGPLATFORM_DIAGNOSTIC_FILE_PREFIX));
}
#pragma warning restore CS0618

if (RoslynString.IsNullOrEmpty(environmentFilePrefix))
{
environmentFilePrefix = legacyEnvironmentFilePrefix;
}

if (!RoslynString.IsNullOrEmpty(environmentFilePrefix))
{
prefixName = environmentFilePrefix;
}

bool synchronousWrite = result.IsOptionSet(PlatformCommandLineProvider.DiagnosticFileLoggerSynchronousWriteOptionKey);

// Override the synchronous write
string? environmentSynchronousWrite = environment.GetEnvironmentVariable(EnvironmentVariableConstants.TESTINGPLATFORM_DIAGNOSTIC_FILELOGGER_SYNCHRONOUSWRITE);
// Override the synchronous write.
// Prefer the new TESTINGPLATFORM_DIAGNOSTIC_SYNCHRONOUS_WRITE env var (matching the --diagnostic-synchronous-write CLI option),
// but fall back to the legacy TESTINGPLATFORM_DIAGNOSTIC_FILELOGGER_SYNCHRONOUSWRITE for backward compatibility.
// See https://github.com/microsoft/testfx/issues/7159.
string? environmentSynchronousWrite = environment.GetEnvironmentVariable(EnvironmentVariableConstants.TESTINGPLATFORM_DIAGNOSTIC_SYNCHRONOUS_WRITE);
#pragma warning disable CS0618 // Type or member is obsolete - intentional back-compat fallback to the legacy env var.
string? legacyEnvironmentSynchronousWrite = environment.GetEnvironmentVariable(EnvironmentVariableConstants.TESTINGPLATFORM_DIAGNOSTIC_FILELOGGER_SYNCHRONOUSWRITE);
if (!RoslynString.IsNullOrEmpty(legacyEnvironmentSynchronousWrite))
{
console.WriteLine(string.Format(
CultureInfo.InvariantCulture,
PlatformResources.DeprecatedEnvironmentVariableWarning,
EnvironmentVariableConstants.TESTINGPLATFORM_DIAGNOSTIC_FILELOGGER_SYNCHRONOUSWRITE,
EnvironmentVariableConstants.TESTINGPLATFORM_DIAGNOSTIC_SYNCHRONOUS_WRITE));
}
#pragma warning restore CS0618

if (RoslynString.IsNullOrEmpty(environmentSynchronousWrite))
{
environmentSynchronousWrite = legacyEnvironmentSynchronousWrite;
}

if (!RoslynString.IsNullOrEmpty(environmentSynchronousWrite))
{
synchronousWrite = environmentSynchronousWrite == "1";
Comment thread
Evangelink marked this conversation as resolved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ internal static class EnvironmentVariableConstants
public const string TESTINGPLATFORM_DIAGNOSTIC = nameof(TESTINGPLATFORM_DIAGNOSTIC);
public const string TESTINGPLATFORM_DIAGNOSTIC_VERBOSITY = nameof(TESTINGPLATFORM_DIAGNOSTIC_VERBOSITY);
public const string TESTINGPLATFORM_DIAGNOSTIC_OUTPUT_DIRECTORY = nameof(TESTINGPLATFORM_DIAGNOSTIC_OUTPUT_DIRECTORY);

[Obsolete("Use " + nameof(TESTINGPLATFORM_DIAGNOSTIC_FILE_PREFIX) + " instead. This name matches the renamed --diagnostic-file-prefix CLI option (see https://github.com/microsoft/testfx/issues/7159). Kept for backward compatibility and may be removed in a future major version.", error: false)]
public const string TESTINGPLATFORM_DIAGNOSTIC_OUTPUT_FILEPREFIX = nameof(TESTINGPLATFORM_DIAGNOSTIC_OUTPUT_FILEPREFIX);
public const string TESTINGPLATFORM_DIAGNOSTIC_FILE_PREFIX = nameof(TESTINGPLATFORM_DIAGNOSTIC_FILE_PREFIX);

[Obsolete("Use " + nameof(TESTINGPLATFORM_DIAGNOSTIC_SYNCHRONOUS_WRITE) + " instead. This name matches the renamed --diagnostic-synchronous-write CLI option (see https://github.com/microsoft/testfx/issues/7159). Kept for backward compatibility and may be removed in a future major version.", error: false)]
public const string TESTINGPLATFORM_DIAGNOSTIC_FILELOGGER_SYNCHRONOUSWRITE = nameof(TESTINGPLATFORM_DIAGNOSTIC_FILELOGGER_SYNCHRONOUSWRITE);
public const string TESTINGPLATFORM_DIAGNOSTIC_SYNCHRONOUS_WRITE = nameof(TESTINGPLATFORM_DIAGNOSTIC_SYNCHRONOUS_WRITE);
public const string TESTINGPLATFORM_NOBANNER = nameof(TESTINGPLATFORM_NOBANNER);
public const string TESTINGPLATFORM_EXITCODE_IGNORE = nameof(TESTINGPLATFORM_EXITCODE_IGNORE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,10 @@ Takes one argument as string in the format <value>[h|m|s] where 'value' is
<value>Exception during the cancellation of request id '{0}'</value>
<comment>{0} is the request id</comment>
</data>
<data name="DeprecatedEnvironmentVariableWarning" xml:space="preserve">
<value>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</value>
<comment>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</comment>
</data>
<data name="PlatformCommandLineMaxFailedTestsOptionDescription" xml:space="preserve">
<value>Specifies a maximum number of test failures that, when exceeded, will abort the test run.</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">Nepodařilo se najít adresář {0}.</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">Diagnostický soubor (úroveň {0} s asynchronním vyprázdněním): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">Das Verzeichnis "{0}" konnte nicht gefunden werden</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">Diagnosedatei (Ebene „{0}“ mit asynchroner Leerung): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">No se pudo encontrar el directorio '{0}'</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">Archivo de diagnóstico (nivel '{0}' con vaciado asincrónico): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">Répertoire « {0} » introuvable.</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">Fichier de diagnostic (niveau « {0} » avec vidage asynchrone) : {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">Non è stato possibile trovare la directory '{0}'</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">File di diagnostica (livello '{0}' con scaricamento asincrono): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">ディレクトリ '{0}' が見つかりませんでした。</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">診断ファイル (レベル '{0}' で非同期フラッシュ): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">{0} 디렉터리를 찾을 수 없음</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">진단 파일(비동기 플러시를 사용한 수준 '{0}'): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">Nie można odnaleźć katalogu „{0}”.</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">Plik diagnostyczny (poziom „{0}” z asynchronicznym opróżnianiem): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">Não foi possível localizar o diretório “{0}”</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">Arquivo de diagnóstico (nível "{0}" com liberação assíncrona): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">Не удалось найти каталог "{0}".</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">Файл диагностики (уровень '{0}' асинхронной очисткой): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">'{0}' dizini bulunamadı</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">Tanılama dosyası (zaman uyumsuz boşaltma ile düzey '{0}'): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">找不到目录“{0}”</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">诊断文件(具有异步刷新的级别“{0}”): {1}</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@
<target state="translated">找不到目錄 '{0}'</target>
<note />
</trans-unit>
<trans-unit id="DeprecatedEnvironmentVariableWarning">
<source>Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</source>
<target state="new">Warning: The environment variable '{0}' is deprecated and will be removed in a future major version. Use '{1}' instead.</target>
<note>{0} is the deprecated environment variable name, {1} is the replacement environment variable name.</note>
</trans-unit>
<trans-unit id="DiagnosticFileLevelWithAsyncFlush">
<source>Diagnostic file (level '{0}' with async flush): {1}</source>
<target state="translated">診斷檔案 (具有非同步排清的層級 '{0}'): {1}</target>
Expand Down
Loading
Loading