[test] Fix dependency on compiler behavior for a couple of tests
authorMarek Habersack <grendel@twistedcode.net>
Wed, 23 Sep 2015 14:24:53 +0000 (16:24 +0200)
committerMarek Habersack <grendel@twistedcode.net>
Wed, 23 Sep 2015 14:24:53 +0000 (16:24 +0200)
commitced24f4004582fee376bed17a2e2bf2a41e1612d
treeb0ee2fa13364326d35c66d2a3eaf6d2fd3fd1601
parent67ca203ea1692caf70747698fe62ea7e30488e72
[test] Fix dependency on compiler behavior for a couple of tests

A couple of tests for System.Reflection.MethodBody assumed the code generated
by the compiler will be the same as the one generated by Mono's MCS. However,
when the code is built by CSC in release mode (version that comes with VS2015
was tested) the optimizations remove locals required by the old version of the
tests. Also, CSC orders the locals differently to MCS and that breaks one of
the tests which relied on the declaration order.
Another difference is that CSC and MCS type a certain local variable differently.
The variable being a byte* in source code is output in IL as such by MCS, but CSC
outputs an int8& - a by-ref type.
The tests are built by VS but they are executed by Mono on Android and so the
differences come up as errors.
This commit fixes both issues by working around the differences.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=33370 when it is included in XA
mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs