protected override bool Check(TestCase test)
{
string filename = test.FileName;
try {
if (!base.Check (test)) {
HandleFailure (filename, TestResult.CompileError, tester.Output);
return false;
}
}
catch (Exception e) {
if (e.InnerException != null)
e = e.InnerException;
HandleFailure (filename, TestResult.CompileError, e.ToString ());
return false;
}
// Test setup
if (filename.EndsWith ("-lib.cs") || filename.EndsWith ("-mod.cs")) {
if (verbose)
LogFileLine (filename, "OK");
--total;
return true;
}
string file = Path.Combine (files_folder, Path.GetFileNameWithoutExtension (filename) + ".exe");
// Enable .dll only tests (no execution required)
if (!File.Exists(file)) {
HandleFailure (filename, TestResult.Success, null);
return true;
}
AppDomain domain = null;
#if !NET_2_1
if (safe_execution) {
// Create a new AppDomain, with the current directory as the base.
AppDomainSetup setupInfo = new AppDomainSetup ();
setupInfo.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
setupInfo.LoaderOptimization = LoaderOptimization.SingleDomain;
domain = AppDomain.CreateDomain (Path.GetFileNameWithoutExtension (file), null, setupInfo);
}
#endif
try {
DomainTester tester;
try {
#if !NET_2_1
if (domain != null)
tester = (DomainTester) domain.CreateInstanceAndUnwrap (typeof (PositiveChecker).Assembly.FullName, typeof (DomainTester).FullName);
else
#endif
tester = new DomainTester ();
if (!tester.Test (file))
return false;
} catch (ApplicationException e) {
HandleFailure (filename, TestResult.ExecError, e.Message);
return false;
} catch (Exception e) {
HandleFailure (filename, TestResult.LoadError, e.ToString ());
return false;
}
if (doc_output != null) {
string ref_file = filename.Replace (".cs", "-ref.xml");
try {
#if !NET_2_1
XmlComparer.Compare (ref_file, doc_output);
#endif
} catch (Exception e) {
HandleFailure (filename, TestResult.XmlError, e.Message);
return false;
}
} else {
if (verif_file != null) {
PositiveTestCase pt = (PositiveTestCase) test;
pt.VerificationProvider = (PositiveTestCase.VerificationData) verif_data[filename];
if (!tester.CheckILSize (pt, this, file))
return false;
}
}
} finally {
if (domain != null)
AppDomain.Unload (domain);
}
HandleFailure (filename, TestResult.Success, null);
return true;
}