Skip to content

Commit 1a583f5

Browse files
rolfbjarneVincent Dondain
authored andcommitted
[tests] Fix test configuration issues with file moves. (dotnet#15)
This will fix at least some of the mtouch tests.
1 parent 51b52ec commit 1a583f5

1 file changed

Lines changed: 20 additions & 12 deletions

File tree

tests/common/Configuration.cs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,31 @@ public static string MonoTouchRootDirectory {
4545
}
4646
}
4747

48-
static string FindConfigFile (string name)
48+
static IEnumerable<string> FindConfigFiles (string name)
4949
{
5050
var dir = Environment.CurrentDirectory;
5151
while (dir != "/") {
5252
var file = Path.Combine (dir, name);
5353
if (File.Exists (file))
54-
return file;
54+
yield return file;
55+
file = Path.Combine (dir, "xamarin-macios", name);
56+
if (File.Exists (file))
57+
yield return file;
5558
dir = Path.GetDirectoryName (dir);
5659
}
57-
return null;
5860
}
5961

6062
static void ParseConfigFiles ()
6163
{
62-
ParseConfigFile (FindConfigFile ("test.config"));
63-
ParseConfigFile (FindConfigFile ("Make.config.local"));
64-
ParseConfigFile (FindConfigFile ("Make.config"));
64+
ParseConfigFiles (FindConfigFiles ("test.config"));
65+
ParseConfigFiles (FindConfigFiles ("Make.config.local"));
66+
ParseConfigFiles (FindConfigFiles ("Make.config"));
67+
}
68+
69+
static void ParseConfigFiles (IEnumerable<string> files)
70+
{
71+
foreach (var file in files)
72+
ParseConfigFile (file);
6573
}
6674

6775
static void ParseConfigFile (string file)
@@ -148,16 +156,16 @@ static Configuration ()
148156
Console.WriteLine (" INCLUDE_WATCHOS={0}", include_watchos);
149157
}
150158

151-
public static string MaccorePath {
159+
public static string RootPath {
152160
get {
153161
var dir = Environment.CurrentDirectory;
154-
var path = Path.Combine (dir, "maccore");
162+
var path = Path.Combine (dir, "xamarin-macios");
155163
while (!Directory.Exists (path) && path.Length > 3) {
156164
dir = Path.GetDirectoryName (dir);
157-
path = Path.Combine (dir, "maccore");
165+
path = Path.Combine (dir, "xamarin-macios");
158166
}
159167
if (!Directory.Exists (path))
160-
throw new Exception ("Could not find the maccore repo");
168+
throw new Exception ("Could not find the xamarin-macios repo");
161169
return path;
162170
}
163171
}
@@ -217,13 +225,13 @@ public static string SdkBinDir {
217225

218226
public static string BinDirXI {
219227
get {
220-
return Path.Combine (MaccorePath, "_ios-build", "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current", "bin");
228+
return Path.Combine (RootPath, "_ios-build", "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current", "bin");
221229
}
222230
}
223231

224232
public static string BinDirXM {
225233
get {
226-
return Path.Combine (MaccorePath, "_mac-build", "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current", "bin");
234+
return Path.Combine (RootPath, "_mac-build", "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current", "bin");
227235
}
228236
}
229237

0 commit comments

Comments
 (0)