[Mono-devel-list] Detecting Mono
jaak at zd.com.pl
Mon Feb 16 12:08:42 EST 2004
> It'd be great if we had some attributes like "IgnoreDotNet" and
> with which we could decorate a test to avoid running tests on specific
> CLR's. My quick hack to the code would be to change
> TestCaseBuilder.HasIgnoreAttribute() check for the full Ignore, or see
> runtime we are on and check for the specific attributes accordingly.
How about using a textual name of the plaftorm for this purpose? The naming
schema could be adopted from NAnt, e.g:
This way we could even employ some wildcards. Like "mono-1.*" to represent
any mono v1.x.
Same thing should apply to OSes ("platforms" in NAnt terminology). One
should be able to run the test on a particular OS or platform. For example
if your test uses filesystemwatcher it shouldn't be ran on Win95.
Some ideas below:
[IgnoreOnFramework("net-1.1")] // this would not run on .NET 1.1
[IgnoreOnFramework("net-1.*")] // this would not run on ALL .NET
[IgnoreOnPlatform(Platform.Win32)] // this would not run on Win32
[IgnoreOnPlatform(Platform.Unix)] // this would not run on Unix platforms
[RunOnPlatform(Platform.Win32)] // this would run only on Win32 platforms
[RunOnFramework("mono-1.*")] // this would run only on Mono
There are more (open source) tools that target multiple platforms/oses. I
think it would be great to have some agreement on this attribute usage. For
example in NAnt we're discussing the possibility of implementing os-specific
or platform-specific tasks,types or functions in a single codebase. We've
tentatively decided that using such attributes is a way to go.
BTW. I think that the "excluded because of the framework/os" status
shouldn't be the same thing as "ignored" in NUnit. Tests are "ignored"
because they are known to temporarily fail, while RunOn... and IgnoreOn...
means something different here.
More information about the Mono-devel-list