[Mono-list] RFC: Corlib Unit Test on Linux How-To

Linus Upson linus@linus.com
Sun, 28 Apr 2002 18:53:41 -0700


Hi,

I tried testing corlib on Windows (using mono, not .net, very similar to
the setup you describe in the HOWTO) and am running in to a problem. It
appears that the Windows implementation of MethodInfo.Invoke() exits the
runtime when the invoked method throws an exception. The
NUnit.Framework.TestCase.RunTest() method, which calls
MethodInfo.Invoke(), never gets an opportunity to deal with the
exception.

I'm new to mono so I'm not set up to debug the runtime yet. Is it
possible to build/debug the mono runtime with the MSFT tools or should I
install gdb to track this down?

In case anyone is interested, here is a very small test case which
provokes the problem.

// TrivialTest.cs
using System;
using NUnit.Framework;

namespace MonoTests {
	public class TrivialTest : TestCase {
		public TrivialTest() : base("MonoTests.TrivialTest
testsuite") {
		}
		public TrivialTest(string name) : base(name) {
		}
		public static ITest Suite {
			get { 
				return new
TestSuite(typeof(TrivialTest)); 
			}
		}
		public void TestAssert() {
			Assert("This is true", false);
		}
	}
}

Assuming you have all of the dlls in the same dir, you can compile this
test with:

csc /nostdlib /noconfig /t:library /r:corlib.dll /r:System.dll
    /r:NUnitCore_mono.dll /out:TrivialTest.dll TrivialTest.cs

Then execute the test with mono:

$ mono NUnitConsole_mono.exe MonoTests.TrivialTest,TrivialTest.dll
.
(process:2972): ** WARNING **: unhandled exception
NUnit.Framework.AssertionFailedError: "This is false!"
in NUnit.Framework.Assertion:Fail ()
in NUnit.Framework.Assertion:Assert ()
in MonoTests.System.Collections.ArrayListTest:TestAdapter ()
in (unmanaged) System.Reflection.MonoMethod:InternalInvoke ()

Thanks,
Linus


-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com] On
Behalf Of Nick Drochak
Sent: Sunday, April 28, 2002 6:27 PM
To: mono-list@ximian.com
Subject: [Mono-list] RFC: Corlib Unit Test on Linux How-To


How-To Run corlib Unit Tests on linux (1st draft)

These instructions are how I run the corlib unit tests on linux.  It's
not necessarily clean, nice, or pretty, but it works for me.  Comments
on this are welcome.  After a few iterations and edits, we'll add it to
the web site somewhere.

1) Get and build mono. See the www.go-mono.com site if you don't know
how to do this. I recommend the mono-build.sh build script available on
the download page.

2) Copy the class library dll's to the proper place.  "Proper place"
will depend on how you built mono, but it will need to be somewhere that
mono can find them. I put mine in the install/lib directory that the
script displays at the end. You'll need to build these on windows, or
get them from a pre-built package (see the web site for pointers). Here
is what you need to copy:
	mcs/class/lib/*.dll
	mcs/nunit/*.dll
	mcs/class/corlib/Test/corlib_res.dll

3) Copy mcs/nunit/NUnitConsole_mono.exe and
mcs/class/corlib/Test/corlib_linux_test.dll to the jit sub directory.
These are also built on Windows or from a pre-built package. Copy them
to mono/mono/jit/

4) Run Nunit in mono:
	cd mono/mono/jit
	./mono NUnitConsole_mono.exe
MonoTests.AllTests,corlib_linux_test.dll

If it's working you'll see some output like:

....E....F..F..E.EE..E.....E..F...F
.E.E...E..E.E..F...F..E...E.E.EE
(etc., etc)

Then most likely you'll get a stream of error and failure reports. The
difference is errors are unexpected problems with the tests and/or class
lib. Failures are tests that have failed, i.e. and Assert statement that
was not true. Both need to be fixed, but failures are easier to track
down.

Hopefully we can get more people trying these tests on linux, filing
bugzilla reports, or even better, posting patches to the list.

Comments, suggestions, and pizza are all welcome.

HTH,
Nick D.



_______________________________________________
Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list