diff --git a/.pipelines/test-job.yml b/.pipelines/test-job.yml index 61cd79f98a..ef8b533f4e 100644 --- a/.pipelines/test-job.yml +++ b/.pipelines/test-job.yml @@ -2,7 +2,13 @@ parameters: - name: branch type: string - - name: version + - name: test + type: string + + - name: testDisplayName + type: string + + - name: testMap type: string - name: image @@ -16,8 +22,8 @@ parameters: default: '' jobs: - - job: test_${{ parameters.branch }}_${{ parameters.version }} - displayName: "${{ parameters.version }} tests - ${{ parameters.branch }}" + - job: test_${{ parameters.branch }}_${{ parameters.test }} + displayName: "${{ parameters.testDisplayName }} - ${{ parameters.branch }}" dependsOn: [] condition: and(succeeded(), eq('${{ parameters.run }}', true)) variables: @@ -34,10 +40,10 @@ jobs: steps: - task: CloudTestServerBuildTask@2 inputs: - DisplayName: "${{ parameters.version }} tests - ${{ parameters.branch }}" + DisplayName: "${{ parameters.testDisplayName }} - ${{ parameters.branch }}" connectedServiceName: "CloudTest-PROD" cloudTestTenant: "wsl" - testMapLocation: 'testbin\x64\cloudtest\wsl-test-image-${{ parameters.image }}-${{ parameters.version}}\TestMap.xml' + testMapLocation: 'testbin\x64\cloudtest\wsl-test-image-${{ parameters.image }}-${{ parameters.testMap}}\TestMap.xml' pipelineArtifactName: "drop_wsl_build" pipelineArtifactBuildUrl: '$(System.TaskDefinitionsUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)' buildDropArtifactName: "" diff --git a/.pipelines/test-stage.yml b/.pipelines/test-stage.yml index b917bde9b4..de975cb360 100644 --- a/.pipelines/test-stage.yml +++ b/.pipelines/test-stage.yml @@ -11,12 +11,24 @@ parameters: type: string default: '' - - name: versions + - name: test_suites type: object default: - - wsl1 - - wsl2 - - wslc + - id: wsl1 + display_name: WSL1 tests + map: wsl1 + - id: wsl2_unit + display_name: WSL2 unit tests + map: wsl2-unit + - id: wsl2_e2e_1 + display_name: WSL2 E2E shard 1 + map: wsl2-e2e-1 + - id: wsl2_e2e_2 + display_name: WSL2 E2E shard 2 + map: wsl2-e2e-2 + - id: wslc + display_name: WSLC tests + map: wslc - name: test_images type: object @@ -40,14 +52,16 @@ stages: ${{ else }}: dependsOn: [build_x64] jobs: - - ${{ each version in parameters.versions }}: + - ${{ each suite in parameters.test_suites }}: - ${{ each image in parameters.test_images }}: - template: test-job.yml@self parameters: branch: "${{ image.name }}" - version: ${{ version }} + test: "${{ suite.id }}" + testDisplayName: "${{ suite.display_name }}" + testMap: "${{ suite.map }}" image: "${{ image.image }}" # Skip the WSLC suite on Server images: it triggers a Hyper-V VMBus # PowerOff hang during VM teardown that times out the job. - run: ${{ and(or(not(parameters.rs_prerelease_only), eq(image.name, 'rs_prerelease')), or(ne(version, 'wslc'), ne(image.server, true))) }} + run: ${{ and(or(not(parameters.rs_prerelease_only), eq(image.name, 'rs_prerelease')), or(ne(suite.id, 'wslc'), ne(image.server, true))) }} pool: "${{ parameters.pool }}" \ No newline at end of file diff --git a/cloudtest/CMakeLists.txt b/cloudtest/CMakeLists.txt index 643a069d1c..5c72488ece 100644 --- a/cloudtest/CMakeLists.txt +++ b/cloudtest/CMakeLists.txt @@ -34,16 +34,54 @@ endif() # When the package stage is included (release + nightly), test the real bundle from that stage. # PR builds test the installer.msix directly from the build artifact (no bundle needed). if (INCLUDE_PACKAGE_STAGE) - set(TEST_PACKAGE_PROVIDER "[package]") - set(TEST_PACKAGE_PATH "bundle\\Microsoft.WSL_${PACKAGE_VERSION}_x64_ARM64.msixbundle") set(TEST_PACKAGE_FILE "Microsoft.WSL_${PACKAGE_VERSION}_x64_ARM64.msixbundle") + set(TEST_PACKAGE_BUILD_FILE " ") + set(PACKAGE_ARTIFACT_PROVIDER " + + + + + + ") else() - set(TEST_PACKAGE_PROVIDER "[drop]") - set(TEST_PACKAGE_PATH "testbin\\x64\\release\\installer.msix") set(TEST_PACKAGE_FILE "installer.msix") + set(TEST_PACKAGE_BUILD_FILE "") + set(PACKAGE_ARTIFACT_PROVIDER "") endif() function(add_test_group image version suffix filter) + cmake_parse_arguments( + PARSE_ARGV 4 + TEST_GROUP + "INCLUDE_UNIT_TESTS;INCLUDE_TEST_DATA;INCLUDE_TEST_PACKAGES" + "" + "") + + set(UNIT_TESTS_BUILD_FILE "") + set(UNIT_TESTS_ARGUMENT "") + if (TEST_GROUP_INCLUDE_UNIT_TESTS) + set(UNIT_TESTS_BUILD_FILE " ") + set(UNIT_TESTS_ARGUMENT " /p:UnitTestsPath=[WorkingDirectory]\\unit_tests") + endif() + + set(TEST_DATA_BUILD_FILE "") + if (TEST_GROUP_INCLUDE_TEST_DATA) + set(TEST_DATA_BUILD_FILE " ") + endif() + + set(TEST_PACKAGES_BUILD_FILE "") + set(TEST_PACKAGES_PROVIDER "") + if (TEST_GROUP_INCLUDE_TEST_PACKAGES) + set(TEST_PACKAGES_BUILD_FILE " ") + set(TEST_PACKAGES_PROVIDER " + + + + + + ") + endif() + set(DIR ${OUT}/${image}-${suffix}) file(MAKE_DIRECTORY ${DIR}) @@ -51,10 +89,44 @@ function(add_test_group image version suffix filter) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TestGroup.xml.in ${DIR}/TestGroup.xml) endfunction() +set(NON_WSLC_FILTER "not (@TestCategory='WSLC')") + +string(CONCAT WSL2_UNIT_CLASSES + "(" + "@Name='UnitTests::UnitTests::*' OR " + "@Name='FilesystemUnitTests::FilesystemUnitTests::*' OR " + "@Name='StringUnitTests::StringUnitTests::*' OR " + "@Name='WindowsUpdateTests::*' OR " + "@Name='NetworkTests::GnsCallbackResultTests::*'" + ")") + +string(CONCAT WSL2_E2E_1_CLASSES + "(" + "@Name='NetworkTests::MirroredTests::*' OR " + "@Name='MountTests::MountTests::*' OR " + "@Name='NetworkTests::ConsommeTests::*' OR " + "@Name='Plan9Tests::Plan9Tests::*' OR " + "@Name='PolicyTest::*' OR " + "@Name='SimpleTests::SimpleTests::*'" + ")") + +set(WSL2_UNIT_FILTER "${NON_WSLC_FILTER} AND ${WSL2_UNIT_CLASSES}") +set(WSL2_E2E_1_FILTER "${NON_WSLC_FILTER} AND ${WSL2_E2E_1_CLASSES}") +set(WSL2_E2E_2_FILTER "${NON_WSLC_FILTER} AND NOT ${WSL2_UNIT_CLASSES} AND NOT ${WSL2_E2E_1_CLASSES}") + foreach(image ${CLOUDTEST_IMAGES}) - add_test_group("${image}" "1" "wsl1" "not (@TestCategory='WSLC')") - add_test_group("${image}" "2" "wsl2" "not (@TestCategory='WSLC')") + add_test_group("${image}" "1" "wsl1" "${NON_WSLC_FILTER}" INCLUDE_UNIT_TESTS INCLUDE_TEST_PACKAGES) + add_test_group("${image}" "2" "wsl2-unit" "${WSL2_UNIT_FILTER}" INCLUDE_UNIT_TESTS) + add_test_group("${image}" "2" "wsl2-e2e-1" "${WSL2_E2E_1_FILTER}" INCLUDE_UNIT_TESTS) + add_test_group( + "${image}" + "2" + "wsl2-e2e-2" + "${WSL2_E2E_2_FILTER}" + INCLUDE_UNIT_TESTS + INCLUDE_TEST_DATA + INCLUDE_TEST_PACKAGES) if (NOT "${image}" IN_LIST CLOUDTEST_SERVER_IMAGES) - add_test_group("${image}" "2" "wslc" "@TestCategory='WSLC'") + add_test_group("${image}" "2" "wslc" "@TestCategory='WSLC'" INCLUDE_TEST_DATA) endif() endforeach() diff --git a/cloudtest/TestGroup.xml.in b/cloudtest/TestGroup.xml.in index 81c4a6c5f7..ae94d65560 100644 --- a/cloudtest/TestGroup.xml.in +++ b/cloudtest/TestGroup.xml.in @@ -5,15 +5,15 @@ - +${TEST_PACKAGE_BUILD_FILE} - +${TEST_DATA_BUILD_FILE} - - +${UNIT_TESTS_BUILD_FILE} +${TEST_PACKAGES_BUILD_FILE} @@ -22,6 +22,6 @@ - + diff --git a/cloudtest/TestMap.xml.in b/cloudtest/TestMap.xml.in index de7487f878..2ecef60d77 100644 --- a/cloudtest/TestMap.xml.in +++ b/cloudtest/TestMap.xml.in @@ -9,27 +9,8 @@ - - - - - - - - - - - - - - - - - - - - - +${PACKAGE_ARTIFACT_PROVIDER} +${TEST_PACKAGES_PROVIDER}