From 7abb442add97b87e5b2a0b971041f87ab1a188c3 Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Fri, 10 May 2019 14:37:16 +0530 Subject: [PATCH 01/10] Fix for the trx classname being wrongly stamped when testname and fullqualifiedname are same. --- .../Utility/Converter.cs | 2 +- .../Utility/ConverterTests.cs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs index 217352bdd2..4a5f998554 100644 --- a/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs +++ b/src/Microsoft.TestPlatform.Extensions.TrxLogger/Utility/Converter.cs @@ -606,7 +606,7 @@ private static string GetTestClassName(string testName, string fullyQualifiedNam // In case, fullyQualifiedName ends with testName, className is checked within remaining value of fullyQualifiedName. // Example: In case, testName = TestMethod1(2, 3, 4.0d) and fullyQualifiedName = TestProject1.Class1.TestMethod1(2, 3, 4.0d), className will be checked within 'TestProject1.Class1.' only - var nameToCheck = fullyQualifiedName.EndsWith(testName) ? + var nameToCheck = !fullyQualifiedName.Equals(testName, StringComparison.OrdinalIgnoreCase) && fullyQualifiedName.EndsWith(testName) ? fullyQualifiedName.Substring(0, fullyQualifiedName.Length - testName.Length) : fullyQualifiedName; diff --git a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs index 8d4adca18a..b4ce48f197 100644 --- a/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs +++ b/test/Microsoft.TestPlatform.Extensions.TrxLogger.UnitTests/Utility/ConverterTests.cs @@ -99,6 +99,16 @@ public void ToTestElementShouldNotFailWhenThereIsNoTestCategoreis() CollectionAssert.AreEqual(expected, unitTestElement.TestCategories.ToArray()); } + [TestMethod] + public void ToTestElementShouldContainExpectedTestMethodPropertiesIfFqnIsSameAsTestName() + { + var expectedClassName = "TestProject1.Class1"; + var fullyQualifiedName = expectedClassName + "." + "TestMethod1"; + var testName = "TestProject1.Class1.TestMethod1"; + + ValidateTestMethodProperties(testName, fullyQualifiedName, expectedClassName); + } + [TestMethod] public void ToTestElementShouldContainExpectedTestMethodPropertiesIfFqnEndsWithTestName() { From 5ddb75188368ee2d3f88e67f5802fb725dff09ec Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Tue, 14 May 2019 22:04:15 +0530 Subject: [PATCH 02/10] Prevent unnecessary restore for build from source scenario. --- scripts/build.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index 6fba17783a..d8ecd89917 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -218,12 +218,14 @@ function restore_package() log "restore_package: Start restoring packages to $TP_PACKAGES_DIR." local start=$SECONDS - log ".. .. Restore: Source: $TP_ROOT_DIR/src/package/external/external.csproj" - $dotnet restore $TP_ROOT_DIR/src/package/external/external.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version || failed=true - if [ "$failed" = true ]; then - error "Failed to restore packages." - return 2 - fi + if [[ $TP_USE_REPO_API = 0 ]]; then + log ".. .. Restore: Source: $TP_ROOT_DIR/src/package/external/external.csproj" + $dotnet restore $TP_ROOT_DIR/src/package/external/external.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version || failed=true + if [ "$failed" = true ]; then + error "Failed to restore packages." + return 2 + fi + fi log "restore_package: Complete. Elapsed $(( SECONDS - start ))s." } From 31d2448b34fe3d51cf875414e7f7b59aadf411d1 Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Tue, 14 May 2019 23:05:03 +0530 Subject: [PATCH 03/10] Experimenting: Command used by source build --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 95a8a73bd1..3b47a12961 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -70,6 +70,6 @@ jobs: variables: buildConfiguration: 'Release' steps: - - script: ./build.sh -c $(buildConfiguration) + - script: ./build.sh -DotNetBuildFromSource -DotNetCoreSdkDir /src/Tools/dotnetcli/ -c Release -r centos.7-x64 -v 15.9.0 -vs preview-20180807-05 displayName: './build.sh -c $(buildConfiguration)' From d08f6a4a3bd7ebb7ee4cf6f74927f9863c0fa009 Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Tue, 14 May 2019 23:13:31 +0530 Subject: [PATCH 04/10] Update azure-pipelines.yml --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3b47a12961..3b4c3af9dd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -70,6 +70,6 @@ jobs: variables: buildConfiguration: 'Release' steps: - - script: ./build.sh -DotNetBuildFromSource -DotNetCoreSdkDir /src/Tools/dotnetcli/ -c Release -r centos.7-x64 -v 15.9.0 -vs preview-20180807-05 + - script: ./build.sh -DotNetBuildFromSource -c Release displayName: './build.sh -c $(buildConfiguration)' From 26f9568ec068321a2501afb02f5fa33ba6bfd52a Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Wed, 15 May 2019 16:06:22 +0530 Subject: [PATCH 05/10] Update build.sh --- scripts/build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index d8ecd89917..2770711f01 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -169,7 +169,6 @@ function usage() # function install_cli() { - if [[ $TP_USE_REPO_API = 0 ]]; then # Skip download of dotnet toolset if REPO API is enabled local failed=false local install_script="$TP_TOOLS_DIR/dotnet-install.sh" @@ -198,7 +197,6 @@ function install_cli() $install_script --install-dir "$TP_TOOLS_DIR/dotnet" --no-path --channel "release/2.0.0" --version "2.0.0" --shared-runtime #log "install_cli: Get shared components which is compatible with dotnet cli version $DOTNET_CLI_VERSION..." #$install_script --install-dir "$TP_TOOLS_DIR/dotnet" --no-path --channel "master" --version $DOTNET_RUNTIME_VERSION --shared-runtime - fi local dotnet_path=$(_get_dotnet_path) if [[ ! -e $dotnet_path ]]; then From 12530a993cb42fc7626d28284c52567f239bbdf2 Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Wed, 15 May 2019 17:16:50 +0530 Subject: [PATCH 06/10] Using external csproj for BuildFromSource --- scripts/build.sh | 12 +++-- .../external/external_BuildFromSource.csproj | 47 +++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 src/package/external/external_BuildFromSource.csproj diff --git a/scripts/build.sh b/scripts/build.sh index 2770711f01..d54ec7d9fd 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -219,10 +219,14 @@ function restore_package() if [[ $TP_USE_REPO_API = 0 ]]; then log ".. .. Restore: Source: $TP_ROOT_DIR/src/package/external/external.csproj" $dotnet restore $TP_ROOT_DIR/src/package/external/external.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version || failed=true - if [ "$failed" = true ]; then - error "Failed to restore packages." - return 2 - fi + else + log ".. .. Restore: Source: $TP_ROOT_DIR/src/package/external/external_BuildFromSource.csproj" + $dotnet restore $TP_ROOT_DIR/src/package/external/external_BuildFromSource.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version || failed=true + fi + + if [ "$failed" = true ]; then + error "Failed to restore packages." + return 2 fi log "restore_package: Complete. Elapsed $(( SECONDS - start ))s." diff --git a/src/package/external/external_BuildFromSource.csproj b/src/package/external/external_BuildFromSource.csproj new file mode 100644 index 0000000000..e19b4e0d78 --- /dev/null +++ b/src/package/external/external_BuildFromSource.csproj @@ -0,0 +1,47 @@ + + + ../../../ + + + + net46 + restore + win7-x64 + false + false + false + false + false + false + false + false + false + + + false + false + false + false + + + + + 3.4.3 + All + + + + + 1.0.1 + All + + + + + + + + + From b2c29c8337874e8c8ce822e246fbb9ae2e827515 Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Wed, 15 May 2019 22:27:50 +0530 Subject: [PATCH 07/10] Removed the redundant csproj using appropriate property instead. --- scripts/build.sh | 4 +- src/package/external/external.csproj | 4 +- .../external/external_BuildFromSource.csproj | 47 ------------------- 3 files changed, 5 insertions(+), 50 deletions(-) delete mode 100644 src/package/external/external_BuildFromSource.csproj diff --git a/scripts/build.sh b/scripts/build.sh index d54ec7d9fd..ba1e4921e3 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -221,7 +221,7 @@ function restore_package() $dotnet restore $TP_ROOT_DIR/src/package/external/external.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version || failed=true else log ".. .. Restore: Source: $TP_ROOT_DIR/src/package/external/external_BuildFromSource.csproj" - $dotnet restore $TP_ROOT_DIR/src/package/external/external_BuildFromSource.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version || failed=true + $dotnet restore $TP_ROOT_DIR/src/package/external/external.csproj --packages $TP_PACKAGES_DIR -v:minimal -warnaserror -p:Version=$TPB_Version -p:DotNetBuildFromSource=true || failed=true fi if [ "$failed" = true ]; then @@ -248,7 +248,7 @@ function invoke_build() if [[ $TP_USE_REPO_API = 0 ]]; then $dotnet build $TPB_Solution --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild || failed=true else - $dotnet build $TPB_Build_From_Source_Solution --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild || failed=true + $dotnet build $TPB_Build_From_Source_Solution --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild -p:DotNetBuildFromSource=true || failed=true fi else find . -name "$PROJECT_NAME_PATTERNS" | xargs -L 1 $dotnet build --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild diff --git a/src/package/external/external.csproj b/src/package/external/external.csproj index 787474853a..19b311d0be 100644 --- a/src/package/external/external.csproj +++ b/src/package/external/external.csproj @@ -23,7 +23,7 @@ false false - + 3.4.3 @@ -88,6 +88,8 @@ 15.6.815-master284DF69C All + + diff --git a/src/package/external/external_BuildFromSource.csproj b/src/package/external/external_BuildFromSource.csproj deleted file mode 100644 index e19b4e0d78..0000000000 --- a/src/package/external/external_BuildFromSource.csproj +++ /dev/null @@ -1,47 +0,0 @@ - - - ../../../ - - - - net46 - restore - win7-x64 - false - false - false - false - false - false - false - false - false - - - false - false - false - false - - - - - 3.4.3 - All - - - - - 1.0.1 - All - - - - - - - - - From 21a3e501a51f6e3648ae530a6761b1acbcbb4ddb Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Wed, 15 May 2019 22:33:35 +0530 Subject: [PATCH 08/10] Fixing the errors --- src/package/external/external.csproj | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/package/external/external.csproj b/src/package/external/external.csproj index 19b311d0be..25dbc519f2 100644 --- a/src/package/external/external.csproj +++ b/src/package/external/external.csproj @@ -49,13 +49,6 @@ 1.1.0-beta1-62316-01 All - - - 1.0.1 - All - $(TestPlatformExternalsVersion) All @@ -90,6 +83,13 @@ + + + 1.0.1 + All + From 2a4582b2c5953fc37d2391a4c24054bae86ec667 Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Wed, 15 May 2019 22:44:59 +0530 Subject: [PATCH 09/10] Switching back the yaml to original state. --- azure-pipelines.yml | 2 +- scripts/build.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3b4c3af9dd..95a8a73bd1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -70,6 +70,6 @@ jobs: variables: buildConfiguration: 'Release' steps: - - script: ./build.sh -DotNetBuildFromSource -c Release + - script: ./build.sh -c $(buildConfiguration) displayName: './build.sh -c $(buildConfiguration)' diff --git a/scripts/build.sh b/scripts/build.sh index ba1e4921e3..c603a4cf2c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -169,6 +169,7 @@ function usage() # function install_cli() { + if [[ $TP_USE_REPO_API = 0 ]]; then # Skip download of dotnet toolset if REPO API is enabled local failed=false local install_script="$TP_TOOLS_DIR/dotnet-install.sh" @@ -197,6 +198,7 @@ function install_cli() $install_script --install-dir "$TP_TOOLS_DIR/dotnet" --no-path --channel "release/2.0.0" --version "2.0.0" --shared-runtime #log "install_cli: Get shared components which is compatible with dotnet cli version $DOTNET_CLI_VERSION..." #$install_script --install-dir "$TP_TOOLS_DIR/dotnet" --no-path --channel "master" --version $DOTNET_RUNTIME_VERSION --shared-runtime + fi local dotnet_path=$(_get_dotnet_path) if [[ ! -e $dotnet_path ]]; then From 10c134bb04df2c40f131f42c8cd8f79be7d9d212 Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Wed, 15 May 2019 22:48:38 +0530 Subject: [PATCH 10/10] Simplied the condition --- src/package/external/external.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package/external/external.csproj b/src/package/external/external.csproj index 25dbc519f2..0c318574e1 100644 --- a/src/package/external/external.csproj +++ b/src/package/external/external.csproj @@ -23,7 +23,7 @@ false false - + 3.4.3