You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
parent
88ff76fe28
commit
e46a49ecf1
@@ -1 +1 @@
|
||||
bef88b0c599515481b21854be4e0073c3fea3617
|
||||
a038b6c7fdad81fce73b4e0580c8b1d0159a7920
|
||||
@@ -37,6 +37,7 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
public class PartitionerTests
|
||||
{
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void PartitionerCreateIntegerWithExplicitRange ()
|
||||
{
|
||||
OrderablePartitioner<Tuple<int, int>> partitioner = Partitioner.Create (1, 20, 5);
|
||||
@@ -58,6 +59,7 @@ namespace MonoTests.System.Collections.Concurrent
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void PartitionerCreateLongWithExplicitRange ()
|
||||
{
|
||||
OrderablePartitioner<Tuple<long, long>> partitioner = Partitioner.Create ((long)1, (long)20, (long)5);
|
||||
|
||||
@@ -730,6 +730,14 @@ namespace MonoTests.System.Globalization
|
||||
string us_str = null;
|
||||
string br_str = null;
|
||||
|
||||
/* explicitly set CurrentCulture, as the documentation states:
|
||||
* > If you have not explicitly set the culture of any existing
|
||||
* > threads executing in an application domain, setting the
|
||||
* > P:System.Globalization.CultureInfo.DefaultThreadCurrentCulture
|
||||
* > property also changes the culture of these threads.
|
||||
*/
|
||||
Thread.CurrentThread.CurrentCulture = old_culture;
|
||||
|
||||
var thread = new Thread (() => {
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
|
||||
us_str = 100000.ToString ("C");
|
||||
|
||||
@@ -1748,6 +1748,47 @@ public class DirectoryTest
|
||||
}
|
||||
}
|
||||
|
||||
#if !MOBILE
|
||||
[Test]
|
||||
public void ResolvePathBeforeDirectoryExists ()
|
||||
{
|
||||
if (!RunningOnUnix)
|
||||
Assert.Ignore ("Not running on Unix.");
|
||||
|
||||
string cwd = Directory.GetCurrentDirectory ();
|
||||
|
||||
string root = Path.Combine (TempFolder, "test_ResolvePathBeforeExists");
|
||||
string testPath = Path.Combine (root, "test");
|
||||
string test2Path = Path.Combine (testPath, "test2");
|
||||
string testFile = Path.Combine (test2Path, "test_file");
|
||||
string symlinkPath = Path.Combine (root, "test3");
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory (root);
|
||||
Directory.SetCurrentDirectory (root);
|
||||
Directory.CreateDirectory (testPath);
|
||||
Directory.CreateDirectory (test2Path);
|
||||
File.WriteAllText (testFile, "hello");
|
||||
|
||||
var info = new UnixFileInfo (test2Path);
|
||||
info.CreateSymbolicLink (symlinkPath);
|
||||
|
||||
var partial_path_with_symlink = "test3/../test3"; // test3 is a symlink to test/test2
|
||||
|
||||
Assert.AreEqual (Directory.Exists (partial_path_with_symlink), true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DeleteFile (symlinkPath);
|
||||
DeleteFile (testFile);
|
||||
DeleteDirectory (test2Path);
|
||||
DeleteDirectory (testPath);
|
||||
Directory.SetCurrentDirectory (cwd);
|
||||
DeleteDirectory (root);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private void DeleteDirectory (string path)
|
||||
{
|
||||
if (Directory.Exists (path))
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace MonoTests.System.IO
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void GetDrivesValidInfo ()
|
||||
{
|
||||
var drives = DriveInfo.GetDrives ();
|
||||
|
||||
@@ -470,6 +470,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
|
||||
public delegate object RetObj();
|
||||
[Test] //#640702
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void GetCurrentMethodWorksWithDynamicMethods ()
|
||||
{
|
||||
DynamicMethod dm = new DynamicMethod("Foo", typeof(object), null);
|
||||
@@ -526,6 +527,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void ExceptionHandling ()
|
||||
{
|
||||
var method = new DynamicMethod ("", typeof(void), new[] { typeof(int) }, typeof (DynamicMethodTest));
|
||||
@@ -592,6 +594,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void ExceptionHandlingWithExceptionDispatchInfo ()
|
||||
{
|
||||
var method = new DynamicMethod ("", typeof(void), new[] { typeof(int) }, typeof (DynamicMethodTest));
|
||||
@@ -649,6 +652,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test] //see bxc #59334
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void ExceptionWrapping ()
|
||||
{
|
||||
AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (new AssemblyName ("ehatevfheiw"), AssemblyBuilderAccess.Run);
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
[TestFixture]
|
||||
public class ILGeneratorTest
|
||||
{
|
||||
ModuleBuilder modulebuilder;
|
||||
TypeBuilder tb;
|
||||
ILGenerator il_gen;
|
||||
|
||||
@@ -38,8 +39,8 @@ namespace MonoTests.System.Reflection.Emit
|
||||
AssemblyBuilder assembly = Thread.GetDomain ().DefineDynamicAssembly (
|
||||
assemblyName, AssemblyBuilderAccess.Run);
|
||||
|
||||
ModuleBuilder module = assembly.DefineDynamicModule ("module1");
|
||||
tb = module.DefineType ("T", TypeAttributes.Public);
|
||||
modulebuilder = assembly.DefineDynamicModule ("module1");
|
||||
tb = modulebuilder.DefineType ("T", TypeAttributes.Public);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -610,6 +611,5 @@ namespace MonoTests.System.Reflection.Emit
|
||||
Assert.AreEqual ("1", s);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1024,6 +1024,7 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]//bug #626441
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void CanCallVarargMethods ()
|
||||
{
|
||||
var tb = module.DefineType ("foo");
|
||||
|
||||
@@ -116,7 +116,6 @@ namespace MonoTests.System.Reflection.Emit
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotWorking")]
|
||||
public void TestGlobalMethods ()
|
||||
{
|
||||
AssemblyBuilder builder = genAssembly ();
|
||||
@@ -859,5 +858,332 @@ namespace MonoTests.System.Reflection.Emit
|
||||
Assert.AreEqual ("t1&", module.GetType ("t1&").FullName);
|
||||
Assert.AreEqual ("t1[]&", module.GetType ("t1[]&").FullName);
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.All)]
|
||||
public class MyAttribute : Attribute {
|
||||
public String Contents;
|
||||
public MyAttribute (String contents)
|
||||
{
|
||||
this.Contents = contents;
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetMethodsBeforeInstantiation ()
|
||||
{
|
||||
AssemblyBuilder assm = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName ("Name"), AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder module = assm.DefineDynamicModule ("Module");
|
||||
|
||||
// Added to make sure fields and methods not mixed up by getters
|
||||
FieldBuilder fieldBuilder = module.DefineInitializedData ("GlobalField", new byte[4], FieldAttributes.Public);
|
||||
|
||||
MethodBuilder method = module.DefinePInvokeMethod ("printf", "libc.so",
|
||||
MethodAttributes.PinvokeImpl | MethodAttributes.Static | MethodAttributes.Public,
|
||||
CallingConventions.Standard, typeof (void), new Type [] { typeof (string) }, CallingConvention.Winapi,
|
||||
CharSet.Auto);
|
||||
method.SetImplementationFlags (MethodImplAttributes.PreserveSig |
|
||||
method.GetMethodImplementationFlags ());
|
||||
|
||||
module.CreateGlobalFunctions ();
|
||||
|
||||
// Make sure method is defined, but field is not
|
||||
Assert.AreEqual (1, module.GetMethods (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance).Length);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetFieldsBeforeInstantiation ()
|
||||
{
|
||||
AssemblyBuilder assm = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName ("Name"), AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder module = assm.DefineDynamicModule ("Module");
|
||||
FieldBuilder fieldBuilder = module.DefineInitializedData ("GlobalField", new byte[4], FieldAttributes.Public);
|
||||
module.CreateGlobalFunctions ();
|
||||
|
||||
var fieldG = module.GetField (fieldBuilder.Name);
|
||||
Assert.IsNotNull (fieldG);
|
||||
Assert.AreEqual (1, module.GetFields (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance).Length);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetCustomAttributesBeforeInstantiation ()
|
||||
{
|
||||
AssemblyBuilder assm = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName ("Name"), AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder module = assm.DefineDynamicModule ("Module");
|
||||
module.CreateGlobalFunctions ();
|
||||
|
||||
ConstructorInfo ctor = typeof(MyAttribute).GetConstructor (new Type [] {typeof(String)});
|
||||
ctor.GetHashCode ();
|
||||
CustomAttributeBuilder cab = new CustomAttributeBuilder (ctor, new object [] {"hi"});
|
||||
module.SetCustomAttribute (cab);
|
||||
|
||||
Assert.AreEqual (1, module.GetCustomAttributes (false).Length);
|
||||
Assert.AreEqual (typeof (MyAttribute), ((MyAttribute) module.GetCustomAttributes (false)[0]).GetType ());
|
||||
Assert.AreEqual ("hi", ((MyAttribute) module.GetCustomAttributes (false)[0]).Contents);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetCustomAttributesIgnoresArg ()
|
||||
{
|
||||
AssemblyBuilder assm = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName ("Name"), AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder module = assm.DefineDynamicModule ("Module");
|
||||
module.CreateGlobalFunctions ();
|
||||
|
||||
ConstructorInfo ctor = typeof(MyAttribute).GetConstructor (new Type [] {typeof(String)});
|
||||
ctor.GetHashCode ();
|
||||
CustomAttributeBuilder cab = new CustomAttributeBuilder (ctor, new object [] {"hi"});
|
||||
module.SetCustomAttribute (cab);
|
||||
|
||||
var first = module.GetCustomAttributes (false);
|
||||
var second = module.GetCustomAttributes (true);
|
||||
|
||||
Assert.AreEqual (first.Length, second.Length);
|
||||
|
||||
for (int i=0; i < first.Length; i++)
|
||||
Assert.AreEqual (first [i].GetType (), second [i].GetType ());
|
||||
|
||||
Assert.AreEqual ("hi", ((MyAttribute) first [0]).Contents);
|
||||
Assert.AreEqual ("hi", ((MyAttribute) second [0]).Contents);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetCustomAttributesThrowsUnbakedAttributeType ()
|
||||
{
|
||||
AssemblyBuilder assm = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName ("Name"), AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder module = assm.DefineDynamicModule ("Module");
|
||||
TypeBuilder tb = module.DefineType ("foo");
|
||||
module.CreateGlobalFunctions ();
|
||||
|
||||
ConstructorInfo ctor = typeof(MyAttribute).GetConstructor (new Type [] {typeof(String)});
|
||||
ctor.GetHashCode ();
|
||||
CustomAttributeBuilder cab = new CustomAttributeBuilder (ctor, new object [] {"hi"});
|
||||
module.SetCustomAttribute (cab);
|
||||
|
||||
try {
|
||||
module.GetCustomAttributes (tb, false);
|
||||
}
|
||||
catch (InvalidOperationException e) {
|
||||
// Correct behavior
|
||||
return;
|
||||
}
|
||||
|
||||
Assert.Fail ("Supposed to throw");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetExternalTypeBuilderCAttr ()
|
||||
{
|
||||
AssemblyBuilder assm = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName ("Name"), AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder module = assm.DefineDynamicModule ("Module");
|
||||
|
||||
ModuleBuilder module_two = assm.DefineDynamicModule ("ModuleTwo");
|
||||
TypeBuilder tb = module_two.DefineType ("foo");
|
||||
|
||||
ConstructorInfo ctor = tb.DefineConstructor (MethodAttributes.Public, CallingConventions.Standard, Type.EmptyTypes);
|
||||
CustomAttributeBuilder cab = new CustomAttributeBuilder (ctor, Array.Empty<object> ());
|
||||
|
||||
// Set the custom attribute to have a type builder from another module
|
||||
module.SetCustomAttribute (cab);
|
||||
|
||||
module.CreateGlobalFunctions ();
|
||||
|
||||
try {
|
||||
module.GetCustomAttributes (false);
|
||||
}
|
||||
catch (NotSupportedException e) {
|
||||
// Correct behavior
|
||||
return;
|
||||
}
|
||||
Assert.Fail ("Supposed to throw");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetFieldsNoGlobalType ()
|
||||
{
|
||||
AssemblyBuilder assm = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName ("Name"), AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder module = assm.DefineDynamicModule ("Module");
|
||||
FieldBuilder fieldBuilder = module.DefineInitializedData ("GlobalField", new byte[4], FieldAttributes.Public);
|
||||
|
||||
try {
|
||||
module.GetFields (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
|
||||
}
|
||||
catch (InvalidOperationException e) {
|
||||
// Correct behavior
|
||||
return;
|
||||
}
|
||||
Assert.Fail ("Supposed to throw");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetFieldNoGlobalType ()
|
||||
{
|
||||
AssemblyBuilder assm = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName ("Name"), AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder module = assm.DefineDynamicModule ("Module");
|
||||
FieldBuilder fieldBuilder = module.DefineInitializedData ("GlobalField", new byte[4], FieldAttributes.Public);
|
||||
|
||||
try {
|
||||
module.GetField (fieldBuilder.Name);
|
||||
}
|
||||
catch (InvalidOperationException e) {
|
||||
// Correct behavior
|
||||
return;
|
||||
}
|
||||
Assert.Fail ("Supposed to throw");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetMethodsNoGlobalType ()
|
||||
{
|
||||
AssemblyBuilder assm = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName ("Name"), AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder module = assm.DefineDynamicModule ("Module");
|
||||
FieldBuilder fieldBuilder = module.DefineInitializedData ("GlobalField", new byte[4], FieldAttributes.Public);
|
||||
|
||||
MethodBuilder method = module.DefinePInvokeMethod ("printf", "libc.so",
|
||||
MethodAttributes.PinvokeImpl | MethodAttributes.Static | MethodAttributes.Public,
|
||||
CallingConventions.Standard, typeof (void), new Type [] { typeof (string) }, CallingConvention.Winapi,
|
||||
CharSet.Auto);
|
||||
method.SetImplementationFlags (MethodImplAttributes.PreserveSig |
|
||||
method.GetMethodImplementationFlags ());
|
||||
|
||||
try {
|
||||
module.GetMethods (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
|
||||
}
|
||||
catch (InvalidOperationException e) {
|
||||
// Correct behavior
|
||||
return;
|
||||
}
|
||||
Assert.Fail ("Supposed to throw");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetMetadataToken ()
|
||||
{
|
||||
AssemblyBuilder assm = AssemblyBuilder.DefineDynamicAssembly (new AssemblyName ("Name"), AssemblyBuilderAccess.Run);
|
||||
ModuleBuilder module = assm.DefineDynamicModule ("Module");
|
||||
module.CreateGlobalFunctions ();
|
||||
Assert.AreEqual (0, module.MetadataToken);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SaveMemberRefGtd () {
|
||||
// Ensure that the a memberref token is emitted for a
|
||||
// field or for a method of a gtd in the same dynamic assembly.
|
||||
// Regression test for GitHub #6192
|
||||
|
||||
// class T {
|
||||
// public string F () {
|
||||
// int i = new C<int>().Foo (42).field1;
|
||||
// return i.ToString();
|
||||
// }
|
||||
// public string F2 () {
|
||||
// int i = new C<int>().Bar (42);
|
||||
// return i.ToString ();
|
||||
// }
|
||||
// }
|
||||
// class C<X> {
|
||||
// public X field1;
|
||||
// public C<X> Foo (X x) {
|
||||
// this.field1 = x;
|
||||
// return this;
|
||||
// }
|
||||
// public X Bar (X x) {
|
||||
// return this.Foo (x).field1;
|
||||
// }
|
||||
//}
|
||||
|
||||
AssemblyName an = genAssemblyName ();
|
||||
AssemblyBuilder ab = Thread.GetDomain ().DefineDynamicAssembly (an, AssemblyBuilderAccess.RunAndSave, tempDir);
|
||||
ModuleBuilder modulebuilder = ab.DefineDynamicModule (an.Name, an.Name + ".dll");
|
||||
|
||||
var tb = modulebuilder.DefineType ("T", TypeAttributes.Public);
|
||||
var il_gen = tb.DefineMethod ("F", MethodAttributes.Public, typeof(string), null).GetILGenerator ();
|
||||
var il_gen2 = tb.DefineMethod ("F2", MethodAttributes.Public, typeof(string), null).GetILGenerator ();
|
||||
|
||||
var cbuilder = modulebuilder.DefineType ("C", TypeAttributes.Public);
|
||||
var genericParams = cbuilder.DefineGenericParameters ("X");
|
||||
|
||||
var field1builder = cbuilder.DefineField ("field1", genericParams[0], FieldAttributes.Public);
|
||||
|
||||
var cOfX = cbuilder.MakeGenericType(genericParams);
|
||||
|
||||
var fooBuilder = cbuilder.DefineMethod ("Foo",
|
||||
MethodAttributes.Public,
|
||||
cOfX,
|
||||
new Type [] { genericParams[0] });
|
||||
var cdefaultCtor = cbuilder.DefineDefaultConstructor (MethodAttributes.Public);
|
||||
|
||||
var fooIL = fooBuilder.GetILGenerator ();
|
||||
|
||||
fooIL.Emit (OpCodes.Ldarg_0);
|
||||
fooIL.Emit (OpCodes.Ldarg_1);
|
||||
// Emit (Stfld, field1builder) must generate a memberref token, not fielddef.
|
||||
fooIL.Emit (OpCodes.Stfld, field1builder);
|
||||
fooIL.Emit (OpCodes.Ldarg_0);
|
||||
fooIL.Emit (OpCodes.Ret);
|
||||
|
||||
var barBuilder = cbuilder.DefineMethod ("Bar",
|
||||
MethodAttributes.Public,
|
||||
genericParams [0],
|
||||
new Type [] { genericParams [0] });
|
||||
var barIL = barBuilder.GetILGenerator ();
|
||||
|
||||
barIL.Emit (OpCodes.Ldarg_0);
|
||||
barIL.Emit (OpCodes.Ldarg_1);
|
||||
// Emit (Call, fooBuilder) must generate a memberref token, not a methoddef.
|
||||
barIL.Emit (OpCodes.Call, fooBuilder);
|
||||
barIL.Emit (OpCodes.Ldfld, field1builder);
|
||||
barIL.Emit (OpCodes.Ret);
|
||||
|
||||
var cOfInt32 = cbuilder.MakeGenericType (new Type [] { typeof (int) });
|
||||
var fooOfInt32 = TypeBuilder.GetMethod (cOfInt32, fooBuilder);
|
||||
var cfield1OfInt32 = TypeBuilder.GetField (cOfInt32, field1builder);
|
||||
var intToString = typeof(int).GetMethod ("ToString", Type.EmptyTypes);
|
||||
|
||||
var ilocal = il_gen.DeclareLocal (typeof(int));
|
||||
il_gen.Emit (OpCodes.Newobj, TypeBuilder.GetConstructor (cOfInt32, cdefaultCtor));
|
||||
il_gen.Emit (OpCodes.Ldc_I4, 42);
|
||||
il_gen.Emit (OpCodes.Call, fooOfInt32);
|
||||
il_gen.Emit (OpCodes.Ldfld, cfield1OfInt32);
|
||||
il_gen.Emit (OpCodes.Stloc, ilocal);
|
||||
il_gen.Emit (OpCodes.Ldloca, ilocal);
|
||||
il_gen.Emit (OpCodes.Call, intToString);
|
||||
il_gen.Emit (OpCodes.Ret);
|
||||
|
||||
|
||||
var i2local = il_gen2.DeclareLocal (typeof (int));
|
||||
var barOfInt32 = TypeBuilder.GetMethod (cOfInt32, barBuilder);
|
||||
il_gen2.Emit (OpCodes.Newobj, TypeBuilder.GetConstructor (cOfInt32, cdefaultCtor));
|
||||
il_gen2.Emit (OpCodes.Ldc_I4, 17);
|
||||
il_gen2.Emit (OpCodes.Call, barOfInt32);
|
||||
il_gen2.Emit (OpCodes.Stloc, i2local);
|
||||
il_gen2.Emit (OpCodes.Ldloca, i2local);
|
||||
il_gen2.Emit (OpCodes.Call, intToString);
|
||||
il_gen2.Emit (OpCodes.Ret);
|
||||
|
||||
cbuilder.CreateType ();
|
||||
tb.CreateType ();
|
||||
|
||||
ab.Save (an.Name + ".dll");
|
||||
|
||||
/* Yes the test really needs to roundtrip through SRE.Save().
|
||||
* The regression is in the token fixup code on the saving codepath.
|
||||
*/
|
||||
|
||||
var assm = Assembly.LoadFrom (Path.Combine (tempDir, an.Name + ".dll"));
|
||||
|
||||
var baked = assm.GetType ("T");
|
||||
|
||||
var x = Activator.CreateInstance (baked);
|
||||
var m = baked.GetMethod ("F");
|
||||
|
||||
var s = m.Invoke (x, null);
|
||||
|
||||
Assert.AreEqual ("42", s);
|
||||
|
||||
var m2 = baked.GetMethod ("F2");
|
||||
|
||||
var s2 = m2.Invoke (x, null);
|
||||
|
||||
Assert.AreEqual ("17", s2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,9 +317,10 @@ public class SaveTest
|
||||
// Type attributes
|
||||
Assert.AreEqual (TypeAttributes.Public|TypeAttributes.SequentialLayout, type1.Attributes);
|
||||
// Interfaces
|
||||
Assert.AreEqual (2, type1.GetInterfaces ().Length);
|
||||
Assert.AreEqual (iface1, type1.GetInterfaces () [0]);
|
||||
Assert.AreEqual (typeof (IComparable), type1.GetInterfaces () [1]);
|
||||
var ifaces = type1.GetInterfaces ();
|
||||
Assert.AreEqual (2, ifaces.Length);
|
||||
Assert.IsTrue (iface1 == ifaces [0] || iface1 == ifaces [1]);
|
||||
Assert.IsTrue (typeof (IComparable) == ifaces [0] || typeof (IComparable) == ifaces [1]);
|
||||
CheckCattr (type1);
|
||||
// FIXME: Class size/packing size
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
e4f73aea23f15dae625b30ee994b5e3d7df58d71
|
||||
ebc7cb573f5753e3f100ca4c101dcba11135eb86
|
||||
@@ -1111,6 +1111,7 @@ public class AssemblyNameTest {
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Accessing assemblies by asm.Location is not supported
|
||||
[Category ("StaticLinkedAotNotWorking")] // Can't find .dll files when bundled in .exe
|
||||
public void GetAssemblyName_CodeBase ()
|
||||
{
|
||||
Assembly execAssembly = Assembly.GetExecutingAssembly ();
|
||||
|
||||
@@ -264,14 +264,9 @@ namespace MonoTests.System.Reflection
|
||||
public void Corlib_test ()
|
||||
{
|
||||
Assembly corlib_test = Assembly.GetExecutingAssembly ();
|
||||
#if MONODROID || FULL_AOT_DESKTOP || __WATCHOS__
|
||||
Assert.IsNull (corlib_test.EntryPoint, "EntryPoint");
|
||||
Assert.IsNull (corlib_test.Evidence, "Evidence");
|
||||
#elif MOBILE
|
||||
Assert.IsNotNull (corlib_test.EntryPoint, "EntryPoint");
|
||||
#if MOBILE
|
||||
Assert.IsNull (corlib_test.Evidence, "Evidence");
|
||||
#else
|
||||
Assert.IsNull (corlib_test.EntryPoint, "EntryPoint");
|
||||
Assert.IsNotNull (corlib_test.Evidence, "Evidence");
|
||||
#endif
|
||||
Assert.IsFalse (corlib_test.GlobalAssemblyCache, "GlobalAssemblyCache");
|
||||
@@ -322,6 +317,7 @@ namespace MonoTests.System.Reflection
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Assemblies in Xamarin.Android cannot be accessed as FileStream
|
||||
[Category ("StaticLinkedAotNotWorking")] // Can't find .dll files when bundled in .exe
|
||||
public void GetFiles_False ()
|
||||
{
|
||||
Assembly corlib = typeof (int).Assembly;
|
||||
@@ -335,6 +331,7 @@ namespace MonoTests.System.Reflection
|
||||
|
||||
[Test]
|
||||
[Category ("AndroidNotWorking")] // Assemblies in Xamarin.Android cannot be accessed as FileStream
|
||||
[Category ("StaticLinkedAotNotWorking")] // Can't find .dll files when bundled in .exe
|
||||
public void GetFiles_True ()
|
||||
{
|
||||
Assembly corlib = typeof (int).Assembly;
|
||||
|
||||
@@ -431,8 +431,10 @@ namespace MonoTests.System.Reflection
|
||||
Assert.IsFalse (lvi.IsPinned, "#3-1");
|
||||
|
||||
if (/* mcs */ lvi.LocalType == typeof (byte*) || /* csc */ lvi.LocalType == typeof (byte).MakeByRefType ()) {
|
||||
foundPinnedBytePointer = true;
|
||||
Assert.IsTrue (lvi.IsPinned, "#3-2");
|
||||
// We have three locals. There's b the byte[], there's a byte* and there's a byte&.
|
||||
// mcs emits a byte* for the latter type.
|
||||
// We need to find one such pinned byte pointer. Therefore we're folding with logical or
|
||||
foundPinnedBytePointer = foundPinnedBytePointer || lvi.IsPinned;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// RuntimeFeatureTest.cs
|
||||
//
|
||||
// Authors:
|
||||
// Katelyn Gadd <kg@luminance.org>
|
||||
//
|
||||
// Copyright (c) 2017 Microsoft Corporation.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Linq;
|
||||
|
||||
namespace MonoTests.System.Runtime.CompilerServices
|
||||
{
|
||||
[TestFixture]
|
||||
public class RuntimeFeatureTest
|
||||
{
|
||||
readonly (string, bool)[] ExpectedFeatures = new [] {
|
||||
("PortablePdb", true)
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void NoNewFeaturesAdded ()
|
||||
{
|
||||
var t = typeof (RuntimeFeature);
|
||||
var features = from field in t.GetFields()
|
||||
where field.FieldType == typeof (string)
|
||||
let value = field.GetValue (null)
|
||||
select (
|
||||
field.Name,
|
||||
RuntimeFeature.IsSupported ((string)value)
|
||||
);
|
||||
Assert.AreEqual (ExpectedFeatures, features.ToArray ());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,7 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void Throw ()
|
||||
{
|
||||
Exception orig = null;
|
||||
@@ -92,6 +93,7 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void ThrowWithEmptyFrames ()
|
||||
{
|
||||
var edi = ExceptionDispatchInfo.Capture (new OperationCanceledException ());
|
||||
@@ -106,6 +108,7 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void LastThrowWins ()
|
||||
{
|
||||
Exception e;
|
||||
@@ -137,6 +140,7 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void ThrowMultipleCaptures ()
|
||||
{
|
||||
Exception e;
|
||||
@@ -165,6 +169,7 @@ namespace MonoTests.System.Runtime.ExceptionServices
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void StackTraceUserCopy ()
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -963,6 +963,7 @@ namespace MonoTests.System.Runtime.InteropServices
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void CheckPtrToStructureWithFixedArrayAndBaseClassFields()
|
||||
{
|
||||
const int arraySize = 6;
|
||||
|
||||
@@ -28,6 +28,7 @@ namespace MonoTests.System.Runtime.Remoting.Proxies {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void InterfaceProxyGetTypeOkay ()
|
||||
{
|
||||
// Regression test for #17325
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
LocalDataStoreSlot slot;
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestDoCallback ()
|
||||
{
|
||||
otherCtx = cbo.GetContext ();
|
||||
@@ -54,6 +55,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestDatastore ()
|
||||
{
|
||||
otherCtx = cbo.GetContext ();
|
||||
|
||||
@@ -146,6 +146,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
bool otResult;
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestSynchronization ()
|
||||
{
|
||||
Thread tr = new Thread (new ThreadStart (FirstSyncThread));
|
||||
@@ -169,6 +170,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestSupported ()
|
||||
{
|
||||
SincroRequiresNew ob = new SincroRequiresNew ();
|
||||
@@ -181,6 +183,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestRequired ()
|
||||
{
|
||||
SincroRequiresNew ob = new SincroRequiresNew ();
|
||||
@@ -193,6 +196,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestRequiresNew ()
|
||||
{
|
||||
SincroRequiresNew ob = new SincroRequiresNew ();
|
||||
@@ -205,6 +209,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestNotSupported ()
|
||||
{
|
||||
SincroRequiresNew ob = new SincroRequiresNew ();
|
||||
@@ -217,6 +222,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestLocked1 ()
|
||||
{
|
||||
sincob.Lock (false);
|
||||
@@ -231,6 +237,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestLocked2 ()
|
||||
{
|
||||
Thread tr = new Thread (new ThreadStart (FirstNotSyncThread));
|
||||
@@ -254,6 +261,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestLocked3 ()
|
||||
{
|
||||
Thread tr = new Thread (new ThreadStart (Lock1Thread));
|
||||
@@ -273,6 +281,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestReentry ()
|
||||
{
|
||||
Thread tr = new Thread (new ThreadStart (FirstReentryThread));
|
||||
@@ -296,6 +305,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestNoReentry ()
|
||||
{
|
||||
Thread tr = new Thread (new ThreadStart (FirstNoReentryThread));
|
||||
@@ -319,6 +329,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestCallback ()
|
||||
{
|
||||
Thread tr = new Thread (new ThreadStart (CallbackThread));
|
||||
@@ -333,6 +344,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestSynchronizationReleasedOnMultipleAcquire ()
|
||||
{
|
||||
|
||||
@@ -355,6 +367,7 @@ namespace MonoTests.System.Runtime.Remoting
|
||||
[Test]
|
||||
[Category("NotDotNet")]
|
||||
[Category ("MobileNotWorking")]
|
||||
[Category ("InterpreterNotWorking")]
|
||||
public void TestMonitorWait ()
|
||||
{
|
||||
Thread tr = new Thread (new ThreadStart (DoMonitorPulse));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user