updating branch

Merge branch 'develop' of mshttps://msostc.visualstudio.com/DefaultCollection/PS/_git/monad-linux into dev/171-environmental-variable-test-bug
This commit is contained in:
Zachary Folwick 2015-08-24 13:05:16 -07:00
commit 1d447bd470
12 changed files with 20 additions and 86 deletions

View file

@ -183,14 +183,14 @@ run-file: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-release-clr
pester-tests: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-release-clr
# execute the pester tests, pester needs a TEMP environment variable to be set
exec_env/app_base/runps-simple.sh 'cd ../src/pester-tests; $$env:TEMP="/tmp"; invoke-pester'
exec_env/app_base/runps-simple.sh 'cd ../../../src/pester-tests; $$env:TEMP="/tmp"; invoke-pester'
test: $(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) pester-tests dotnetlibs/monad_native
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
# run the c++ tests
cd dotnetlibs && ./monad_native
# test the 3rdparty/hashbang sample
PATH=$(PATH):$(shell pwd)/exec_env/app_base 3rdparty/hashbang/script.ps1
PATH=$(PATH):$(shell pwd)/exec_env/app_base $(shell pwd)/3rdparty/hashbang/script.ps1
run-debugclr: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-debug-clr
PAL_DBG_CHANNELS="+LOADER.TRACE" exec_env/app_base/runps-simple.sh get-location

View file

@ -19,5 +19,3 @@ dotnetlibs/powershell-run.exe: $(POWERSHELL_RUN_SRCS) $(POWERSHELL_RUN_DEPS)
dotnetlibs/powershell-simple.exe: $(POWERSHELL_SIMPLE_SRCS) $(POWERSHELL_RUN_DEPS)
$(CSC) -out:$@ -noconfig -nostdlib -target:exe $(POWERSHELL_RUN_REFS) $(COREREF) $(POWERSHELL_SIMPLE_SRCS)

View file

@ -3,4 +3,3 @@
SCRIPTDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
"$SCRIPTDIR/runps.sh" --file "$@"

View file

@ -5,5 +5,4 @@ SCRIPTDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
cd "$SCRIPTDIR"
echo "launching PS debug now"
PSMODULEPATH="$SCRIPTDIR/Modules" LD_LIBRARY_PATH="$SCRIPTDIR:/usr/lib/llvm-3.6/lib" lldb-3.6 ./host_cmdline -- -c ../coreclr -alc Microsoft.PowerShell.CoreCLR.AssemblyLoadContext.dll -tpa powershell-simple.exe "powershell-simple, version=1.0.0.0, culture=neutral, PublicKeyToken=null" "ps_hello_world.Program" "UnmanagedMain" --working-dir "$CWD" "$@"
PSMODULEPATH="$SCRIPTDIR/Modules" LD_LIBRARY_PATH="$SCRIPTDIR:/usr/lib/llvm-3.6/lib" lldb-3.6 ./host_cmdline -- -c ../coreclr -alc Microsoft.PowerShell.CoreCLR.AssemblyLoadContext.dll -tpa powershell-simple.exe powershell-simple.exe "$@"

View file

@ -5,5 +5,4 @@ SCRIPTDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
cd "$SCRIPTDIR"
echo "launching PS trace now"
PSMODULEPATH="$SCRIPTDIR/Modules" LD_LIBRARY_PATH="$SCRIPTDIR" strace -e trace=file ./host_cmdline -c ../coreclr -alc Microsoft.PowerShell.CoreCLR.AssemblyLoadContext.dll -tpa powershell-simple.exe "powershell-simple, version=1.0.0.0, culture=neutral, PublicKeyToken=null" "ps_hello_world.Program" "UnmanagedMain" --working-dir "$CWD" "$@"
PSMODULEPATH="$SCRIPTDIR/Modules" LD_LIBRARY_PATH="$SCRIPTDIR" strace -e trace=file ./host_cmdline -c ../coreclr -alc Microsoft.PowerShell.CoreCLR.AssemblyLoadContext.dll -tpa powershell-simple.exe powershell-simple.exe "$@"

View file

@ -4,5 +4,4 @@ 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 powershell-simple.exe "powershell-simple, version=1.0.0.0, culture=neutral, PublicKeyToken=null" "ps_hello_world.Program" "UnmanagedMain" --working-dir "$CWD" "$@"
PSMODULEPATH="$SCRIPTDIR/Modules" LD_LIBRARY_PATH="$SCRIPTDIR" ./host_cmdline -c ../coreclr -alc Microsoft.PowerShell.CoreCLR.AssemblyLoadContext.dll -tpa powershell-simple.exe powershell-simple.exe "$@"

