Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ test_script:
$env:CoreOutput = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -Publish))
Write-Host -Foreground Green 'Run CoreCLR tests'
$testResultsFile = "$pwd\TestsResults.xml"
& ("$env:CoreOutput\powershell.exe") -noprofile -noninteractive -c "Invoke-Pester test/powershell -Tag 'CI' -ExcludeTag 'Slow' -OutputFormat NUnitXml -OutputFile $testResultsFile"
& ("$env:CoreOutput\powershell.exe") -noprofile -noninteractive -c "Set-ExecutionPolicy -Scope Process Unrestricted; Invoke-Pester test/powershell -Tag 'CI' -ExcludeTag 'Slow' -OutputFormat NUnitXml -OutputFile $testResultsFile"

(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile))
#
# FullCLR
$env:FullOutput = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions -FullCLR))
Write-Host -Foreground Green 'Run FullCLR tests'
$testResultsFileFullCLR = "$pwd\TestsResults.FullCLR.xml"
Start-DevPowerShell -FullCLR -NoNewWindow -ArgumentList '-noprofile', '-noninteractive' -Command "Invoke-Pester test/fullCLR -ExcludeTag 'Slow' -OutputFormat NUnitXml -OutputFile $testResultsFileFullCLR"
Start-DevPowerShell -FullCLR -NoNewWindow -ArgumentList '-noprofile', '-noninteractive' -Command "Set-ExecutionPolicy -Scope Process Unrestricted; Invoke-Pester test/fullCLR -ExcludeTag 'Slow' -OutputFormat NUnitXml -OutputFile $testResultsFileFullCLR"
(New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFileFullCLR))
#
# Fail the build, if tests failed
Expand Down
6 changes: 4 additions & 2 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,12 @@ function Start-PSBuild {
Push-Location "$PSScriptRoot\src\powershell-native"

# Compile native resources
$currentLocation = Get-Location
@("nativemsh/pwrshplugin") | % {
$nativeResourcesFolder = $_
Get-ChildItem $nativeResourcesFolder -Filter "*.mc" | % {
$command = @"
cmd.exe /C cd /d "(Get-Location)" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch" "&" "$mcexe" -o -d -c -U $($_.FullName) -h "$nativeResourcesFolder" -r "$nativeResourcesFolder"
cmd.exe /C cd /d "$currentLocation" "&" "$($vcVarsPath)\vcvarsall.bat" "$NativeHostArch" "&" mc.exe -o -d -c -U $($_.FullName) -h "$nativeResourcesFolder" -r "$nativeResourcesFolder"
"@
log " Executing mc.exe Command: $command"
Start-NativeExecution { Invoke-Expression -Command:$command }
Expand Down Expand Up @@ -526,6 +527,7 @@ function Start-PSPester {
[string[]]$Tag = "CI",
[string]$Path = "$PSScriptRoot/test/powershell"
)

$tagString = "-outputFormat ${OutputFormat} -outputFile ${outputFile} "
if ( ! $DisableExit ) { $tagString += " -EnableExit" }
if ( $ExcludeTag -and ($ExcludeTag -ne "")) { $tagString += " -ExcludeTag @('" + (${ExcludeTag} -join "','") + "')" }
Expand All @@ -537,7 +539,7 @@ function Start-PSPester {

Write-Verbose "Import-Module '$moduleDir'; Invoke-Pester $tagString $Path"
$powershellexe = get-psoutput
& $powershell -noprofile -c "Import-Module '$moduleDir'; Invoke-Pester $tagString $Path"
& $powershell -noprofile -c "Set-ExecutionPolicy -Scope Process Unrestricted; Import-Module '$moduleDir'; Invoke-Pester $tagString $Path"
if ($LASTEXITCODE -ne 0) {
throw "$LASTEXITCODE Pester tests failed"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,58 +170,33 @@ private IntPtr GetMainWindowHandle()
// APIs
private bool PromptUsingConsole()
{
#if CORECLR // on Nano there is no other way to prompt except by using console
#if CORECLR
// on Nano there is no other way to prompt except by using console
return true;
#else
string PolicyKeyName = Utils.GetRegistryConfigurationPrefix();
const string PromptValueName = "ConsolePrompting";
bool promptUsingConsole = false;
RegistryKey key;

// Open the registry key that holds the configuration setting
try
{
key = Registry.LocalMachine.OpenSubKey(PolicyKeyName);
}
catch (System.Security.SecurityException)
{
s_tracer.TraceError("User doesn't have access to read CredUI registry key.");
return promptUsingConsole;
}

if (key == null)
{
return promptUsingConsole;
}

// Get the configuration setting
try
{
object consolePromptingKey = key.GetValue(PromptValueName);
if (consolePromptingKey != null) { promptUsingConsole = Convert.ToBoolean(consolePromptingKey.ToString(), CultureInfo.InvariantCulture); }
promptUsingConsole = ConfigPropertyAccessor.Instance.GetConsolePrompting();
}
catch (System.Security.SecurityException e)
{
s_tracer.TraceError("Could not read CredUI registry key: " + e.Message);
if (key != null) { key.Dispose(); } // No RegistryKey.Close() on CoreCLR
return promptUsingConsole;
}
catch (InvalidCastException e)
{
s_tracer.TraceError("Could not parse CredUI registry key: " + e.Message);
if (key != null) { key.Dispose(); } // No RegistryKey.Close() on CoreCLR
return promptUsingConsole;
}
catch (FormatException e)
{
s_tracer.TraceError("Could not parse CredUI registry key: " + e.Message);
if (key != null) { key.Dispose(); } // No RegistryKey.Close() on CoreCLR
return promptUsingConsole;
}

s_tracer.WriteLine("DetermineCredUIPolicy: policy == {0}", promptUsingConsole);

if (key != null) { key.Dispose(); } // No RegistryKey.Close() on CoreCLR
return promptUsingConsole;
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
<Compile Include="engine\pipeline.cs" />
<Compile Include="engine\PositionalCommandParameter.cs" />
<Compile Include="engine\ProgressRecord.cs" />
<Compile Include="engine\PropertyAccessor.cs" />
<Compile Include="engine\PropertyCmdletProviderInterfaces.cs" />
<Compile Include="engine\ProviderInterfaces.cs" />
<Compile Include="engine\ProviderNames.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ private static string CombineSystemModulePaths()
return null;
}

private static string GetExpandedEnvironmentVariable(string name, EnvironmentVariableTarget target)
internal static string GetExpandedEnvironmentVariable(string name, EnvironmentVariableTarget target)
{
string result = Environment.GetEnvironmentVariable(name, target);
if (!string.IsNullOrEmpty(result))
Expand Down Expand Up @@ -886,8 +886,8 @@ internal static string GetModulePath()
internal static string SetModulePath()
{
string currentModulePath = GetExpandedEnvironmentVariable("PSMODULEPATH", EnvironmentVariableTarget.Process);
string systemWideModulePath = GetExpandedEnvironmentVariable("PSMODULEPATH", EnvironmentVariableTarget.Machine);
string personalModulePath = GetExpandedEnvironmentVariable("PSMODULEPATH", EnvironmentVariableTarget.User);
string systemWideModulePath = ConfigPropertyAccessor.Instance.GetModulePath(ConfigPropertyAccessor.PropertyScope.SystemWide);
string personalModulePath = ConfigPropertyAccessor.Instance.GetModulePath(ConfigPropertyAccessor.PropertyScope.CurrentUser);

string newModulePathString = GetModulePath(currentModulePath, systemWideModulePath, personalModulePath);

Expand Down Expand Up @@ -929,7 +929,7 @@ internal static IEnumerable<string> GetModulePath(bool includeSystemModulePath,
if (processedPath != null)
yield return processedPath;
}
}
}

if (includeSystemModulePath)
{
Expand Down
Loading