[xharness] Propagate the BUILD_REVISION variable to test apps to specify if we're in CI or not. Fixes xamarin/maccore#649. (#6469)

We have tests whose behavior changes when executed on CI, and those tests use
the BUILD_REVISION variable to detect where they're being executed. For this
to work we need to propagate the BUILD_REVISION variable to the test
executable.

Hopefully fixes https://github.com/xamarin/maccore/issues/649 now.
This commit is contained in:
monojenkins 2019-07-02 03:53:09 -04:00 коммит произвёл Rolf Bjarne Kvinge
Родитель 065ad880d3
Коммит a3f27ccbc1
2 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -532,6 +532,11 @@ namespace xharness
args.Append (" -setenv=NUNIT_ENABLE_XML_MODE=wrapped"); args.Append (" -setenv=NUNIT_ENABLE_XML_MODE=wrapped");
} }
if (Harness.InCI) {
// We use the 'BUILD_REVISION' variable to detect whether we're running CI or not.
args.Append ($" -setenv=BUILD_REVISION=${Environment.GetEnvironmentVariable ("BUILD_REVISION")}");
}
if (!Harness.IncludeSystemPermissionTests) if (!Harness.IncludeSystemPermissionTests)
args.Append (" -setenv=DISABLE_SYSTEM_PERMISSION_TESTS=1"); args.Append (" -setenv=DISABLE_SYSTEM_PERMISSION_TESTS=1");

Просмотреть файл

@ -689,6 +689,13 @@ namespace xharness
} }
} }
public bool InCI {
get {
// We use the 'BUILD_REVISION' variable to detect whether we're running CI or not.
return !string.IsNullOrEmpty (Environment.GetEnvironmentVariable ("BUILD_REVISION"));
}
}
public bool UseGroupedApps { public bool UseGroupedApps {
get { get {
var groupApps = Environment.GetEnvironmentVariable ("BCL_GROUPED_APPS"); var groupApps = Environment.GetEnvironmentVariable ("BCL_GROUPED_APPS");