diff --git a/scripts/Makefile b/scripts/Makefile index 174a68bd0..00d0874c3 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -41,16 +41,16 @@ MI_REF_ASSEMBLY=-r:$(MONAD_EXT)/PS/PS_refs_modil/microsoft.management.infrastruc MI_ASSEMBLY=dotnetlibs/Microsoft.Management.Infrastructure.dll MI_REF=-r:$(MI_ASSEMBLY) -PRODUCT_BASE_REFS=${COREREF} -PRODUCT_MI_REFS=${COREREF} ${MI_NATIVE_REF} -PRODUCT_PS_REFS=${COREREF} ${MI_REF} -r:dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) -PRODUCT_COMMANDS_REFS=${COREREF} -r:dotnetlibs/System.Management.Automation.dll +PRODUCT_BASE_REFS=$(COREREF) +PRODUCT_MI_REFS=$(COREREF) $(MI_NATIVE_REF) +PRODUCT_PS_REFS=$(COREREF) $(MI_REF) -r:dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) +PRODUCT_COMMANDS_REFS=$(COREREF) -r:dotnetlibs/System.Management.Automation.dll MCSOPTS_BASE=-unsafe -nostdlib -noconfig -define:CORECLR -define:_CORECLR -MCSOPTS_MI=${MCSOPTS_BASE} -target:library -MCSOPTS_LIB=${MCSOPTS_BASE} -target:library -MCSOPTS_PS=${STRING_RESOURCES_ORIG} ${MCSOPTS_BASE} -target:library -SRCS_ALL=${STRING_RESOURCES} ${SRCS} +MCSOPTS_MI=$(MCSOPTS_BASE) -target:library +MCSOPTS_LIB=$(MCSOPTS_BASE) -target:library +MCSOPTS_PS=$(STRING_RESOURCES_ORIG) $(MCSOPTS_BASE) -target:library +SRCS_ALL=$(STRING_RESOURCES) $(SRCS) # compilers # - Roslyn's csc is used for all the PS code @@ -63,28 +63,28 @@ RUN_TARGETS=$(POWERSHELL_RUN_TARGETS) dotnetlibs/Microsoft.PowerShell.Commands.M all: dotnetlibs/System.Management.Automation.dll $(RUN_TARGETS) dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) # this is the build rule for SMA.dll -dotnetlibs/System.Management.Automation.dll: ${SYS_AUTO_SRCS} dotnetlibs/Microsoft.Management.Infrastructure.dll ../src/assembly-info/System.Management.Automation.assembly-info.cs dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) $(PLATFORM_SRCS) ${SYS_AUTO_RES_SRCS} ${SYS_AUTO_RES_CS_SRCS} - $(CSC) -out:$@ ${MCSOPTS_LIB} ${PRODUCT_PS_REFS} ${SYS_AUTO_SRCS} ${SYS_AUTO_RES_REF} ${SYS_AUTO_RES_CS_SRCS} $(PLATFORM_SRCS) ../src/assembly-info/System.Management.Automation.assembly-info.cs +dotnetlibs/System.Management.Automation.dll: $(SYS_AUTO_SRCS) dotnetlibs/Microsoft.Management.Infrastructure.dll ../src/assembly-info/System.Management.Automation.assembly-info.cs dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET) $(PLATFORM_SRCS) $(SYS_AUTO_RES_SRCS) $(SYS_AUTO_RES_CS_SRCS) + $(CSC) -out:$@ $(MCSOPTS_LIB) $(PRODUCT_PS_REFS) $(SYS_AUTO_SRCS) $(SYS_AUTO_RES_REF) $(SYS_AUTO_RES_CS_SRCS) $(PLATFORM_SRCS) ../src/assembly-info/System.Management.Automation.assembly-info.cs # this is the build rule for MMI.dll -dotnetlibs/Microsoft.Management.Infrastructure.dll: ${MAN_INFRA_SRCS} dotnetlibs/Microsoft.Management.Infrastructure.Native.dll ../src/assembly-info/Microsoft.Management.Infrastructure.assembly-info.cs $(MAN_INFRA_RES_SRCS) $(MAN_INFRA_RES_CS_SRCS) +dotnetlibs/Microsoft.Management.Infrastructure.dll: $(MAN_INFRA_SRCS) dotnetlibs/Microsoft.Management.Infrastructure.Native.dll ../src/assembly-info/Microsoft.Management.Infrastructure.assembly-info.cs $(MAN_INFRA_RES_SRCS) $(MAN_INFRA_RES_CS_SRCS) $(CSC) -out:$@ $(MCSOPTS_MI) $(PRODUCT_MI_REFS) $(MAN_INFRA_SRCS) $(MAN_INFRA_RES_REF) $(MAN_INFRA_RES_CS_SRCS) ../src/assembly-info/Microsoft.Management.Infrastructure.assembly-info.cs # Commands -dotnetlibs/Microsoft.PowerShell.Commands.Management.dll: ${COMMANDS_MANAGEMENT_SRCS} dotnetlibs/System.Management.Automation.dll ${COMMANDS_MANAGEMENT_RES_SRCS} ${COMMANDS_MANAGEMENT_RES_CS_SRCS} $(MI_ASSEMBLY) - $(CSC) -out:$@ ${MCSOPTS_LIB} ${PRODUCT_COMMANDS_REFS} ${COMMANDS_MANAGEMENT_SRCS} ${COMMANDS_MANAGEMENT_RES_CS_SRCS} $(COMMANDS_MANAGEMENT_RES_REF) $(MI_REF) +dotnetlibs/Microsoft.PowerShell.Commands.Management.dll: $(COMMANDS_MANAGEMENT_SRCS) dotnetlibs/System.Management.Automation.dll dotnetlibs/Microsoft.PowerShell.Security.dll $(COMMANDS_MANAGEMENT_RES_SRCS) $(COMMANDS_MANAGEMENT_RES_CS_SRCS) $(MI_ASSEMBLY) + $(CSC) -out:$@ $(MCSOPTS_LIB) $(PRODUCT_COMMANDS_REFS) $(COMMANDS_MANAGEMENT_SRCS) $(COMMANDS_MANAGEMENT_RES_CS_SRCS) $(COMMANDS_MANAGEMENT_RES_REF) $(MI_REF) -r:dotnetlibs/Microsoft.PowerShell.Security.dll -dotnetlibs/Microsoft.PowerShell.Commands.Utility.dll: ${COMMANDS_UTILITY_SRCS} dotnetlibs/System.Management.Automation.dll ${COMMANDS_UTILITY_RES_SRCS} ${COMMANDS_UTILITY_RES_CS_SRCS} - $(CSC) -out:$@ ${MCSOPTS_LIB} ${PRODUCT_COMMANDS_REFS} ${COMMANDS_UTILITY_SRCS} ${COMMANDS_UTILITY_RES_CS_SRCS} $(COMMANDS_UTILITY_RES_REF) +dotnetlibs/Microsoft.PowerShell.Commands.Utility.dll: $(COMMANDS_UTILITY_SRCS) dotnetlibs/System.Management.Automation.dll $(COMMANDS_UTILITY_RES_SRCS) $(COMMANDS_UTILITY_RES_CS_SRCS) + $(CSC) -out:$@ $(MCSOPTS_LIB) $(PRODUCT_COMMANDS_REFS) $(COMMANDS_UTILITY_SRCS) $(COMMANDS_UTILITY_RES_CS_SRCS) $(COMMANDS_UTILITY_RES_REF) -dotnetlibs/Microsoft.PowerShell.Security.dll: ${SECURITY_SRCS} dotnetlibs/System.Management.Automation.dll ${SECURITY_RES_SRCS} ${SECURITY_RES_CS_SRCS} - $(CSC) -out:$@ ${MCSOPTS_LIB} ${PRODUCT_COMMANDS_REFS} ${SECURITY_SRCS} ${SECURITY_RES_CS_SRCS} $(SECURITY_RES_REF) +dotnetlibs/Microsoft.PowerShell.Security.dll: $(SECURITY_SRCS) $(SECURITY_RES_SRCS) $(SECURITY_RES_CS_SRCS) + $(CSC) -out:$@ $(MCSOPTS_LIB) $(PRODUCT_COMMANDS_REFS) $(SECURITY_SRCS) $(SECURITY_RES_CS_SRCS) $(SECURITY_RES_REF) # assembly load context dotnetlibs/$(ASSEMBLY_LOAD_CONTEXT_TARGET): $(ASSEMBLY_LOAD_CONTEXT_SRCS) - $(CSC) -out:$@ ${MCSOPTS_LIB} ${PRODUCT_BASE_REFS} $(ASSEMBLY_LOAD_CONTEXT_SRCS) + $(CSC) -out:$@ $(MCSOPTS_LIB) $(PRODUCT_BASE_REFS) $(ASSEMBLY_LOAD_CONTEXT_SRCS) # this will copy whatever the first version of the dll in the globber is buildtemp/System.Reflection.Metadata.dll: buildtemp/System.Reflection.Metadata.*/lib/portable-net45+win8/System.Reflection.Metadata.dll @@ -101,7 +101,7 @@ dotnetlibs/Microsoft.Management.Infrastructure.Native.dll: ../src/stubs/Microsof MPATH=/usr/lib/mono/4.5/Facades buildtemp/TypeCatalogGen.exe: ../src/monad/monad/nttargets/assemblies/core/PSAssemblyLoadContext/TypeCatalogGen/TypeCatalogGen.cs buildtemp/System.Reflection.Metadata.dll buildtemp/System.Collections.Immutable.dll - $(MCS) -out:$@ -target:exe ${NUGETREF} -pkg:dotnet -r:${MPATH}/System.Runtime.dll -r:${MPATH}/System.Reflection.Primitives.dll -r:${MPATH}/System.IO.dll $< + $(MCS) -out:$@ -target:exe $(NUGETREF) -pkg:dotnet -r:$(MPATH)/System.Runtime.dll -r:$(MPATH)/System.Reflection.Primitives.dll -r:$(MPATH)/System.IO.dll $< # generate the Core PS type catalog # this comes from: ../src/monad/monad/nttargets/assemblies/core/PSAssemblyLoadContext/makefile.inc @@ -194,7 +194,7 @@ native-tests: dotnetlibs/monad_native xunit-tests: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-release-clr $(addprefix $(TESTRUN_FOLDER)/, ps_test.dll xunit.console.netcore.exe xunit.runner.utility.dll xunit.abstractions.dll xunit.execution.dll) # execute the xUnit runner, with XML output - cd exec_env/app_base && PSMODULEPATH=$(shell pwd)/exec_env/app_base/Modules LD_LIBRARY_PATH=../coreclr:. ../coreclr/corerun xunit.console.netcore.exe ps_test.dll -xml ../../xunittests.xml + exec_env/app_base/runps-test.sh ps_test.dll -xml ../../xunittests.xml pester-tests: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-release-clr # execute the Pester tests, which needs a TEMP environment variable to be set diff --git a/scripts/coreref.mk b/scripts/coreref.mk index 042499f06..775b92822 100644 --- a/scripts/coreref.mk +++ b/scripts/coreref.mk @@ -2,9 +2,9 @@ # this depends on the MONAD_EXT variable to be correctly set TARGETING_PACK=$(MONAD_EXT)/coreclr/TargetingPack -COREREF=-r:$(TARGETING_PACK)/Microsoft.CSharp.dll -r:$(TARGETING_PACK)/Microsoft.VisualBasic.dll -r:$(TARGETING_PACK)/Microsoft.Win32.Primitives.dll -r:$(TARGETING_PACK)/Microsoft.Win32.Registry.AccessControl.dll -r:$(TARGETING_PACK)/Microsoft.Win32.Registry.dll -r:$(TARGETING_PACK)/System.AppContext.dll -r:$(TARGETING_PACK)/System.Collections.Concurrent.dll -r:$(TARGETING_PACK)/System.Collections.dll -r:$(TARGETING_PACK)/System.Collections.NonGeneric.dll -r:$(TARGETING_PACK)/System.Collections.Specialized.dll -r:$(TARGETING_PACK)/System.ComponentModel.Annotations.dll -r:$(TARGETING_PACK)/System.ComponentModel.dll -r:$(TARGETING_PACK)/System.ComponentModel.EventBasedAsync.dll -r:$(TARGETING_PACK)/System.ComponentModel.Primitives.dll -r:$(TARGETING_PACK)/System.ComponentModel.TypeConverter.dll -r:$(TARGETING_PACK)/System.Console.dll -r:$(TARGETING_PACK)/System.Data.Common.dll -r:$(TARGETING_PACK)/System.Data.SqlClient.dll -r:$(TARGETING_PACK)/System.Diagnostics.Contracts.dll -r:$(TARGETING_PACK)/System.Diagnostics.Debug.dll -r:$(TARGETING_PACK)/System.Diagnostics.FileVersionInfo.dll -r:$(TARGETING_PACK)/System.Diagnostics.Process.dll -r:$(TARGETING_PACK)/System.Diagnostics.TextWriterTraceListener.dll -r:$(TARGETING_PACK)/System.Diagnostics.Tools.dll -r:$(TARGETING_PACK)/System.Diagnostics.TraceSource.dll -r:$(TARGETING_PACK)/System.Diagnostics.Tracing.dll -r:$(TARGETING_PACK)/System.Dynamic.Runtime.dll -r:$(TARGETING_PACK)/System.Globalization.Calendars.dll -r:$(TARGETING_PACK)/System.Globalization.dll -r:$(TARGETING_PACK)/System.Globalization.Extensions.dll -r:$(TARGETING_PACK)/System.IO.Compression.dll -r:$(TARGETING_PACK)/System.IO.Compression.ZipFile.dll -r:$(TARGETING_PACK)/System.IO.dll -r:$(TARGETING_PACK)/System.IO.FileSystem.AccessControl.dll -r:$(TARGETING_PACK)/System.IO.FileSystem.dll -r:$(TARGETING_PACK)/System.IO.FileSystem.DriveInfo.dll -r:$(TARGETING_PACK)/System.IO.FileSystem.Primitives.dll -r:$(TARGETING_PACK)/System.IO.FileSystem.Watcher.dll -r:$(TARGETING_PACK)/System.IO.MemoryMappedFiles.dll -r:$(TARGETING_PACK)/System.IO.Pipes.dll -r:$(TARGETING_PACK)/System.IO.UnmanagedMemoryStream.dll -r:$(TARGETING_PACK)/System.Linq.dll -r:$(TARGETING_PACK)/System.Linq.Expressions.dll -r:$(TARGETING_PACK)/System.Linq.Parallel.dll -r:$(TARGETING_PACK)/System.Linq.Queryable.dll -r:$(TARGETING_PACK)/System.Net.Http.dll -r:$(TARGETING_PACK)/System.Net.Http.WinHttpHandler.dll -r:$(TARGETING_PACK)/System.Net.NameResolution.dll -r:$(TARGETING_PACK)/System.Net.NetworkInformation.dll -r:$(TARGETING_PACK)/System.Net.Primitives.dll -r:$(TARGETING_PACK)/System.Net.Security.dll -r:$(TARGETING_PACK)/System.Net.Sockets.dll -r:$(TARGETING_PACK)/System.Net.Utilities.dll -r:$(TARGETING_PACK)/System.Net.WebHeaderCollection.dll -r:$(TARGETING_PACK)/System.Net.WebSockets.Client.dll -r:$(TARGETING_PACK)/System.Net.WebSockets.dll -r:$(TARGETING_PACK)/System.ObjectModel.dll -r:$(TARGETING_PACK)/System.Reflection.DispatchProxy.dll -r:$(TARGETING_PACK)/System.Reflection.dll -r:$(TARGETING_PACK)/System.Reflection.Emit.dll -r:$(TARGETING_PACK)/System.Reflection.Emit.ILGeneration.dll -r:$(TARGETING_PACK)/System.Reflection.Emit.Lightweight.dll -r:$(TARGETING_PACK)/System.Reflection.Extensions.dll -r:$(TARGETING_PACK)/System.Reflection.Primitives.dll -r:$(TARGETING_PACK)/System.Reflection.TypeExtensions.dll -r:$(TARGETING_PACK)/System.Resources.ReaderWriter.dll -r:$(TARGETING_PACK)/System.Resources.ResourceManager.dll -r:$(TARGETING_PACK)/System.Runtime.CompilerServices.VisualC.dll -r:$(TARGETING_PACK)/System.Runtime.dll -r:$(TARGETING_PACK)/System.Runtime.Extensions.dll -r:$(TARGETING_PACK)/System.Runtime.Handles.dll -r:$(TARGETING_PACK)/System.Runtime.InteropServices.dll -r:$(TARGETING_PACK)/System.Runtime.InteropServices.WindowsRuntime.dll -r:$(TARGETING_PACK)/System.Runtime.Loader.dll -r:$(TARGETING_PACK)/System.Runtime.Numerics.dll -r:$(TARGETING_PACK)/System.Runtime.Serialization.Json.dll -r:$(TARGETING_PACK)/System.Runtime.Serialization.Primitives.dll -r:$(TARGETING_PACK)/System.Runtime.Serialization.Xml.dll -r:$(TARGETING_PACK)/System.Security.AccessControl.dll -r:$(TARGETING_PACK)/System.Security.Claims.dll -r:$(TARGETING_PACK)/System.Security.Cryptography.DeriveBytes.dll -r:$(TARGETING_PACK)/System.Security.Cryptography.Encoding.dll -r:$(TARGETING_PACK)/System.Security.Cryptography.Encryption.Aes.dll -r:$(TARGETING_PACK)/System.Security.Cryptography.Encryption.dll -r:$(TARGETING_PACK)/System.Security.Cryptography.Hashing.Algorithms.dll -r:$(TARGETING_PACK)/System.Security.Cryptography.Hashing.dll -r:$(TARGETING_PACK)/System.Security.Cryptography.RandomNumberGenerator.dll -r:$(TARGETING_PACK)/System.Security.Cryptography.RSA.dll -r:$(TARGETING_PACK)/System.Security.Cryptography.X509Certificates.dll -r:$(TARGETING_PACK)/System.Security.Principal.dll -r:$(TARGETING_PACK)/System.Security.Principal.Windows.dll -r:$(TARGETING_PACK)/System.Security.SecureString.dll -r:$(TARGETING_PACK)/System.ServiceModel.Duplex.dll -r:$(TARGETING_PACK)/System.ServiceModel.Http.dll -r:$(TARGETING_PACK)/System.ServiceModel.NetTcp.dll -r:$(TARGETING_PACK)/System.ServiceModel.Primitives.dll -r:$(TARGETING_PACK)/System.ServiceModel.Security.dll -r:$(TARGETING_PACK)/System.ServiceProcess.ServiceController.dll -r:$(TARGETING_PACK)/System.Text.Encoding.CodePages.dll -r:$(TARGETING_PACK)/System.Text.Encoding.dll -r:$(TARGETING_PACK)/System.Text.Encoding.Extensions.dll -r:$(TARGETING_PACK)/System.Text.RegularExpressions.dll -r:$(TARGETING_PACK)/System.Threading.AccessControl.dll -r:$(TARGETING_PACK)/System.Threading.dll -r:$(TARGETING_PACK)/System.Threading.Overlapped.dll -r:$(TARGETING_PACK)/System.Threading.Tasks.dll -r:$(TARGETING_PACK)/System.Threading.Tasks.Parallel.dll -r:$(TARGETING_PACK)/System.Threading.Thread.dll -r:$(TARGETING_PACK)/System.Threading.ThreadPool.dll -r:$(TARGETING_PACK)/System.Threading.Timer.dll -r:$(TARGETING_PACK)/System.Xml.ReaderWriter.dll -r:$(TARGETING_PACK)/System.Xml.XDocument.dll -r:$(TARGETING_PACK)/System.Xml.XmlDocument.dll -r:$(TARGETING_PACK)/System.Xml.XmlSerializer.dll -r:$(TARGETING_PACK)/System.Xml.XPath.dll -r:$(TARGETING_PACK)/System.Xml.XPath.XDocument.dll -r:$(TARGETING_PACK)/System.Xml.XPath.XmlDocument.dll +COREREF=$(addprefix -r:, $(shell ls $(TARGETING_PACK)/*.dll)) # COREREF_2 is here for dev/testing purposes, it should not be used anywhere (instead use the reference assemblies stored in COREREF) CORECLR_ASSEMBLY_BASE=$(MONAD_EXT)/coreclr/Release -COREREF_2= -r:$(CORECLR_ASSEMBLY_BASE)/Microsoft.CSharp.dll -r:$(CORECLR_ASSEMBLY_BASE)/Microsoft.VisualBasic.dll -r:$(CORECLR_ASSEMBLY_BASE)/Microsoft.Win32.Primitives.dll -r:$(CORECLR_ASSEMBLY_BASE)/Microsoft.Win32.Registry.AccessControl.dll -r:$(CORECLR_ASSEMBLY_BASE)/Microsoft.Win32.Registry.dll -r:$(CORECLR_ASSEMBLY_BASE)/mscorlib.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.AppContext.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Collections.Concurrent.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Collections.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Collections.NonGeneric.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Collections.Specialized.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ComponentModel.Annotations.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ComponentModel.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ComponentModel.EventBasedAsync.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ComponentModel.Primitives.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ComponentModel.TypeConverter.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Console.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Core.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Data.Common.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Data.SqlClient.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Diagnostics.Contracts.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Diagnostics.Debug.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Diagnostics.FileVersionInfo.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Diagnostics.Process.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Diagnostics.StackTrace.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Diagnostics.TextWriterTraceListener.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Diagnostics.Tools.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Diagnostics.TraceSource.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Diagnostics.Tracing.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Dynamic.Runtime.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Globalization.Calendars.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Globalization.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Globalization.Extensions.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.Compression.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.Compression.ZipFile.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.FileSystem.AccessControl.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.FileSystem.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.FileSystem.DriveInfo.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.FileSystem.Primitives.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.FileSystem.Watcher.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.MemoryMappedFiles.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.Pipes.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.IO.UnmanagedMemoryStream.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Linq.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Linq.Expressions.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Linq.Parallel.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Linq.Queryable.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.Http.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.Http.WinHttpHandler.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.NameResolution.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.NetworkInformation.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.Primitives.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.Requests.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.Security.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.Sockets.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.Utilities.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.WebHeaderCollection.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.WebSockets.Client.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Net.WebSockets.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ObjectModel.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Private.CompilerServices.ICastable.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Private.CoreLib.InteropServices.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Private.DataContractSerialization.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Private.Interop.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Private.Networking.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Private.ServiceModel.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Private.Uri.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Reflection.DispatchProxy.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Reflection.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Reflection.Emit.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Reflection.Emit.ILGeneration.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Reflection.Emit.Lightweight.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Reflection.Extensions.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Reflection.Primitives.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Reflection.TypeExtensions.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Resources.ReaderWriter.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Resources.ResourceManager.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.CompilerServices.VisualC.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.Extensions.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.Handles.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.InteropServices.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.InteropServices.WindowsRuntime.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.Loader.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.Numerics.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.Serialization.Json.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.Serialization.Primitives.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Runtime.Serialization.Xml.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.AccessControl.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Claims.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Cryptography.DeriveBytes.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Cryptography.Encoding.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Cryptography.Encryption.Aes.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Cryptography.Encryption.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Cryptography.Hashing.Algorithms.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Cryptography.Hashing.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Cryptography.RandomNumberGenerator.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Cryptography.RSA.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Cryptography.X509Certificates.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Principal.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.Principal.Windows.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Security.SecureString.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ServiceModel.Duplex.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ServiceModel.Http.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ServiceModel.NetTcp.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ServiceModel.Primitives.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ServiceModel.Security.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.ServiceProcess.ServiceController.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Text.Encoding.CodePages.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Text.Encoding.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Text.Encoding.Extensions.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Text.RegularExpressions.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Threading.AccessControl.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Threading.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Threading.Overlapped.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Threading.Tasks.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Threading.Tasks.Parallel.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Threading.Thread.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Threading.ThreadPool.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Threading.Timer.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Xml.ReaderWriter.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Xml.XDocument.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Xml.XmlDocument.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Xml.XmlSerializer.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Xml.XPath.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Xml.XPath.XDocument.dll -r:$(CORECLR_ASSEMBLY_BASE)/System.Xml.XPath.XmlDocument.dll +COREREF_2=$(addprefix -r:, $(shell ls $(CORECLR_ASSEMBLY_BASE)/*.dll)) diff --git a/scripts/runps-test.sh b/scripts/runps-test.sh new file mode 100755 index 000000000..5196f708b --- /dev/null +++ b/scripts/runps-test.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +CWD=$(pwd) +SCRIPTDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) + +cd "$SCRIPTDIR" +PSMODULEPATH="$SCRIPTDIR/Modules" LD_LIBRARY_PATH="$SCRIPTDIR" ./host_cmdline -c ../coreclr -alc Microsoft.PowerShell.CoreCLR.AssemblyLoadContext.dll -tpa xunit.console.netcore.exe xunit.console.netcore.exe "$@" diff --git a/scripts/tests.mk b/scripts/tests.mk index 8a7c312a2..4f9963828 100644 --- a/scripts/tests.mk +++ b/scripts/tests.mk @@ -6,4 +6,4 @@ $(TESTRUN_FOLDER)/xunit%: $(MONAD_EXT)/xunit/xunit% cp -f $^ $@ $(TESTRUN_FOLDER)/ps_test.dll: $(TEST_SRCS) $(addprefix $(TESTRUN_FOLDER)/, xunit.core.dll xunit.assert.dll) $(addprefix dotnetlibs/, System.Management.Automation.dll Microsoft.PowerShell.Commands.Management.dll $(ASSEMBLY_LOAD_CONTEXT_TARGET)) - $(CSC) -out:$@ -noconfig -nostdlib -target:library $(addprefix -r:$(TESTRUN_FOLDER)/, xunit.core.dll xunit.assert.dll) $(addprefix -r:dotnetlibs/, System.Management.Automation.dll $(ASSEMBLY_LOAD_CONTEXT_TARGET)) ${COREREF} $(TEST_SRCS) + $(CSC) -out:$@ -noconfig -nostdlib -target:library $(addprefix -r:$(TESTRUN_FOLDER)/, xunit.core.dll xunit.assert.dll) $(addprefix -r:dotnetlibs/, System.Management.Automation.dll $(ASSEMBLY_LOAD_CONTEXT_TARGET)) $(COREREF) $(TEST_SRCS) diff --git a/src/ps_test/test_Runspace.cs b/src/ps_test/test_Runspace.cs new file mode 100644 index 000000000..f9b4745eb --- /dev/null +++ b/src/ps_test/test_Runspace.cs @@ -0,0 +1,48 @@ +using Xunit; +using System; +using System.Management.Automation; +using System.Management.Automation.Runspaces; + +namespace PSTests +{ + public static class RunspaceTests + { + [Fact] + public static void TestMethod() + { + InitialSessionState iss = InitialSessionState.CreateDefault2(); + + // NOTE: instantiate custom host myHost for the next line to capture stdout and stderr output + // in addition to just the PSObjects + using (Runspace rs = RunspaceFactory.CreateRunspace(/*myHost,*/iss)) + { + rs.Open(); + using (PowerShell ps = PowerShell.Create()) + { + ps.Runspace = rs; + + string script = "get-process | select-object -first 3"; + ps.AddScript(script); + + // IMPORTANT NOTE: do not call AddCommand("out-host") here or + // MergeMyResults, otherwise Invoke will not return any objects + + var results = ps.Invoke(); + + // check that there are 3 captured objects + int objCount = 0; + foreach (var result in results) + { + // this is how an object would be captured here and looked at, + // each result is a PSObject with the data from the pipeline + ++objCount; + Assert.NotNull(result); + } + Assert.Equal(3,objCount); + ps.Dispose(); + } + } + } + } +} +