From e2f09b2ae99c21f9ee9e7a23d1f6030d48f53e81 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 28 Apr 2016 11:35:36 -0400 Subject: [PATCH] [tests] Fix test configuration issues with file moves. This will fix at least some of the mtouch tests. --- tests/common/Configuration.cs | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/tests/common/Configuration.cs b/tests/common/Configuration.cs index 36a4f8d2fb26..7546d1cb3756 100644 --- a/tests/common/Configuration.cs +++ b/tests/common/Configuration.cs @@ -45,23 +45,31 @@ public static string MonoTouchRootDirectory { } } - static string FindConfigFile (string name) + static IEnumerable FindConfigFiles (string name) { var dir = Environment.CurrentDirectory; while (dir != "/") { var file = Path.Combine (dir, name); if (File.Exists (file)) - return file; + yield return file; + file = Path.Combine (dir, "xamarin-macios", name); + if (File.Exists (file)) + yield return file; dir = Path.GetDirectoryName (dir); } - return null; } static void ParseConfigFiles () { - ParseConfigFile (FindConfigFile ("test.config")); - ParseConfigFile (FindConfigFile ("Make.config.local")); - ParseConfigFile (FindConfigFile ("Make.config")); + ParseConfigFiles (FindConfigFiles ("test.config")); + ParseConfigFiles (FindConfigFiles ("Make.config.local")); + ParseConfigFiles (FindConfigFiles ("Make.config")); + } + + static void ParseConfigFiles (IEnumerable files) + { + foreach (var file in files) + ParseConfigFile (file); } static void ParseConfigFile (string file) @@ -148,16 +156,16 @@ static Configuration () Console.WriteLine (" INCLUDE_WATCHOS={0}", include_watchos); } - public static string MaccorePath { + public static string RootPath { get { var dir = Environment.CurrentDirectory; - var path = Path.Combine (dir, "maccore"); + var path = Path.Combine (dir, "xamarin-macios"); while (!Directory.Exists (path) && path.Length > 3) { dir = Path.GetDirectoryName (dir); - path = Path.Combine (dir, "maccore"); + path = Path.Combine (dir, "xamarin-macios"); } if (!Directory.Exists (path)) - throw new Exception ("Could not find the maccore repo"); + throw new Exception ("Could not find the xamarin-macios repo"); return path; } } @@ -217,13 +225,13 @@ public static string SdkBinDir { public static string BinDirXI { get { - return Path.Combine (MaccorePath, "_ios-build", "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current", "bin"); + return Path.Combine (RootPath, "_ios-build", "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current", "bin"); } } public static string BinDirXM { get { - return Path.Combine (MaccorePath, "_mac-build", "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current", "bin"); + return Path.Combine (RootPath, "_mac-build", "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current", "bin"); } }