diff --git a/src/ResGen/project.json b/src/ResGen/project.json
index 0dea62d8e4..40cd1ab2e3 100644
--- a/src/ResGen/project.json
+++ b/src/ResGen/project.json
@@ -17,6 +17,7 @@
},
"runtimes": {
+ "ubuntu.16.04-x64": { },
"ubuntu.14.04-x64": { },
"debian.8-x64": { },
"centos.7-x64": { },
diff --git a/src/System.Management.Automation/help/MUIFileSearcher.cs b/src/System.Management.Automation/help/MUIFileSearcher.cs
index 80fc85461f..263581df80 100644
--- a/src/System.Management.Automation/help/MUIFileSearcher.cs
+++ b/src/System.Management.Automation/help/MUIFileSearcher.cs
@@ -113,11 +113,31 @@ namespace System.Management.Automation
}
}
+ private string[] GetFiles(string path, string pattern)
+ {
+#if UNIX
+ // On Linux, file names are case sensitive, so we need to add
+ // extra logic to select the files that match the given pattern.
+ ArrayList result = new ArrayList();
+ string[] files = Directory.GetFiles(path);
+ foreach (string filePath in files)
+ {
+ if (filePath.IndexOf(pattern, StringComparison.OrdinalIgnoreCase) >= 0)
+ {
+ result.Add(filePath);
+ }
+ }
+ return (String[])result.ToArray(typeof(string));
+#else
+ return Directory.GetFiles(path, pattern);
+#endif
+ }
+
private void AddFiles(string muiDirectory, string directory, string pattern)
{
if (Directory.Exists(muiDirectory))
{
- string[] files = Directory.GetFiles(muiDirectory, pattern);
+ string[] files = GetFiles(muiDirectory, pattern);
if (files == null)
return;
diff --git a/src/System.Management.Automation/help/UpdatableHelpSystem.cs b/src/System.Management.Automation/help/UpdatableHelpSystem.cs
index ad7d4c8661..d557ec6ef6 100644
--- a/src/System.Management.Automation/help/UpdatableHelpSystem.cs
+++ b/src/System.Management.Automation/help/UpdatableHelpSystem.cs
@@ -1489,7 +1489,7 @@ namespace System.Management.Automation.Help
fileStream.Read(firstTwoBytes, 0, 2);
- // Check for Mark Zbikowski’s magic initials
+ // Check for Mark Zbikowski's magic initials
if (firstTwoBytes[0] == 'M' && firstTwoBytes[1] == 'Z')
{
throw new UpdatableHelpSystemException("HelpContentContainsInvalidFiles",
@@ -1628,6 +1628,11 @@ namespace System.Management.Automation.Help
///
internal static bool ShouldPromptToUpdateHelp()
{
+#if UNIX
+ // TODO: This workaround needs to be removed once updatable help
+ // works on Linux.
+ return false;
+#else
try
{
if (!Utils.IsAdministrator())
@@ -1641,6 +1646,7 @@ namespace System.Management.Automation.Help
{
return false;
}
+#endif
}
#endregion
diff --git a/src/powershell-unix/project.json b/src/powershell-unix/project.json
index 55511c10e1..ad4b11370a 100644
--- a/src/powershell-unix/project.json
+++ b/src/powershell-unix/project.json
@@ -55,7 +55,8 @@
"Microsoft.PowerShell.PSReadLine": "1.0.0-*",
"libmi": "1.0.0-alpha01",
"PSDesiredStateConfiguration": "1.0.0-alpha01",
- "Microsoft.PowerShell.PackageManagement": "1.0.0-*"
+ "Microsoft.PowerShell.PackageManagement": "1.0.0-*",
+ "PowerShellHelpFiles": "1.0.0-alpha01"
},
"frameworks": {
diff --git a/test/powershell/engine/HelpContent/Microsoft.PowerShell.Core_00000000-0000-0000-0000-000000000000_HelpInfo.xml b/test/powershell/engine/HelpContent/Microsoft.PowerShell.Core_00000000-0000-0000-0000-000000000000_HelpInfo.xml
new file mode 100644
index 0000000000..1b94d3e8a6
--- /dev/null
+++ b/test/powershell/engine/HelpContent/Microsoft.PowerShell.Core_00000000-0000-0000-0000-000000000000_HelpInfo.xml
@@ -0,0 +1,10 @@
+
+
+ http://go.microsoft.com/fwlink/?linkid=390782
+
+
+ en-US
+ 5.0.7.0
+
+
+
\ No newline at end of file
diff --git a/test/powershell/engine/HelpContent/Microsoft.PowerShell.Core_00000000-0000-0000-0000-000000000000_en-US_HelpContent.cab b/test/powershell/engine/HelpContent/Microsoft.PowerShell.Core_00000000-0000-0000-0000-000000000000_en-US_HelpContent.cab
new file mode 100644
index 0000000000..2509a6b4a3
Binary files /dev/null and b/test/powershell/engine/HelpContent/Microsoft.PowerShell.Core_00000000-0000-0000-0000-000000000000_en-US_HelpContent.cab differ
diff --git a/test/powershell/engine/HelpSystem.Tests.ps1 b/test/powershell/engine/HelpSystem.Tests.ps1
new file mode 100644
index 0000000000..e72782485f
--- /dev/null
+++ b/test/powershell/engine/HelpSystem.Tests.ps1
@@ -0,0 +1,67 @@
+#
+# Validates Get-Help for cmdlets in Microsoft.PowerShell.Core.
+
+function RunTestCase
+{
+ param ([string]$tag = "CI")
+
+ $moduleName = "Microsoft.PowerShell.Core"
+
+ if ($IsWindows)
+ {
+ if ($tag -eq "CI")
+ {
+ $helpContentPath = join-path $PSScriptRoot "HelpContent"
+ $helpFiles = @(Get-ChildItem "$helpContentPath\*" -ea SilentlyContinue)
+
+ if ($helpFiles.Count -eq 0)
+ {
+ throw "unable to find help content at '$helpContentPath'"
+ }
+ Update-Help -Module $moduleName -SourcePath $helpContentPath -Force -ErrorAction Stop -Verbose
+ }
+
+ else
+ {
+ Update-Help -Module $moduleName -Force -Verbose -ErrorAction Stop
+ }
+ }
+
+ $cmdlets = get-command -module $moduleName
+
+ $cmdletsToSkip = @(
+ "Get-PSHostProcessInfo",
+ "Out-Default",
+ "Register-ArgumentCompleter"
+ )
+
+ foreach ($cmdletName in $cmdlets)
+ {
+ if ($cmdletsToSkip -notcontains $cmdletName)
+ {
+ It "Validate -Description and -Examples sections in help content. Run 'Get-help -name $cmdletName'" {
+
+ $help = get-help -name $cmdletName
+ $help.Description | Out-String | Should Match $cmdletName
+ $help.Examples | Out-String | Should Match $cmdletName
+ }
+
+ if ($tag -eq "CI")
+ {
+ # For a CI test run, we are only interested in validating one cmdlet to ensure that
+ # get-help works.
+ break
+ }
+ }
+ }
+}
+
+Describe "Validate that get-help works" -Tags "CI" {
+
+ RunTestCase -tag "CI"
+}
+
+Describe "Validate Get-Help for all cmdlets in 'Microsoft.PowerShell.Core'" -Tags "Feature" {
+
+ RunTestCase -tag "Feature"
+}