diff --git a/scripts/Makefile b/scripts/Makefile index ec910298ea..6caf208b71 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -113,7 +113,7 @@ dotnetlibs/xunit.console.exe: $(MONAD_EXT)/xunit/xunit.console.netcore.exe cp -f $^ $@ TEST_FOLDER=../src/ps_test -TEST_SRCS=$(addprefix $(TEST_FOLDER)/, test_CorePsPlatform.cs test_ExtensionMethods.cs) +TEST_SRCS=$(addprefix $(TEST_FOLDER)/, test_CorePsPlatform.cs test_ExtensionMethods.cs test_SecuritySupport.cs) dotnetlibs/ps_test.dll: $(TEST_SRCS) dotnetlibs/xunit.core.dll dotnetlibs/xunit.assert.dll dotnetlibs/System.Management.Automation.dll dotnetlibs/Microsoft.PowerShell.Commands.Management.dll dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) $(CSC) -out:$@ -noconfig -nostdlib -target:library -r:dotnetlibs/System.Management.Automation.dll -r:dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) -r:dotnetlibs/xunit.core.dll -r:dotnetlibs/xunit.assert.dll ${COREREF} $(TEST_SRCS) diff --git a/src/monad b/src/monad index f8a9615707..fbfb5a555a 160000 --- a/src/monad +++ b/src/monad @@ -1 +1 @@ -Subproject commit f8a9615707051ba572b0cb7705054f9ae15d6b66 +Subproject commit fbfb5a555ae4fa6d465eba59fff6edc281cdd536 diff --git a/src/ps_test/ps_test.cs b/src/ps_test/ps_test.cs index 3a7f011f07..3ae9a1b25d 100644 --- a/src/ps_test/ps_test.cs +++ b/src/ps_test/ps_test.cs @@ -11,9 +11,15 @@ namespace PSTests { PlatformTests.TestIsLinux(); PlatformTests.TestHasCom(); + PlatformTests.TestHasAmsi(); PSTypeExtensionsTests.TestIsComObject(); + SecuritySupportTests.TestScanContent(); + SecuritySupportTests.TestCurrentDomain_ProcessExit(); + SecuritySupportTests.TestCloseSession(); + SecuritySupportTests.TestUninitialize(); + Console.WriteLine("Finished running tests"); } } diff --git a/src/ps_test/test_CorePsPlatform.cs b/src/ps_test/test_CorePsPlatform.cs index fb3f5a093f..ff18ff6cf2 100644 --- a/src/ps_test/test_CorePsPlatform.cs +++ b/src/ps_test/test_CorePsPlatform.cs @@ -15,5 +15,10 @@ namespace PSTests { Assert.False(Platform.HasCom()); } + + public static void TestHasAmsi() + { + Assert.False(Platform.HasAmsi()); + } } } diff --git a/src/ps_test/test_SecuritySupport.cs b/src/ps_test/test_SecuritySupport.cs new file mode 100644 index 0000000000..88f9606a45 --- /dev/null +++ b/src/ps_test/test_SecuritySupport.cs @@ -0,0 +1,29 @@ +using Xunit; +using System; +using System.Management.Automation; + +namespace PSTests +{ + public static class SecuritySupportTests + { + public static void TestScanContent() + { + Assert.Equal(AmsiUtils.ScanContent("", ""), AmsiUtils.AmsiNativeMethods.AMSI_RESULT.AMSI_RESULT_NOT_DETECTED); + } + + public static void TestCurrentDomain_ProcessExit() + { + AmsiUtils.CurrentDomain_ProcessExit(null, EventArgs.Empty); + } + + public static void TestCloseSession() + { + AmsiUtils.CloseSession(); + } + + public static void TestUninitialize() + { + AmsiUtils.Uninitialize(); + } + } +}