Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xharness] Generate a system variant of dont link, and run it using the oldest mono version we support in Jenkins. Fixes #4121. #4968

Merged
merged 1 commit into from
Oct 15, 2018
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
18 changes: 18 additions & 0 deletions jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,24 @@ def runXamarinMacTests (url, macOS, maccore_hash, xamarin_macios_hash)
failedTests.add (t)
}
}
// Run dontlink using the oldest system mono we support
def t = "dontlink (system)"
try {
// install oldest supported mono
sh ('''
cd mac-test-package
URL=`grep "^MIN_XM_MONO_URL=" Make.config | sed 's/.*=//'`
curl -L "$URL" --output old-mono.pkg
sudo installer -pkg old-mono.pkg -target /
mono --version
''')
// run dontlink tests using the system mono
sh ("make -C mac-test-package/tests exec-mac-system-dontlink")
} catch (error) {
echoError ("${t} failed with error: ${error}")
failed = true
failedTests.add (t)
}
}
} finally {
sh ("rm -rf ${workspace}/mac-test-package ${workspace}/*.zip")
Expand Down
1 change: 1 addition & 0 deletions tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ build
*-today.?sproj
*-today-extension.?sproj
*-today.sln
*-system.csproj
Makefile-mac.inc
.stamp*
Info-*.plist
Expand Down
1 change: 1 addition & 0 deletions tests/package-mac-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ rm -Rf $DIR
mkdir -p $DIR

make build-mac
make build-mac-system-dontlink

for app in */bin/x86/*/*.app linker/mac/*/bin/x86/*/*.app introspection/Mac/bin/x86/*/*.app; do
mkdir -p "$DIR/tests/$app"
Expand Down
4 changes: 3 additions & 1 deletion tests/xharness/BCLTestInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public class MacBCLTestInfo : BCLTestInfo

public MacBCLTestInfo (Harness harness, string testName, MacFlavors flavor) : base (harness, testName)
{
if (flavor == MacFlavors.All)
if (flavor == MacFlavors.All || flavor == MacFlavors.NonSystem)
throw new ArgumentException ("Each target must be a specific flavor");

Flavor = flavor;
Expand Down Expand Up @@ -204,6 +204,8 @@ public override void Convert ()
case MacFlavors.Full:
inputProject.AddAdditionalDefines ("XAMMAC_4_5");
break;
default:
throw new NotImplementedException (Flavor.ToString ());
}
inputProject.SetOutputPath ("bin\\$(Platform)\\$(Configuration)" + FlavorSuffix);
inputProject.SetIntermediateOutputPath ("obj\\$(Platform)\\$(Configuration)" + FlavorSuffix);
Expand Down
19 changes: 15 additions & 4 deletions tests/xharness/Harness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,15 @@ void LoadConfig ()
void AutoConfigureMac ()
{
var test_suites = new [] {
new { Directory = "apitest", ProjectFile = "apitest", Name = "apitest" },
new { Directory = "linker/mac/dont link", ProjectFile = "dont link-mac", Name = "dont link" },
new { Directory = "apitest", ProjectFile = "apitest", Name = "apitest", GenerateSystem = false },
new { Directory = "linker/mac/dont link", ProjectFile = "dont link-mac", Name = "dont link", GenerateSystem = true },
};
foreach (var p in test_suites)
MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, p.Directory + "/" + p.ProjectFile + ".sln"))) { Name = p.Name });
foreach (var p in test_suites) {
MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, p.Directory + "/" + p.ProjectFile + ".sln"))) {
Name = p.Name,
TargetFrameworkFlavor = p.GenerateSystem ? MacFlavors.All : MacFlavors.NonSystem,
});
}

