-
Notifications
You must be signed in to change notification settings - Fork 515
/
MTouch.cs
4651 lines (4124 loc) · 185 KB
/
MTouch.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Linq;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml;
using Xamarin.Utils;
using Xamarin.Tests;
using NUnit.Framework;
using MTouchLinker = Xamarin.Tests.LinkerOption;
using MTouchRegistrar = Xamarin.Tests.RegistrarOption;
namespace Xamarin.Tests {
static class TestTarget {
public static string ToolPath {
get {
return Path.Combine (Configuration.SdkBinDir, "mtouch");
}
}
}
}
namespace Xamarin
{
public enum Target { Sim, Dev }
public enum Config { Debug, Release }
public enum PackageMdb { Default, WithMdb, WoutMdb }
public enum MSym { Default, WithMSym, WoutMSym }
[TestFixture]
public class MTouch
{
[Test]
//[TestCase (Profile.iOS)] // tested as part of the watchOS case below, since that builds both for iOS and watchOS.
[TestCase (Profile.tvOS)]
[TestCase (Profile.watchOS)]
public void Profiling (Profile profile)
{
using (var mtouch = new MTouchTool ()) {
var tmpdir = mtouch.CreateTemporaryDirectory ();
MTouchTool ext = null;
if (profile == Profile.watchOS) {
mtouch.Profile = Profile.iOS;
ext = new MTouchTool ();
ext.Profile = profile;
ext.Profiling = true;
ext.SymbolList = Path.Combine (tmpdir, "extsymbollist.txt");
ext.CreateTemporaryWatchKitExtension ();
ext.CreateTemporaryDirectory ();
mtouch.AppExtensions.Add (ext);
ext.AssertExecute (MTouchAction.BuildDev, "ext build");
} else {
mtouch.Profile = profile;
}
mtouch.CreateTemporaryApp ();
mtouch.CreateTemporaryCacheDirectory ();
mtouch.DSym = false; // faster test
mtouch.MSym = false; // faster test
mtouch.NoStrip = true; // faster test
mtouch.Profiling = true;
mtouch.SymbolList = Path.Combine (tmpdir, "symbollist.txt");
mtouch.AssertExecute (MTouchAction.BuildDev, "build");
var profiler_symbol = "_mono_profiler_init_log";
var symbols = (IEnumerable<string>) File.ReadAllLines (mtouch.SymbolList);
Assert.That (symbols, Contains.Item (profiler_symbol), profiler_symbol);
symbols = GetNativeSymbols (mtouch.NativeExecutablePath);
Assert.That (symbols, Contains.Item (profiler_symbol), $"{profiler_symbol} nm");
if (ext != null) {
symbols = File.ReadAllLines (ext.SymbolList);
Assert.That (symbols, Contains.Item (profiler_symbol), $"{profiler_symbol} - extension");
symbols = GetNativeSymbols (ext.NativeExecutablePath);
Assert.That (symbols, Contains.Item (profiler_symbol), $"{profiler_symbol} extension nm");
}
}
}
[Test]
public void ExceptionMarshaling ()
{
using (var mtouch = new MTouchTool ()) {
var code = @"
class X : Foundation.NSObject {
public X ()
{
ValueForKey (null); // calls xamarin_IntPtr_objc_msgSend_IntPtr, so that it's not linked away.
}
}
";
mtouch.CreateTemporaryCacheDirectory ();
mtouch.CreateTemporaryApp (extraCode: code);
mtouch.CustomArguments = new string [] { "--marshal-objectivec-exceptions=throwmanagedexception", "--dlsym:+Xamarin.iOS.dll" };
mtouch.Debug = false; // make sure the output is stripped
mtouch.AssertExecute (MTouchAction.BuildDev, "build");
Assert.That (mtouch.NativeSymbolsInExecutable, Does.Contain ("_xamarin_pinvoke_wrapper_objc_msgSend"), "symbols");
Assert.That (mtouch.NativeSymbolsInExecutable, Does.Contain ("_xamarin_IntPtr_objc_msgSend_IntPtr"), "symbols 2");
// build again with llvm enabled
mtouch.Abi = "arm64+llvm";
mtouch.AssertExecute (MTouchAction.BuildDev, "build llvm");
Assert.That (mtouch.NativeSymbolsInExecutable, Does.Contain ("_xamarin_pinvoke_wrapper_objc_msgSend"), "symbols llvm");
Assert.That (mtouch.NativeSymbolsInExecutable, Does.Contain ("_xamarin_IntPtr_objc_msgSend_IntPtr"), "symbols llvm 2");
}
}
[Test]
[TestCase (NormalizationForm.FormC)]
[TestCase (NormalizationForm.FormD)]
[TestCase (NormalizationForm.FormKC)]
[TestCase (NormalizationForm.FormKD)]
public void StringNormalization (NormalizationForm form)
{
var str = "Tūhono".Normalize (form);
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryCacheDirectory ();
mtouch.CreateTemporaryApp (appName: str);
mtouch.Linker = MTouchLinker.LinkSdk;
mtouch.Verbosity = 9;
mtouch.AssertExecute (MTouchAction.BuildSim, "build");
}
}
[Test]
public void SymbolCollectionWithDlsym ()
{
// https://bugzilla.xamarin.com/show_bug.cgi?id=57826
using (var mtouch = new MTouchTool ()) {
var tmpdir = mtouch.CreateTemporaryDirectory ();
mtouch.CreateTemporaryCacheDirectory ();
var externMethod = @"
class X {
[System.Runtime.InteropServices.DllImport (""__Internal"")]
static extern void xamarin_start_wwan ();
}
";
var codeDll = externMethod + @"
public class A {}
";
var codeExe = externMethod + @"
public class B : A {}
";
var dllPath = CompileTestAppLibrary (tmpdir, codeDll, profile: Profile.iOS, appName: "A");
mtouch.References = new string [] { dllPath };
mtouch.CreateTemporaryApp (extraCode: codeExe, extraArgs: new [] { $"-r:{dllPath}" });
mtouch.Linker = MTouchLinker.LinkSdk;
mtouch.Debug = false;
mtouch.CustomArguments = new string [] { "--dlsym:+A.dll", "--dlsym:-testApp.exe" };
mtouch.AssertExecute (MTouchAction.BuildDev, "build");
var symbols = GetNativeSymbols (mtouch.NativeExecutablePath);
Assert.That (symbols, Does.Contain ("_xamarin_start_wwan"), "symb");
}
}
[Test]
public void FatAppFiles ()
{
AssertDeviceAvailable ();
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.CreateTemporaryCacheDirectory ();
mtouch.Abi = "armv7,arm64";
mtouch.TargetVer = "10.3"; // otherwise 32-bit build isn't possible
mtouch.DSym = false; // speeds up the test
mtouch.MSym = false; // speeds up the test
mtouch.AssertExecute (MTouchAction.BuildDev, "build");
var expectedFiles = new string []
{
"testApp",
"testApp.aotdata.armv7",
"testApp.aotdata.arm64",
"testApp.exe",
"mscorlib.dll",
"mscorlib.aotdata.armv7",
"mscorlib.aotdata.arm64",
"Xamarin.iOS.dll",
"Xamarin.iOS.aotdata.armv7",
"Xamarin.iOS.aotdata.arm64",
};
var notExpectedFiles = new string [] {
/* mscorlib.dll and Xamarin.iOS.dll can differ between 32-bit and 64-bit, other assemblies shouldn't */
/* these files should end up in the root app directory, not the size-specific subdirectory */
".monotouch-32/testApp.exe",
".monotouch-32/testApp.aotdata.armv7",
".monotouch-64/testApp.exe",
".monotouch-64/testApp.aotdata.arm64",
".monotouch-64/System.dll",
".monotouch-64/System.aotdata.arm64",
};
var allFiles = Directory.GetFiles (mtouch.AppPath, "*", SearchOption.AllDirectories);
var expectedFailed = new List<string> ();
foreach (var expected in expectedFiles) {
if (allFiles.Any ((v) => v.EndsWith (expected, StringComparison.Ordinal)))
continue;
expectedFailed.Add (expected);
}
Assert.IsEmpty (expectedFailed, "expected files");
var notExpectedFailed = new List<string> ();
foreach (var notExpected in notExpectedFiles) {
if (!allFiles.Any ((v) => v.EndsWith (notExpected, StringComparison.Ordinal)))
continue;
notExpectedFailed.Add (notExpected);
}
Assert.IsEmpty (notExpectedFailed, "not expected files");
}
}
[Test]
[TestCase ("code sharing 32-bit", "armv7+llvm", new string [] { "@sdk=framework=Xamarin.Sdk", "@all=staticobject" })]
[TestCase ("code sharing 64-bit", "arm64+llvm", new string [] { "@sdk=framework=Xamarin.Sdk", "@all=staticobject" })]
[TestCase ("32-bit", "armv7+llvm", new string [] { } )]
[TestCase ("64-bit", "arm64+llvm", new string [] { })]
public void CodeSharingLLVM (string name, string abi, string[] assembly_build_targets)
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.CreateTemporaryCacheDirectory ();
mtouch.Abi = abi;
mtouch.AssemblyBuildTargets.AddRange (assembly_build_targets);
mtouch.Debug = false;
mtouch.NoStrip = true; // faster test
mtouch.NoSymbolStrip = string.Empty; // faster test
mtouch.Verbosity = 4; // This is needed to get mtouch to print the output we're verifying
mtouch.TargetVer = "10.3"; // otherwise 32-bit builds aren't possible
mtouch.AssertExecute (MTouchAction.BuildDev, "build");
// Check that --llvm is passed to the AOT compiler for every assembly we AOT.
var assemblies_checked = 0;
mtouch.ForAllOutputLines ((line) =>
{
if (!line.Contains ("arm-darwin-mono-sgen") && !line.Contains ("arm64-darwin-mono-sgen"))
return;
StringAssert.Contains (" --llvm ", line, "aot command must pass --llvm to the AOT compiler");
assemblies_checked++;
});
Assert.That (assemblies_checked, Is.AtLeast (3), "We build at least 3 dlls, so we must have had at least 3 asserts above."); // mscorlib.dll, Xamarin.iOS.dll, System.dll, theApp.exe
}
}
[Test]
[TestCase ("single", "", false)]
[TestCase ("dual", "armv7,arm64", false)]
[TestCase ("llvm", "armv7+llvm", false)]
[TestCase ("debug", "", true)]
public void RebuildTest (string name, string abi, bool debug)
{
AssertDeviceAvailable ();
using (var mtouch = new MTouchTool ()) {
var codeA = "public class TestApp1 { static void Main () { System.Console.WriteLine (typeof (ObjCRuntime.Runtime).ToString ()); } }";
var codeB = "public class TestApp2 { static void Main () { System.Console.WriteLine (typeof (ObjCRuntime.Runtime).ToString ()); } }";
mtouch.CreateTemporaryApp (code: codeA);
mtouch.CreateTemporaryCacheDirectory ();
mtouch.Abi = abi;
mtouch.Debug = debug;
mtouch.TargetVer = "7.0";
mtouch.NoStrip = true;
DateTime dt = DateTime.MinValue;
mtouch.DSym = false; // we don't need the dSYMs for this test, so disable them to speed up the test.
mtouch.MSym = false; // we don't need the mSYMs for this test, so disable them to speed up the test.
mtouch.AssertExecute (MTouchAction.BuildDev, "first build");
Console.WriteLine ("first build done");
dt = DateTime.Now;
EnsureFilestampChange ();
mtouch.AssertExecute (MTouchAction.BuildDev, "second build");
Console.WriteLine ("second build done");
mtouch.AssertNoneModified (dt, name + " - second build");
// Test that a rebuild (where something changed, in this case the .exe)
// actually work. We compile with custom code to make sure it's different
// from the previous exe we built.
var subDir = Cache.CreateTemporaryDirectory ();
var exe2 = CompileTestAppExecutable (subDir,
/* the code here only changes the class name (default: 'TestApp1' changed to 'TestApp2') to minimize the related
* changes (there should be no changes in Xamarin.iOS.dll nor mscorlib.dll, even after linking) */
code: codeB, profile: mtouch.Profile);
File.Copy (exe2, mtouch.RootAssembly, true);
dt = DateTime.Now;
EnsureFilestampChange ();
mtouch.AssertExecute (MTouchAction.BuildDev, "third build");
Console.WriteLine ("third build done");
mtouch.AssertNoneModified (dt, name + " - third build", "testApp", "testApp.exe", "testApp.aotdata.armv7", "testApp.aotdata.arm64");
// Test that a complete rebuild occurs when command-line options changes
dt = DateTime.Now;
EnsureFilestampChange ();
mtouch.GccFlags = "-v";
mtouch.AssertExecute (MTouchAction.BuildDev, "fourth build");
Console.WriteLine ("fourth build done");
}
}
[Test]
public void RebuildTest_Intl ()
{
using (var tool = new MTouchTool ()) {
tool.Profile = Profile.iOS;
tool.I18N = I18N.West;
tool.Cache = Path.Combine (tool.CreateTemporaryDirectory (), "mtouch-test-cache");
tool.CreateTemporaryApp ();
Assert.AreEqual (0, tool.Execute (MTouchAction.BuildSim));
var pre_files = Directory.EnumerateFiles (tool.AppPath, "*", SearchOption.AllDirectories).ToArray ();
Directory.Delete (tool.AppPath, true);
Directory.CreateDirectory (tool.AppPath);
Assert.AreEqual (0, tool.Execute (MTouchAction.BuildSim));
var post_files = Directory.EnumerateFiles (tool.AppPath, "*", SearchOption.AllDirectories).ToArray ();
Assert.That (post_files, Is.EquivalentTo (pre_files), "files");
}
}
[Test]
public void RebuildTest_DontLink ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.NoFastSim = true;
mtouch.Linker = MTouchLinker.DontLink;
mtouch.CreateTemporaryApp ();
mtouch.CreateTemporaryCacheDirectory ();
mtouch.Verbosity = 4; // This is required to get the debug output we're testing for
mtouch.AssertExecute (MTouchAction.BuildSim, "build 1");
mtouch.AssertOutputPattern ("Linking .*/testApp.exe into .*/2-PreBuild using mode 'None'");
mtouch.AssertExecute (MTouchAction.BuildSim, "build 2");
mtouch.AssertOutputPattern ("Cached assemblies reloaded.");
}
}
void DumpFileStats (MTouchTool mtouch)
{
if (mtouch.Verbosity < 1)
return;
var directory = mtouch.Cache;
var files = Directory.GetFileSystemEntries (directory, "*", SearchOption.AllDirectories).ToList ();
files.Sort ((string x, string y) => string.CompareOrdinal (x, y));
var max = files.Max ((v) => v.Length);
var format = " {0,-" + max + "} {1}";
foreach (var file in files) {
Console.WriteLine (format, file, File.GetLastWriteTimeUtc (file).ToString ("HH:mm:ss.fffffff"));
}
}
[Test]
[TestCase ("single", "", false, new string [] { } )]
[TestCase ("dual", "armv7,arm64", false, new string [] { })]
[TestCase ("llvm", "armv7+llvm", false, new string [] { })]
[TestCase ("debug", "", true, new string [] { })]
[TestCase ("single-framework", "", false, new string [] { "@sdk=framework=Xamarin.Sdk", "@all=staticobject" })]
public void RebuildTest_WithExtensions (string name, string abi, bool debug, string[] assembly_build_targets)
{
var codeA = "[Foundation.Preserve] public class TestApp1 { static void X () { System.Console.WriteLine (typeof (ObjCRuntime.Runtime).ToString ()); } }";
var codeB = "[Foundation.Preserve] public class TestApp2 { static void X () { System.Console.WriteLine (typeof (ObjCRuntime.Runtime).ToString ()); } }";
using (var extension = new MTouchTool ()) {
extension.CreateTemporaryServiceExtension (extraCode: codeA);
extension.CreateTemporaryCacheDirectory ();
extension.Abi = abi;
extension.TargetVer = "10.3"; // otherwise 32-bit builds aren't possible
extension.Debug = debug;
extension.AssemblyBuildTargets.AddRange (assembly_build_targets);
extension.DSym = false; // faster test
extension.MSym = false; // faster test
extension.NoStrip = true; // faster test
extension.AssertExecute (MTouchAction.BuildDev, "extension build");
using (var mtouch = new MTouchTool ()) {
mtouch.AppExtensions.Add (extension);
mtouch.CreateTemporaryApp (extraCode: codeA);
mtouch.CreateTemporaryCacheDirectory ();
mtouch.Abi = abi;
mtouch.TargetVer = "10.3"; // otherwise 32-bit builds aren't possible
mtouch.Debug = debug;
mtouch.AssemblyBuildTargets.AddRange (assembly_build_targets);
mtouch.DSym = false; // faster test
mtouch.MSym = false; // faster test
mtouch.NoStrip = true; // faster test
//mtouch.Verbosity = 20; // Set the mtouch verbosity to something to print the mtouch output to the terminal. This will also enable additional debug output.
System.Action assertSupportsDynamicRegistrar = () => {
// Assert that the xamarin_supports_dynamic_registration is identical between the app and the extension.
string [] abis;
if (string.IsNullOrEmpty (abi)) {
abis = new string [] { "armv7" };
} else {
abis = abi.Split (',').Select ((v) => v.Replace ("+llvm", "")).ToArray ();
}
foreach (var a in abis) {
var ext_main = File.ReadAllText (Path.Combine (extension.Cache, a, "main.m"));
var app_main = File.ReadAllText (Path.Combine (mtouch.Cache, a, "main.m"));
var ext_str = ext_main.Substring (ext_main.IndexOf ("xamarin_supports_dynamic_registration", StringComparison.Ordinal) + 40, 4);
var app_str = app_main.Substring (app_main.IndexOf ("xamarin_supports_dynamic_registration", StringComparison.Ordinal) + 40, 4);
Assert.AreEqual (ext_str, app_str, $"Expected dynamic registration support to be identical between app ({app_str}) and extension ({ext_str}).");
Assert.That (ext_str, Is.EqualTo ("FALS").Or.EqualTo ("TRUE"), "SDR value");
}
};
var timestamp = DateTime.MinValue;
mtouch.AssertExecute (MTouchAction.BuildDev, "first build");
Console.WriteLine ($"{DateTime.Now} **** FIRST BUILD DONE ****");
DumpFileStats (mtouch);
assertSupportsDynamicRegistrar ();
timestamp = DateTime.Now;
EnsureFilestampChange ();
mtouch.AssertExecute (MTouchAction.BuildDev, "second build");
Console.WriteLine ($"{DateTime.Now} **** SECOND BUILD DONE ****");
DumpFileStats (mtouch);
mtouch.AssertNoneModified (timestamp, name);
extension.AssertNoneModified (timestamp, name);
assertSupportsDynamicRegistrar ();
// Touch the extension's executable, nothing should change
new FileInfo (extension.RootAssembly).LastWriteTimeUtc = DateTime.UtcNow;
mtouch.AssertExecute (MTouchAction.BuildDev, "touch extension executable");
Console.WriteLine ($"{DateTime.Now} **** TOUCH EXTENSION EXECUTABLE DONE ****");
DumpFileStats (mtouch);
mtouch.AssertNoneModified (timestamp, name);
extension.AssertNoneModified (timestamp, name);
assertSupportsDynamicRegistrar ();
// Touch the main app's executable, nothing should change
new FileInfo (mtouch.RootAssembly).LastWriteTimeUtc = DateTime.UtcNow;
mtouch.AssertExecute (MTouchAction.BuildDev, "touch main app executable");
Console.WriteLine ($"{DateTime.Now} **** TOUCH MAIN APP EXECUTABLE DONE ****");
DumpFileStats (mtouch);
mtouch.AssertNoneModified (timestamp, name);
extension.AssertNoneModified (timestamp, name);
assertSupportsDynamicRegistrar ();
// Test that a rebuild (where something changed, in this case the .exe)
// actually work. We compile with custom code to make sure it's different
// from the previous exe we built.
//
// The code change is minimal: only changes the class name (default: 'TestApp1' changed to 'TestApp2') to minimize the related
// changes (there should be no changes in Xamarin.iOS.dll nor mscorlib.dll, even after linking)
timestamp = DateTime.Now;
EnsureFilestampChange ();
// Rebuild the extension's .exe
extension.CreateTemporaryServiceExtension (extraCode: codeB);
mtouch.AssertExecute (MTouchAction.BuildDev, "change extension executable");
Console.WriteLine ($"{DateTime.Now} **** CHANGE EXTENSION EXECUTABLE DONE ****");
DumpFileStats (mtouch);
mtouch.AssertNoneModified (timestamp, name);
extension.AssertNoneModified (timestamp, name, "testServiceExtension", "testServiceExtension.aotdata.armv7", "testServiceExtension.aotdata.arm64", "testServiceExtension.dll");
assertSupportsDynamicRegistrar ();
timestamp = DateTime.Now;
EnsureFilestampChange ();
// Rebuild the main app's .exe
mtouch.CreateTemporaryApp (extraCode: codeB);
mtouch.AssertExecute (MTouchAction.BuildDev, "change app executable");
Console.WriteLine ($"{DateTime.Now} **** CHANGE APP EXECUTABLE DONE ****");
DumpFileStats (mtouch);
mtouch.AssertNoneModified (timestamp, name, "testApp", "testApp.aotdata.armv7", "testApp.aotdata.arm64", "testApp.exe");
extension.AssertNoneModified (timestamp, name);
assertSupportsDynamicRegistrar ();
timestamp = DateTime.Now;
EnsureFilestampChange ();
// Add a config file to the extension. This file should be added to the app, and the AOT-compiler re-executed for the root assembly.
File.WriteAllText (extension.RootAssembly + ".config", "<configuration></configuration>");
mtouch.AssertExecute (MTouchAction.BuildDev, "add config to extension dll");
Console.WriteLine ($"{DateTime.Now} **** ADD CONFIG TO EXTENSION DONE ****");
DumpFileStats (mtouch);
mtouch.AssertNoneModified (timestamp, name);
extension.AssertNoneModified (timestamp, name, "testServiceExtension.dll.config", "testServiceExtension", "testServiceExtension.aotdata.armv7", "testServiceExtension.aotdata.arm64");
CollectionAssert.Contains (Directory.EnumerateFiles (extension.AppPath, "*", SearchOption.AllDirectories).Select ((v) => Path.GetFileName (v)), "testServiceExtension.dll.config", "extension config added");
assertSupportsDynamicRegistrar ();
timestamp = DateTime.Now;
EnsureFilestampChange ();
// Add a config file to the container. This file should be added to the app, and the AOT-compiler re-executed for the root assembly.
File.WriteAllText (mtouch.RootAssembly + ".config", "<configuration></configuration>");
mtouch.AssertExecute (MTouchAction.BuildDev, "add config to container exe");
Console.WriteLine ($"{DateTime.Now} **** ADD CONFIG TO CONTAINER DONE ****");
DumpFileStats (mtouch);
mtouch.AssertNoneModified (timestamp, name, "testApp.exe.config", "testApp", "testApp.aotdata.armv7", "testApp.aotdata.arm64");
extension.AssertNoneModified (timestamp, name);
CollectionAssert.Contains (Directory.EnumerateFiles (mtouch.AppPath, "*", SearchOption.AllDirectories).Select ((v) => Path.GetFileName (v)), "testApp.exe.config", "container config added");
assertSupportsDynamicRegistrar ();
timestamp = DateTime.Now;
EnsureFilestampChange ();
{
// Add a satellite to the extension.
var satellite = extension.CreateTemporarySatelliteAssembly ();
mtouch.AssertExecute (MTouchAction.BuildDev, "add satellite to extension");
Console.WriteLine ($"{DateTime.Now} **** ADD SATELLITE TO EXTENSION DONE ****");
DumpFileStats (mtouch);
mtouch.AssertNoneModified (timestamp, name, Path.GetFileName (satellite));
extension.AssertNoneModified (timestamp, name, Path.GetFileName (satellite));
extension.AssertModified (timestamp, name, Path.GetFileName (satellite));
CollectionAssert.Contains (Directory.EnumerateFiles (extension.AppPath, "*", SearchOption.AllDirectories).Select ((v) => Path.GetFileName (v)), Path.GetFileName (satellite), "extension satellite added");
assertSupportsDynamicRegistrar ();
}
timestamp = DateTime.Now;
EnsureFilestampChange ();
{
// Add a satellite to the container.
var satellite = mtouch.CreateTemporarySatelliteAssembly ();
mtouch.AssertExecute (MTouchAction.BuildDev, "add satellite to container");
Console.WriteLine ($"{DateTime.Now} **** ADD SATELLITE TO CONTAINER DONE ****");
DumpFileStats (mtouch);
mtouch.AssertNoneModified (timestamp, name, Path.GetFileName (satellite));
extension.AssertNoneModified (timestamp, name, Path.GetFileName (satellite));
mtouch.AssertModified (timestamp, name, Path.GetFileName (satellite));
CollectionAssert.Contains (Directory.EnumerateFiles (mtouch.AppPath, "*", SearchOption.AllDirectories).Select ((v) => Path.GetFileName (v)), Path.GetFileName (satellite), "container satellite added");
assertSupportsDynamicRegistrar ();
}
}
}
}
[Test]
// Simulator
[TestCase (Target.Sim, Config.Release, PackageMdb.Default, MSym.Default, false, false, "")]
[TestCase (Target.Sim, Config.Debug, PackageMdb.Default, MSym.Default, true, false, "")]
[TestCase (Target.Sim, Config.Debug, PackageMdb.WoutMdb, MSym.Default, false, false, "")]
[TestCase (Target.Sim, Config.Release, PackageMdb.WithMdb, MSym.Default, true, false, "")]
[TestCase (Target.Sim, Config.Debug, PackageMdb.WoutMdb, MSym.Default, false, false, "--nofastsim --nolink")]
// Device
[TestCase (Target.Dev, Config.Release, PackageMdb.WithMdb, MSym.Default, true, true, "")]
[TestCase (Target.Dev, Config.Release, PackageMdb.WithMdb, MSym.WoutMSym, true, false, "")]
[TestCase (Target.Dev, Config.Release, PackageMdb.Default, MSym.Default, false, true, "--abi:armv7,arm64")]
[TestCase (Target.Dev, Config.Debug, PackageMdb.WoutMdb, MSym.Default, false, false, "")]
[TestCase (Target.Dev, Config.Debug, PackageMdb.WoutMdb, MSym.WithMSym, false, true, "")]
[TestCase (Target.Dev, Config.Release, PackageMdb.WithMdb, MSym.Default, true, true, "--abi:armv7+llvm")]
public void SymbolicationData (Target target, Config configuration, PackageMdb package_mdb, MSym msym, bool has_mdb, bool has_msym, string extra_mtouch_args)
{
if (target == Target.Dev)
AssertDeviceAvailable ();
using (var mtouch = new MTouchTool ()) {
mtouch.Profile = Profile.iOS;
mtouch.CreateTemporaryApp (hasPlist: true);
switch (package_mdb) {
case PackageMdb.WithMdb:
mtouch.PackageMdb = true;
break;
case PackageMdb.WoutMdb:
mtouch.PackageMdb = false;
break;
}
switch (msym) {
case MSym.WithMSym:
mtouch.MSym = true;
break;
case MSym.WoutMSym:
mtouch.MSym = false;
break;
}
if (configuration == Config.Debug)
mtouch.Debug = true;
var is_sim = target == Target.Sim;
mtouch.AssertExecute (is_sim ? MTouchAction.BuildSim : MTouchAction.BuildDev, "build");
var appDir = mtouch.AppPath;
var msymDir = appDir + ".mSYM";
var is_dual_asm = !is_sim && extra_mtouch_args.Contains ("--abi") && extra_mtouch_args.Contains (",");
if (!is_dual_asm) {
Assert.AreEqual (has_mdb, File.Exists (Path.Combine (appDir, "mscorlib.pdb")), "#pdb");
} else {
Assert.AreEqual (has_mdb, File.Exists (Path.Combine (appDir, ".monotouch-32", "mscorlib.pdb")), "#pdb");
}
if (has_msym) {
// assert that we do have the msym in one of the subdirs. We do not know the AOTID so we
// get all present files in the subdirs.
var dirInfo = new DirectoryInfo (msymDir);
var subDirs = dirInfo.GetDirectories ();
var msymFiles = new List<string> ();
foreach (var dir in subDirs) {
foreach (var f in dir.GetFiles ()) {
msymFiles.Add (f.Name);
}
}
Assert.AreEqual (has_msym, msymFiles.Contains ("mscorlib.dll.msym"));
var manifest = new XmlDocument ();
manifest.Load (Path.Combine (msymDir, "manifest.xml"));
Assert.AreEqual ("com.xamarin.testApp", manifest.SelectSingleNode ("/mono-debug/app-id").InnerText, "app-id");
} else {
DirectoryAssert.DoesNotExist (msymDir, "mSYM found when not expected");
}
}
}
[Test]
public void ExecutableName ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.Executable = "CustomExecutable";
mtouch.NoFastSim = true;
mtouch.Linker = MTouchLinker.DontLink;
mtouch.AssertExecute (MTouchAction.BuildSim, "build");
FileAssert.Exists (Path.Combine (mtouch.AppPath, "CustomExecutable"), "1");
FileAssert.DoesNotExist (Path.Combine (mtouch.AppPath, Path.GetFileNameWithoutExtension (mtouch.RootAssembly)), "2");
}
}
[Test]
public void MT0003 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp (appName: "mscorlib");
mtouch.Linker = MTouchLinker.DontLink;
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertError (3, "Application name 'mscorlib.exe' conflicts with an SDK or product assembly (.dll) name.");
}
}
[Test]
public void MT0010 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.CustomArguments = new string [] { "--optimize:?" };
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertError (10, "Could not parse the command line arguments: '--optimize=?'");
}
}
[Test]
public void MT0015 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.Abi = "invalid-arm";
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertError (15, "Invalid ABI: invalid-arm. Supported ABIs are: i386, x86_64, armv7, armv7+llvm, armv7+llvm+thumb2, armv7s, armv7s+llvm, armv7s+llvm+thumb2, armv7k, armv7k+llvm, arm64, arm64+llvm, arm64_32 and arm64_32+llvm.");
}
}
[Test]
public void MT0017 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryAppDirectory ();
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertError (17, "You should provide a root assembly.");
}
}
[Test]
public void MT0018 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CustomArguments = new string [] { "--unknown", "-unknown" };
mtouch.CreateTemporaryAppDirectory ();
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertError (18, "Unknown command line argument: '-unknown'");
mtouch.AssertError (18, "Unknown command line argument: '--unknown'");
}
}
[Test]
public void MT0032 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.Debug = false;
mtouch.CustomArguments = new string[] { "--debugtrack:true" };
mtouch.WarnAsError = new int[] { 32 };
mtouch.CreateTemporaryApp ();
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertError (32, "The option '--debugtrack' is ignored unless '--debug' is also specified.");
mtouch.AssertErrorCount (1);
mtouch.AssertWarningCount (0);
}
}
[Test]
[TestCase (Profile.iOS, Profile.tvOS)]
[TestCase (Profile.iOS, Profile.watchOS)]
[TestCase (Profile.tvOS, Profile.iOS)]
[TestCase (Profile.tvOS, Profile.watchOS)]
[TestCase (Profile.watchOS, Profile.iOS)]
[TestCase (Profile.watchOS, Profile.tvOS)]
public void MT0041 (Profile profile, Profile other)
{
using (var mtouch = new MTouchTool ()) {
mtouch.Profile = profile;
mtouch.CreateTemporaryApp ();
mtouch.References = new string [] {
GetBaseLibrary (profile),
GetBaseLibrary (other),
};
Assert.AreEqual (1, mtouch.Execute (MTouchAction.BuildSim));
mtouch.AssertError (41, string.Format ("Cannot reference '{0}' in a {1} app.", Path.GetFileName (GetBaseLibrary (other)), GetPlatformName (profile)));
}
}
[Test]
public void MT0073 ()
{
AssertDeviceAvailable ();
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.TargetVer = "3.1";
mtouch.Abi = "armv7s,arm64";
mtouch.AssertExecuteFailure (MTouchAction.BuildDev, $"build: {mtouch.Abi}");
mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 7.0.. Please select a newer deployment target in your project's Info.plist.");
mtouch.Abi = "armv7s";
mtouch.AssertExecuteFailure (MTouchAction.BuildDev, $"build: {mtouch.Abi}");
mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 7.0.. Please select a newer deployment target in your project's Info.plist.");
mtouch.Abi = "arm64";
mtouch.AssertExecuteFailure (MTouchAction.BuildDev, $"build: {mtouch.Abi}");
mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 7.0.. Please select a newer deployment target in your project's Info.plist.");
mtouch.Abi = "armv7";
mtouch.AssertExecuteFailure (MTouchAction.BuildDev, $"build: {mtouch.Abi}");
mtouch.AssertErrorPattern (73, "Xamarin.iOS .* does not support a deployment target of 3.1 for iOS .the minimum is 7.0.. Please select a newer deployment target in your project's Info.plist.");
}
}
[Test]
public void MT0074 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.TargetVer = "400.0.0";
mtouch.AssertExecuteFailure (MTouchAction.BuildDev, "build");
mtouch.AssertErrorPattern (74, $"Xamarin.iOS .* does not support a deployment target of 400.0.0 for iOS .the maximum is {Configuration.sdk_version}.. Please select an older deployment target in your project's Info.plist or upgrade to a newer version of Xamarin.iOS.");
}
}
[Test]
[TestCase (Profile.iOS, Profile.tvOS)]
[TestCase (Profile.iOS, Profile.watchOS)]
[TestCase (Profile.tvOS, Profile.iOS)]
[TestCase (Profile.tvOS, Profile.watchOS)]
[TestCase (Profile.watchOS, Profile.iOS)]
[TestCase (Profile.watchOS, Profile.tvOS)]
public void MT0034 (Profile exe_profile, Profile dll_profile)
{
using (var mtouch = new MTouchTool ()) {
var app = mtouch.CreateTemporaryAppDirectory ();
var testDir = Path.GetDirectoryName (app);
string exe = Path.Combine (testDir, "testApp.exe");
string dll = Path.Combine (testDir, "testLib.dll");
var dllCode = @"public class TestLib {
public TestLib ()
{
System.Console.WriteLine (typeof (Foundation.NSObject).ToString ());
}
}";
var exeCode = @"public class TestApp {
static void Main ()
{
System.Console.WriteLine (typeof (Foundation.NSObject).ToString ());
System.Console.WriteLine (new TestLib ());
}
}";
CompileCSharpCode (dll_profile, dllCode, dll);
CompileCSharpCode (exe_profile, exeCode, exe, "-r:" + dll);
mtouch.Profile = exe_profile;
mtouch.RootAssembly = exe;
mtouch.References = new string [] { GetBaseLibrary (exe_profile) };
Assert.AreEqual (1, mtouch.Execute (MTouchAction.BuildSim), "build");
var dllBase = Path.GetFileName (GetBaseLibrary (dll_profile));
mtouch.AssertError (34, string.Format ("Cannot reference '{0}' in a {1} project - it is implicitly referenced by 'testLib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.", dllBase, GetPlatformName (exe_profile)));
}
}
[Test]
public void MT0020 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
foreach (var registrar in new string [] { "oldstatic", "olddynamic", "legacy", "legacystatic", "legacydynamic" }) {
mtouch.CustomArguments = new string [] { $"--registrar:{registrar}" };
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, $"build {registrar}");
mtouch.AssertError (20, "The valid options for '--registrar' are 'static, dynamic or default'.");
}
}
}
[Test]
public void MT0023 ()
{
using (var mtouch = new MTouchTool ()) {
// Create a library with the same name as the exe
var tmp = mtouch.CreateTemporaryDirectory ();
var dllA = CompileTestAppCode ("library", tmp, "public class X {}");
mtouch.CreateTemporaryApp (code: "public class C { static void Main () { System.Console.WriteLine (typeof (X)); System.Console.WriteLine (typeof (UIKit.UIWindow)); } }", extraArgs: new [] { "-r:" + dllA });
mtouch.References = new string [] { dllA };
mtouch.Linker = MTouchLinker.DontLink;
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertErrorPattern (23, "The root assembly .*/testApp.exe conflicts with another assembly (.*/testApp.dll).");
}
}
[Test]
public void MT0023_Extension ()
{
using (var extension = new MTouchTool ()) {
// Create a library with the same name as the root assembly
var tmp = extension.CreateTemporaryDirectory ();
var dll = CompileTestAppCode ("library", tmp, "public class X {}", appName: "testApp");
extension.Linker = MTouchLinker.DontLink; // fastest.
extension.CreateTemporaryServiceExtension (extraArgs: new [] { $"-r:{dll}" }, extraCode: "class Z { static void Y () { System.Console.WriteLine (typeof (X)); } }", appName: "testApp");
extension.CreateTemporaryCacheDirectory ();
extension.References = new [] { dll };
extension.AssertExecute (MTouchAction.BuildSim, "extension build");
using (var app = new MTouchTool ()) {
app.Linker = MTouchLinker.DontLink; // fastest.
app.AppExtensions.Add (extension);
app.CreateTemporaryApp ();
app.CreateTemporaryCacheDirectory ();
app.AssertExecuteFailure (MTouchAction.BuildSim, "app build");
app.AssertError (23, $"The root assembly {extension.RootAssembly} conflicts with another assembly ({dll}).");
}
}
}
[Test]
[TestCase (Profile.iOS)]
[TestCase (Profile.watchOS)]
[TestCase (Profile.tvOS)]
public void MT0025 (Profile profile)
{
using (var mtouch = new MTouchTool ()) {
mtouch.Profile = profile;
mtouch.CreateTemporaryApp ();
mtouch.Sdk = MTouchTool.None;
mtouch.AssertExecuteFailure (MTouchAction.BuildDev, "build dev");
mtouch.AssertError (25, $"No SDK version was provided. Please add --sdk=X.Y to specify which {GetPlatformSimpleName (profile)} SDK should be used to build your application.");
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build dev");
mtouch.AssertError (25, $"No SDK version was provided. Please add --sdk=X.Y to specify which {GetPlatformSimpleName (profile)} SDK should be used to build your application.");
}
}
[Test]
public void MT0026 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.LLVMOptimizations = "-O2";
mtouch.AssertExecuteFailure (MTouchAction.BuildDev, "build");
mtouch.AssertError (26, "Could not parse the command line argument '--llvm-opt=-O2': Both assembly and optimization must be specified (assembly=optimization)");
}
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.GccFlags = "-a'-b"; // 1 single quote
mtouch.AssertExecuteFailure (MTouchAction.BuildDev, "build");
mtouch.AssertError (26, "Could not parse the command line argument '--gcc-flags=-a'-b': No matching quote found.");
}
}
[Test]
[TestCase ("'", "No matching quote found")] // 1 single quote
[TestCase ("\"", "No matching quote found")] // 1 double quote
[TestCase ("\\", "Incomplete escape sequence")] // 1 backslash
public void MT0026_GccFlags (string gcc_flags, string error)
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.GccFlags = gcc_flags;
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertError (26, $"Could not parse the command line argument '--gcc-flags={gcc_flags}': {error}.");
}
}
[Test]
public void MT0051 ()
{
var xcode_path = "/Applications/Xcode511.app/Contents/Developer";
if (Directory.Exists (xcode_path)) {
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.SdkRoot = xcode_path;
mtouch.AssertExecuteFailure (xcode_path);
mtouch.AssertErrorPattern (51, $"Xamarin.iOS .* requires Xcode 6.0 or later. The current Xcode version [(]found in {xcode_path}[)] is 5.1.1");
}
}
}
[Test]
public void MT0055 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.SdkRoot = "/dir/that/does/not/exist";
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertError (55, "The Xcode path '/dir/that/does/not/exist' does not exist.");
}
}
[Test]
public void MT0060 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.EnvironmentVariables = new Dictionary<string, string> { { "DEVELOPER_DIR", "/dir/that/does/not/exist" } };
mtouch.SdkRoot = MTouchTool.None;
mtouch.AssertExecuteFailure (MTouchAction.None, "build");
mtouch.AssertWarning (60, "Could not find the currently selected Xcode on the system. 'xcode-select --print-path' returned '/dir/that/does/not/exist', but that directory does not exist.");
if (!Directory.Exists ("/Applications/Xcode.app")) {
mtouch.AssertError (56, "Cannot find Xcode in the default location (/Applications/Xcode.app). Please install Xcode, or pass a custom path using --sdkroot <path>.");
} else {
mtouch.AssertWarning (62, "No Xcode.app specified (using --sdkroot or 'xcode-select --print-path'), using the default Xcode instead: /Applications/Xcode.app");
mtouch.AssertError (52, "No command specified.");
}
}
}
[Test]
public void MT0061 ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.SdkRoot = MTouchTool.None;
mtouch.AssertExecuteFailure (MTouchAction.None, "build");
mtouch.AssertWarningPattern (61, "No Xcode.app specified .using --sdkroot., using the system Xcode as reported by 'xcode-select --print-path': .*");
mtouch.AssertError (52, "No command specified.");
}
}
[Test]
public void MT0065_Custom ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.TargetVer = "7.1";
mtouch.Frameworks.Add ("/foo/bar/zap.framework");
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertError (65, "Xamarin.iOS only supports embedded frameworks when deployment target is at least 8.0 (current deployment target: '7.1'; embedded frameworks: '/foo/bar/zap.framework')");
}
}
[Test]
public void MT0065_Mono ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.CreateTemporaryApp ();
mtouch.TargetVer = "7.1";
mtouch.Mono = "framework";
mtouch.AssertExecuteFailure (MTouchAction.BuildSim, "build");
mtouch.AssertErrorPattern (65, "Xamarin.iOS only supports embedded frameworks when deployment target is at least 8.0 .current deployment target: '7.1'; embedded frameworks: '.*/Mono.framework'.");
}