xamarin-macios/tests/mmp-regression/link-posix-1/LinkPosix1.cs

47 строки
1.2 KiB
C#
Исходник Обычный вид История

2016-05-26 16:06:52 +03:00
// Copyright 2012 Xamarin Inc. All rights reserved.
using System;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using Foundation;
using AppKit;
using ObjCRuntime;
2016-05-26 16:06:52 +03:00
// Test
// * application does not reference assembly Mono.Posix.dll
// * application call method which pinvoke into libMonoPosixHelper.dylib
// * linker includes libMonoPosixHelper.dylib in the application bundle
//
// Requirement
// * Link SDK or Link All must be enabled
namespace Xamarin.Mac.Linker.Test {
2016-05-26 16:06:52 +03:00
class Posix1 {
static void Main (string [] args)
2016-05-26 16:06:52 +03:00
{
NSApplication.Init ();
2016-05-26 16:06:52 +03:00
Test.EnsureLinker (true);
2016-05-26 16:06:52 +03:00
bool gzip = false;
try {
GZipStream gz = new GZipStream (Stream.Null, CompressionMode.Compress);
gz.WriteByte (0);
gz.Close ();
gzip = true;
} catch {
2016-05-26 16:06:52 +03:00
}
Test.Log.WriteLine ("{0}\t{1}", gzip ? "[PASS]" : "[FAIL]", "GZipStream support");
string path = Path.GetDirectoryName (Assembly.GetExecutingAssembly ().Location);
bool bundled = File.Exists (Path.Combine (path, "libMonoPosixHelper.dylib"));
Test.Log.WriteLine ("{0}\t{1}", bundled ? "[PASS]" : "[FAIL]", "MonoPosixHelper present in bundle");
Test.Terminate ();
}
}
}