MacTestProjects.Add (new MacTestProject (Path.GetFullPath (Path.Combine (RootDirectory, "introspection", "Mac", "introspection-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern) { Name = "introspection" });

Expand Down Expand Up @@ -449,6 +453,13 @@ void ConfigureMac ()
}
}

if (proj.GenerateSystem) {
var system = new MacUnifiedTarget (false, false);
system.System = true;
configureTarget (system, file, proj.IsNUnitProject);
unified_targets.Add (system);
}

var classic = new MacClassicTarget ();
configureTarget (classic, file, false);
classic_targets.Add (classic);
Expand Down
15 changes: 14 additions & 1 deletion tests/xharness/Jenkins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ IEnumerable<T> CreateTestVariations<T> (IEnumerable<T> tests, Func<XBuildTask, T
case TestPlatform.Mac_Unified32:
case TestPlatform.Mac_UnifiedXM45:
case TestPlatform.Mac_UnifiedXM45_32:
case TestPlatform.Mac_UnifiedSystem:
isMac = true;
break;
}
Expand Down Expand Up @@ -750,6 +751,8 @@ async Task PopulateTasksAsync ()
Tasks.Add (CloneExecuteTask (e, project, TestPlatform.Mac_UnifiedXM45, "-unifiedXM45", ignored));
Tasks.Add (CloneExecuteTask (e, project, TestPlatform.Mac_UnifiedXM45_32, "-unifiedXM45-32", ignored32, true));
}
if (project.GenerateSystem)
Tasks.Add (CloneExecuteTask (e, project, TestPlatform.Mac_UnifiedSystem, "-system", ignored));
}
}
}
Expand Down Expand Up @@ -1077,6 +1080,7 @@ Task RunTestServer ()
case TestPlatform.Mac_Unified32:
case TestPlatform.Mac_UnifiedXM45:
case TestPlatform.Mac_UnifiedXM45_32:
case TestPlatform.Mac_UnifiedSystem:
is_match = true;
break;
default:
Expand Down Expand Up @@ -2332,6 +2336,8 @@ public virtual string TestName {
return rv.Substring (0, rv.Length - "-unifiedXM45".Length);
case TestPlatform.Mac_UnifiedXM45_32:
return rv.Substring (0, rv.Length - "-unifiedXM45-32".Length);
case TestPlatform.Mac_UnifiedSystem:
return rv.Substring (0, rv.Length - "-unifiedSystem".Length);
default:
if (rv.EndsWith ("-watchos", StringComparison.Ordinal)) {
return rv.Substring (0, rv.Length - 8);
Expand Down Expand Up @@ -2481,6 +2487,7 @@ protected void SetEnvironmentVariables (Process process)
case TestPlatform.Mac_Unified32:
case TestPlatform.Mac_UnifiedXM45:
case TestPlatform.Mac_UnifiedXM45_32:
case TestPlatform.Mac_UnifiedSystem:
process.StartInfo.EnvironmentVariables ["MD_APPLE_SDK_ROOT"] = xcodeRoot;
process.StartInfo.EnvironmentVariables ["XBUILD_FRAMEWORK_FOLDERS_PATH"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks");
process.StartInfo.EnvironmentVariables ["MSBuildExtensionsPath"] = Path.Combine (Harness.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild");
Expand Down Expand Up @@ -2947,8 +2954,10 @@ public override string Mode {
return "Mac Unified XM45";
case TestPlatform.Mac_UnifiedXM45_32:
return "Mac Unified XM45 32-bit";
case TestPlatform.Mac_UnifiedSystem:
return "Mac Unified System";
default:
throw new NotImplementedException ();
throw new NotImplementedException (Platform.ToString ());
}
}
set {
Expand Down Expand Up @@ -3014,6 +3023,9 @@ protected override async Task RunTestAsync ()
case TestPlatform.Mac_UnifiedXM45_32:
suffix = "-unifiedXM45-32";
break;
case TestPlatform.Mac_UnifiedSystem:
suffix = "-unifiedSystem";
break;
}
if (ProjectFile.EndsWith (".sln", StringComparison.Ordinal)) {
Path = System.IO.Path.Combine (System.IO.Path.GetDirectoryName (ProjectFile), "bin", BuildTask.ProjectPlatform, BuildTask.ProjectConfiguration + suffix, name + ".app", "Contents", "MacOS", name);
Expand Down Expand Up @@ -3831,6 +3843,7 @@ public enum TestPlatform
Mac_UnifiedXM45,
Mac_Unified32,
Mac_UnifiedXM45_32,
Mac_UnifiedSystem,
}

[Flags]
Expand Down
14 changes: 12 additions & 2 deletions tests/xharness/MacUnifiedTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace xharness
public class MacUnifiedTarget : MacTarget
{
public bool Mobile { get; private set; }
public bool System { get; set; }

// Optional
public MacBCLTestInfo BCLInfo { get; set; }
Expand Down Expand Up @@ -42,13 +43,19 @@ public override string Suffix {
get {
if (SkipProjectGeneration)
return "";
string suffix = (Mobile ? "" : "XM45") + (ThirtyTwoBit ? "-32" : "");

if (System)
return "-system";

var suffix = (Mobile ? "" : "XM45") + (ThirtyTwoBit ? "-32" : "");
return "-unified" + (IsBCL ? "" : suffix);
}
}

public override string MakefileWhereSuffix {
get {
if (System)
return "system";
string suffix = (Mobile ? "" : "XM45") + (ThirtyTwoBit ? "32" : "");
return "unified" + (IsBCL ? "" : suffix);
}
Expand Down Expand Up @@ -115,7 +122,10 @@ public override Dictionary<string, string> NewPropertiesToAdd
var props = new Dictionary<string, string> ();


if (Mobile)
if (System) {
props.Add ("TargetFrameworkVersion", "v4.7.1");
props.Add ("MonoBundlingExtraArgs", "--embed-mono=no");
} else if (Mobile)
{
props.Add ("TargetFrameworkVersion", "v2.0");
}
Expand Down
9 changes: 5 additions & 4 deletions tests/xharness/TestProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public iOSTestProject (string path, bool isExecutableProject = true, bool genera
}
}

public enum MacFlavors { All, Modern, Full }
public enum MacFlavors { All, Modern, Full, System, NonSystem }

public class MacTestProject : TestProject
{
Expand All @@ -169,16 +169,17 @@ public class MacTestProject : TestProject
// Optional
public MacBCLTestInfo BCLInfo { get; set; }

public bool GenerateModern => TargetFrameworkFlavor == MacFlavors.All || TargetFrameworkFlavor == MacFlavors.Modern;
public bool GenerateFull => TargetFrameworkFlavor == MacFlavors.All || TargetFrameworkFlavor == MacFlavors.Full;
public bool GenerateModern => TargetFrameworkFlavor == MacFlavors.All || TargetFrameworkFlavor == MacFlavors.NonSystem || TargetFrameworkFlavor == MacFlavors.Modern;
public bool GenerateFull => TargetFrameworkFlavor == MacFlavors.All || TargetFrameworkFlavor == MacFlavors.NonSystem || TargetFrameworkFlavor == MacFlavors.Full;
public bool GenerateSystem => TargetFrameworkFlavor == MacFlavors.All || TargetFrameworkFlavor == MacFlavors.System;

public string Platform = "x86";

public MacTestProject () : base ()
{
}

public MacTestProject (string path, bool isExecutableProject = true, bool generateVariations = true, MacFlavors targetFrameworkFlavor = MacFlavors.All) : base (path, isExecutableProject, generateVariations)
public MacTestProject (string path, bool isExecutableProject = true, bool generateVariations = true, MacFlavors targetFrameworkFlavor = MacFlavors.NonSystem) : base (path, isExecutableProject, generateVariations)
{
TargetFrameworkFlavor = targetFrameworkFlavor;
}
Expand Down