diff --git a/src/CLU/CLUCoreCLR.sln b/src/CLU/CLUCoreCLR.sln index 9d3937fc16f3..e8614dbf7ec3 100644 --- a/src/CLU/CLUCoreCLR.sln +++ b/src/CLU/CLUCoreCLR.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 +VisualStudioVersion = 14.0.24720.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.Common", "Commands.Common\Commands.Common.xproj", "{5F567ACA-595E-436D-83DB-A21E08F82DF6}" EndProject @@ -37,7 +37,13 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.CLU.Run", "Micros EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.CLU", "Microsoft.CLU\Microsoft.CLU.xproj", "{D0A59671-088D-463B-B060-2ADAFFB9C3F6}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.CLU.Test", "Microsoft.CLU.Test\Microsoft.CLU.Test.xproj", "{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Compute", "Microsoft.Azure.Commands.Compute\Microsoft.Azure.Commands.Compute.xproj", "{04F9968A-5662-4508-BEE2-31F56848FCBA}" + ProjectSection(ProjectDependencies) = postProject + {99B1290D-A073-4907-8018-51C714431778} = {99B1290D-A073-4907-8018-51C714431778} + {3910613E-4ED2-49E2-8CCF-966D586665AC} = {3910613E-4ED2-49E2-8CCF-966D586665AC} + {81A48E48-89A7-4B93-8207-4F8FA6DC251B} = {81A48E48-89A7-4B93-8207-4F8FA6DC251B} + {45B05B68-516F-4D74-897F-56D12894946C} = {45B05B68-516F-4D74-897F-56D12894946C} + EndProjectSection EndProject Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Commands.Common.ScenarioTest", "Commands.Common.ScenarioTest\Commands.Common.ScenarioTest.xproj", "{B1D3CB1F-C0CA-401F-8146-B2E9C1EF460F}" EndProject @@ -49,7 +55,7 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Co {04F9968A-5662-4508-BEE2-31F56848FCBA} = {04F9968A-5662-4508-BEE2-31F56848FCBA} EndProjectSection EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Azure.Commands.Compute", "Microsoft.Azure.Commands.Compute\Microsoft.Azure.Commands.Compute.xproj", "{04F9968A-5662-4508-BEE2-31F56848FCBA}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.ScenarioTest.CLU", "Microsoft.ScenarioTests.CLU\Microsoft.ScenarioTest.CLU.xproj", "{91422B55-28A5-48DE-BCA0-30C3E30FFB1C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -125,10 +131,10 @@ Global {D0A59671-088D-463B-B060-2ADAFFB9C3F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {D0A59671-088D-463B-B060-2ADAFFB9C3F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0A59671-088D-463B-B060-2ADAFFB9C3F6}.Release|Any CPU.Build.0 = Release|Any CPU - {91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Release|Any CPU.Build.0 = Release|Any CPU + {04F9968A-5662-4508-BEE2-31F56848FCBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04F9968A-5662-4508-BEE2-31F56848FCBA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04F9968A-5662-4508-BEE2-31F56848FCBA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04F9968A-5662-4508-BEE2-31F56848FCBA}.Release|Any CPU.Build.0 = Release|Any CPU {B1D3CB1F-C0CA-401F-8146-B2E9C1EF460F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B1D3CB1F-C0CA-401F-8146-B2E9C1EF460F}.Debug|Any CPU.Build.0 = Debug|Any CPU {B1D3CB1F-C0CA-401F-8146-B2E9C1EF460F}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -137,10 +143,10 @@ Global {13C34370-51A4-4726-81B8-BE0996FC9CFF}.Debug|Any CPU.Build.0 = Debug|Any CPU {13C34370-51A4-4726-81B8-BE0996FC9CFF}.Release|Any CPU.ActiveCfg = Release|Any CPU {13C34370-51A4-4726-81B8-BE0996FC9CFF}.Release|Any CPU.Build.0 = Release|Any CPU - {04F9968A-5662-4508-BEE2-31F56848FCBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {04F9968A-5662-4508-BEE2-31F56848FCBA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {04F9968A-5662-4508-BEE2-31F56848FCBA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {04F9968A-5662-4508-BEE2-31F56848FCBA}.Release|Any CPU.Build.0 = Release|Any CPU + {91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91422B55-28A5-48DE-BCA0-30C3E30FFB1C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/CLU/Microsoft.CLU.Run/PackageManagementMode.cs b/src/CLU/Microsoft.CLU.Run/PackageManagementMode.cs index 47b83712a389..7b28eae50f0e 100644 --- a/src/CLU/Microsoft.CLU.Run/PackageManagementMode.cs +++ b/src/CLU/Microsoft.CLU.Run/PackageManagementMode.cs @@ -548,7 +548,7 @@ private static void GenerateScript(string cfgPath) " export CmdletSessionID=$PPID", "fi", "SCRIPTPATH=$(dirname \"$0\")", - $"$SCRIPTPATH/clurun -s {scriptName} -r $SCRIPTPATH/{Path.GetFileName(cfgPath)} $*" + $"$SCRIPTPATH/clurun -s {scriptName} -r $SCRIPTPATH/{Path.GetFileName(cfgPath)} \"$@\"" }); System.Diagnostics.Process.Start("chmod", $"777 {scriptPath}"); } diff --git a/src/CLU/Microsoft.CLU.Test/Content/package.cfg b/src/CLU/Microsoft.CLU.Test/Content/package.cfg deleted file mode 100644 index 48c45e1cedd8..000000000000 --- a/src/CLU/Microsoft.CLU.Test/Content/package.cfg +++ /dev/null @@ -1,4 +0,0 @@ -Name: Microsoft.CLU.Test -CommandAssemblies: Microsoft.CLU.Test.dll -NounPrefix: Test -NounFirst: true diff --git a/src/CLU/Microsoft.CLU.Test/TestCLU.bat b/src/CLU/Microsoft.CLU.Test/TestCLU.bat deleted file mode 100644 index fe7b0c29e5de..000000000000 --- a/src/CLU/Microsoft.CLU.Test/TestCLU.bat +++ /dev/null @@ -1,30 +0,0 @@ -SETLOCAL EnableExtensions - -ECHO Test return code success case -call azure success show -REM We expect that the commands above succeed (return 0) -IF ERRORLEVEL 1 (EXIT /B 1) - -ECHO Test return codes non terminating error case -call azure success show --generatenonterminatingerror true -if ERRORLEVEL 1 goto :verify_error_code_2 -REM We expect the error code to be 1 - so we shouldn't be here -EXIT /B 1 -:verify_error_code_2 -IF ERRORLEVEL 2 (EXIT /B 1) - -ECHO Test return codes terminating error case -call azure success show --generateterminatingerror true -if ERRORLEVEL 2 goto :verify_error_code_3 -REM We expect the error code to be 1 - so we shouldn't be here -EXIT /B 1 -:verify_error_code_3 -IF ERRORLEVEL 3 (EXIT /B 1) - -ECHO Test pipeline aliasing -call azure test record new > testrecordnew.json -call azure test record show < testrecordnew.json - -REM We expect that the commands above succeed -IF ERRORLEVEL 1 (EXIT /B 1) - diff --git a/src/CLU/Microsoft.ScenarioTests.CLU/Content/package.cfg b/src/CLU/Microsoft.ScenarioTests.CLU/Content/package.cfg new file mode 100644 index 000000000000..cab24c1a6453 --- /dev/null +++ b/src/CLU/Microsoft.ScenarioTests.CLU/Content/package.cfg @@ -0,0 +1,4 @@ +Name: Microsoft.ScenarioTests.CLU +CommandAssemblies: Microsoft.ScenarioTests.CLU.dll +NounPrefix: Test +NounFirst: true diff --git a/src/CLU/Microsoft.CLU.Test/Content/azure.lx b/src/CLU/Microsoft.ScenarioTests.CLU/Content/testclu.lx similarity index 72% rename from src/CLU/Microsoft.CLU.Test/Content/azure.lx rename to src/CLU/Microsoft.ScenarioTests.CLU/Content/testclu.lx index f65eed0d5de1..50ddf444dfeb 100644 --- a/src/CLU/Microsoft.CLU.Test/Content/azure.lx +++ b/src/CLU/Microsoft.ScenarioTests.CLU/Content/testclu.lx @@ -1,5 +1,4 @@ RtPackage: Microsoft.CLU.Commands RtEntry: Microsoft.CLU.CommandModel.CmdletCommandModel.Run RtAssembly: Microsoft.CLU.dll -Modules: Microsoft.CLU.Test -NounPrefix: AzureRm \ No newline at end of file +Modules: Microsoft.ScenarioTests.CLU diff --git a/src/CLU/Microsoft.CLU.Test/Microsoft.CLU.Test.nuspec.template b/src/CLU/Microsoft.ScenarioTests.CLU/Microsoft.ScenarioTest.CLU.nuspec.template similarity index 94% rename from src/CLU/Microsoft.CLU.Test/Microsoft.CLU.Test.nuspec.template rename to src/CLU/Microsoft.ScenarioTests.CLU/Microsoft.ScenarioTest.CLU.nuspec.template index 83ad6d5a41fb..aed46e80a629 100644 --- a/src/CLU/Microsoft.CLU.Test/Microsoft.CLU.Test.nuspec.template +++ b/src/CLU/Microsoft.ScenarioTests.CLU/Microsoft.ScenarioTest.CLU.nuspec.template @@ -1,7 +1,7 @@ - + - Microsoft.CLU.Test + Microsoft.ScenarioTests.CLU Microsoft CLU CommandLine test command packge %PackageVersion% Microsoft diff --git a/src/CLU/Microsoft.CLU.Test/Microsoft.CLU.Test.xproj b/src/CLU/Microsoft.ScenarioTests.CLU/Microsoft.ScenarioTest.CLU.xproj similarity index 100% rename from src/CLU/Microsoft.CLU.Test/Microsoft.CLU.Test.xproj rename to src/CLU/Microsoft.ScenarioTests.CLU/Microsoft.ScenarioTest.CLU.xproj diff --git a/src/CLU/Microsoft.CLU.Test/PipelineAliasTest.cs b/src/CLU/Microsoft.ScenarioTests.CLU/PipelineAliasTest.cs similarity index 90% rename from src/CLU/Microsoft.CLU.Test/PipelineAliasTest.cs rename to src/CLU/Microsoft.ScenarioTests.CLU/PipelineAliasTest.cs index 784e92e2022a..a3d92ecf8b70 100644 --- a/src/CLU/Microsoft.CLU.Test/PipelineAliasTest.cs +++ b/src/CLU/Microsoft.ScenarioTests.CLU/PipelineAliasTest.cs @@ -96,4 +96,18 @@ protected override void ProcessRecord() WriteObject(new TestRecord() { Name = $"Matched {RecordName}", Value = $"Matched {Value}", SomethingElse = $"Matched {SomethingElse}" }); } } + + [Cmdlet(VerbsCommon.Show, "TestRecordFromParameter")] + public class ShowTestRecordFromParameter : PSCmdlet + { + + [Parameter(Mandatory = true, ValueFromPipeline = true)] + [Alias("Rec")] + public TestRecord Record { get; set; } + + protected override void ProcessRecord() + { + WriteObject(Record); + } + } } diff --git a/src/CLU/Microsoft.CLU.Test/Properties/AssemblyInfo.cs b/src/CLU/Microsoft.ScenarioTests.CLU/Properties/AssemblyInfo.cs similarity index 92% rename from src/CLU/Microsoft.CLU.Test/Properties/AssemblyInfo.cs rename to src/CLU/Microsoft.ScenarioTests.CLU/Properties/AssemblyInfo.cs index afb2e0006b39..a7c508c7371b 100644 --- a/src/CLU/Microsoft.CLU.Test/Properties/AssemblyInfo.cs +++ b/src/CLU/Microsoft.ScenarioTests.CLU/Properties/AssemblyInfo.cs @@ -18,11 +18,11 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Microsoft.CLU.Test")] +[assembly: AssemblyTitle("Microsoft.ScenarioTests.CLU")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Microsoft.CLU.Test")] +[assembly: AssemblyProduct("Microsoft.ScenarioTests.CLU")] [assembly: AssemblyCopyright("Copyright © Microsoft")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/src/CLU/Microsoft.CLU.Test/ReturnCodeTest.cs b/src/CLU/Microsoft.ScenarioTests.CLU/ReturnCodeTest.cs similarity index 100% rename from src/CLU/Microsoft.CLU.Test/ReturnCodeTest.cs rename to src/CLU/Microsoft.ScenarioTests.CLU/ReturnCodeTest.cs diff --git a/src/CLU/Microsoft.CLU.Test/project.json b/src/CLU/Microsoft.ScenarioTests.CLU/project.json similarity index 100% rename from src/CLU/Microsoft.CLU.Test/project.json rename to src/CLU/Microsoft.ScenarioTests.CLU/project.json diff --git a/src/CLU/Microsoft.ScenarioTests.CLU/testrunner.bat b/src/CLU/Microsoft.ScenarioTests.CLU/testrunner.bat new file mode 100644 index 000000000000..97ee43252814 --- /dev/null +++ b/src/CLU/Microsoft.ScenarioTests.CLU/testrunner.bat @@ -0,0 +1,33 @@ +SETLOCAL EnableExtensions + +ECHO Test return code success case +call testclu success show 2> out.error +REM We expect that the commands above succeed (return 0) +IF %ERRORLEVEL% NEQ 0 ( + ECHO "Expected error level 0 for success, got " %ERRORLEVEL% + EXIT /B 1 +) + +ECHO Test return codes non terminating error case +call testclu success show --generatenonterminatingerror true 2> out.error +IF %ERRORLEVEL% NEQ 1 ( + ECHO "Expected error level 1 for non-terminating error, got " %ERRORLEVEL% + EXIT /B 1 +) + +ECHO Test return codes terminating error case +call testclu success show --generateterminatingerror true 2> out.error +IF %ERRORLEVEL% NEQ 2 ( + ECHO "Expected error level 2 for terminating error, got " %ERRORLEVEL% + EXIT /B 1 +) + +ECHO Test pipeline aliasing +call testclu record new | testclu record show > out.txt +IF %ERRORLEVEL% NEQ 0 ( + ECHO "Expected error level 0 for success, got " %ERRORLEVEL% + EXIT /B 1 +) + + +ECHO ALL TESTS ARE HAPPY diff --git a/tools/CLU/BuildPackage.ps1 b/tools/CLU/BuildPackage.ps1 index d9a60cfcd634..63c7042e3a40 100644 --- a/tools/CLU/BuildPackage.ps1 +++ b/tools/CLU/BuildPackage.ps1 @@ -2,16 +2,16 @@ if (!(Test-Path $cmdletsDir)) { - throw "cmdletsDir: '$cmdletsDir' must be an existing directory containing cmdlet code" + throw "cmdletsDir: '$cmdletsDir' must be an existing directory containing cmdlet code" } if (!(Test-Path $outputDir)) { - throw "outputDir: '$outputDir' must be an existing directory" + throw "outputDir: '$outputDir' must be an existing directory" } if ([string]::IsNullOrWhiteSpace($env:WORKSPACE) -or !(Test-Path $env:WORKSPACE)) { - throw "env:WORKSPACE: '$env:WORKSPACE' must be an existing directory" + throw "env:WORKSPACE: '$env:WORKSPACE' must be an existing directory" } $packageSource = $packageSource.TrimEnd('\\') @@ -34,19 +34,19 @@ $contentFileText = "" $contentFiles | %{ $contentFileText += (" `r`n")} if ($packageId -ne "Microsoft.CLU.Commands") { - $contentFileText += " `r`n" + $contentFileText += " `r`n" } if ($renameFileExists) { - $contentFileText += " `r`n" + $contentFileText += " `r`n" } $contentFileText += " `r`n" $sourceFileText = "" $refFiles | %{$sourceFileText += (" `r`n")} $outputContent = $fileContent -replace "%PackageVersion%", $packageVersion $outputContent = $outputContent -replace "%ReferenceFiles%", $refFileText -$outputContent = $outputContent -replace "%SourceFiles%", $sourceFileText -$outputContent = $outputContent -replace "%ContentFiles%", $contentFileText + $outputContent = $outputContent -replace "%SourceFiles%", $sourceFileText + $outputContent = $outputContent -replace "%ContentFiles%", $contentFileText Set-Content -Value $outputContent -Path $nuspecOutput Write-Host "Creating nuget package..."