View file

@ -4,5 +4,4 @@ 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 powershell-run.exe "powershell-run, version=1.0.0.0, culture=neutral, PublicKeyToken=null" "Microsoft.Samples.PowerShell.Host.PSListenerConsoleSample" "UnmanagedMain" --working-dir "$CWD" "$@"
PSMODULEPATH="$SCRIPTDIR/Modules" LD_LIBRARY_PATH="$SCRIPTDIR" ./host_cmdline -c ../coreclr -alc Microsoft.PowerShell.CoreCLR.AssemblyLoadContext.dll -tpa powershell-run.exe powershell-run.exe "$@"

@ -1 +1 @@
Subproject commit df562ce7ecd60fb42e30702116123c8a58bf04d4
Subproject commit 2793b76e2d48f012a82b8e9106b9e9f496d3b785

@ -1 +1 @@
Subproject commit 20468e65dac6fa5a1b4cf6971ff490e548531822
Subproject commit ea31eca6223992fa9729af67518930b6b45829d3

@ -1 +1 @@
Subproject commit a99c56eea3264b8c492bc0edf5e3a65102397af9
Subproject commit 440cf6a236067eba2d5dcfd5e3707a36295cee97

View file

@ -456,25 +456,6 @@ namespace ps_hello_world
}
}
public static void init()
{
//string psBasePath = System.IO.Directory.GetCurrentDirectory();
//PowerShellAssemblyLoadContextInitializer.SetPowerShellAssemblyLoadContext(psBasePath);
//Assembly a = Assembly.Load(new AssemblyName("System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"));
//Console.WriteLine("##########################\nloaded assembly a=" + a + " during init\n#########################");
// PH: this debugging requires a change in the core PS stuff that was stashed away
// during source cleanup
/*
PowerShellAssemblyLoadContext asmLoadContext = PowerShellAssemblyLoadContextInitializer.AsmLoadContext;
IEnumerable<Assembly> assemblies = asmLoadContext.GetAssemblies("System.Management.Automation");
foreach (Assembly a in assemblies)
{
Console.WriteLine("a: " + a);
}*/
}
static void test1(string[] args)
{
InitialSessionState iss = InitialSessionState.CreateDefault2();
@ -525,50 +506,8 @@ namespace ps_hello_world
}
}
public static int UnmanagedMain(int argc, [MarshalAs(UnmanagedType.LPArray,ArraySubType=UnmanagedType.LPStr,SizeParamIndex=0)] String[] argv)
{
init();
List<String> allArgs = new List<String>();
for (int i = 0; i < argc; ++i)
{
allArgs.Add(argv[i]);
}
List<string> filteredArgs = new List<string>();
if (allArgs.Count > 0)
{
for (int i = 0; i < allArgs.Count; ++i)
{
string arg = allArgs[i];
bool hasNext = (i+1)<allArgs.Count;
string nextArg = hasNext ? allArgs[i+1] : "";
if (hasNext && arg == "--working-dir")
{
Console.WriteLine("working dir set to: " + nextArg);
Directory.SetCurrentDirectory(nextArg);
++i;
}
else
filteredArgs.Add(arg);
}
}
test2(filteredArgs.ToArray());
return 0;
}
static void Main(string[] args)
{
// important:
// - this function must be called for the current version of PowerShell for Linux
// in order to load the assembly load context before anything else is loaded
// - this requirement will be removed through future updates to the native
// CLR hosting code (currently corerun)
init();
//test1(args);
test2(args);
}

View file

@ -53,15 +53,17 @@ namespace PSTests
RedirectStandardOutput = true,
UseShellExecute = false
};
Process process = Process.Start(startInfo);
// The process should always exit, but wait a set time just in case
process.WaitForExit(1000);
// The process should return an exit code of 0 on success
Assert.Equal(0, process.ExitCode);
// Get output of call to whoami without trailing newline
string username = process.StandardOutput.ReadToEnd().Trim();
// It should be the same as what our platform code returns
Assert.Equal(username, Platform.NonWindowsGetUserName());
using (Process process = Process.Start(startInfo))
{
// Get output of call to whoami without trailing newline
string username = process.StandardOutput.ReadToEnd().Trim();
process.WaitForExit();
// The process should return an exit code of 0 on success
Assert.Equal(0, process.ExitCode);
// It should be the same as what our platform code returns
Assert.Equal(username, Platform.NonWindowsGetUserName());
}
}
}
}