Esempio n. 1
0
        public LibcProtectedMemoryAllocatorTest()
        {
            Trace.Listeners.Clear();
            var consoleListener = new ConsoleTraceListener();

            Trace.Listeners.Add(consoleListener);

            Debug.WriteLine("LibcProtectedMemoryAllocatorTest ctor");
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                libc = new LinuxLibcLP64();
                libcProtectedMemoryAllocator      = new LinuxProtectedMemoryAllocatorLP64((LinuxLibcLP64)libc);
                linuxProtectedMemoryAllocatorMock = new Mock <LinuxProtectedMemoryAllocatorLP64>()
                {
                    CallBase = true
                };
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                libc = new MacOSLibcLP64();
                libcProtectedMemoryAllocator      = new MacOSProtectedMemoryAllocatorLP64((MacOSLibcLP64)libc);
                macOsProtectedMemoryAllocatorMock = new Mock <MacOSProtectedMemoryAllocatorLP64>()
                {
                    CallBase = true
                };
            }
            else
            {
                libc = null;
                libcProtectedMemoryAllocator      = null;
                macOsProtectedMemoryAllocatorMock = null;
            }
        }
Esempio n. 2
0
 public LibcProtectedMemoryAllocatorTest()
 {
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
     {
         libc = new LinuxLibcLP64();
         libcProtectedMemoryAllocator      = new LinuxProtectedMemoryAllocatorLP64();
         linuxProtectedMemoryAllocatorMock = new Mock <LinuxProtectedMemoryAllocatorLP64>()
         {
             CallBase = true
         };
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
     {
         libc = new MacOSLibcLP64();
         libcProtectedMemoryAllocator      = new MacOSProtectedMemoryAllocatorLP64();
         macOsProtectedMemoryAllocatorMock = new Mock <MacOSProtectedMemoryAllocatorLP64>()
         {
             CallBase = true
         };
     }
     else
     {
         libc = null;
         libcProtectedMemoryAllocator      = null;
         macOsProtectedMemoryAllocatorMock = null;
     }
 }