diff --git a/tools/scripts/build-tests/run-al2-integ-tests.sh b/tools/scripts/build-tests/run-al2-integ-tests.sh index ac8ee3af18a..dc782bed8e1 100755 --- a/tools/scripts/build-tests/run-al2-integ-tests.sh +++ b/tools/scripts/build-tests/run-al2-integ-tests.sh @@ -21,6 +21,12 @@ AWS_ROLE_SESSION_NAME="$3" echo "Setting the run environment" export TEST_ASSUME_ROLE_ARN=arn:aws:iam::${AWS_ACCOUNT}:role/IntegrationTest +BUILD_TYPE=$(cat build-request.json | jq .buildType | tr -d '"') +echo "BUILD_TYPE=${BUILD_TYPE}" +pushd ${PREFIX_DIR}/aws-sdk-cpp +if [ "${BUILD_TYPE}" = "PREVIEW" ]; then SERVICE_ID=$(git status generated/src/aws-cpp-sdk-* --porcelain | grep "generated/src/" | sed -n 's|.*generated/src/aws-cpp-sdk-\([^/]*\).*|\1|p' | sort -u | tr "\n" "," | sed "s/,$//"); else SERVICE_ID=""; fi +popd +echo "SERVICE_ID=${SERVICE_ID}" export TEST_LAMBDA_CODE_PATH=${PREFIX_DIR}/aws-sdk-cpp/tests/aws-cpp-sdk-lambda-integration-tests/resources export sts=$(aws sts assume-role --role-arn "$TEST_ASSUME_ROLE_ARN" --role-session-name "${AWS_ROLE_SESSION_NAME}" --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]') export profile=sdk-integ-test @@ -32,4 +38,4 @@ export AWS_PROFILE=$profile export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${PREFIX_DIR}/al2-install/lib64/:${PREFIX_DIR}/al2-build/tests/testing-resources/" cd "${PREFIX_DIR}/al2-build" if [ -f "${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt" ]; then export LSAN_OPTIONS=suppressions="${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt"; fi -python3 ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./tests +python3 ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./tests --serviceId ${SERVICE_ID:-""} diff --git a/tools/scripts/build-tests/run-mac-integ-tests.sh b/tools/scripts/build-tests/run-mac-integ-tests.sh index 64f473e76f0..871b452628e 100755 --- a/tools/scripts/build-tests/run-mac-integ-tests.sh +++ b/tools/scripts/build-tests/run-mac-integ-tests.sh @@ -21,6 +21,12 @@ AWS_ROLE_SESSION_NAME="$3" echo "Setting the run environment" export TEST_ASSUME_ROLE_ARN=arn:aws:iam::${AWS_ACCOUNT}:role/IntegrationTest +BUILD_TYPE=$(cat build-request.json | jq .buildType | tr -d '"') +echo "Build type: ${BUILD_TYPE}" +pushd ${PREFIX_DIR}/aws-sdk-cpp +if [ "${BUILD_TYPE}" = "PREVIEW" ]; then SERVICE_ID=$(git status generated/src/aws-cpp-sdk-* --porcelain | grep "generated/src/" | sed -n 's|.*generated/src/aws-cpp-sdk-\([^/]*\).*|\1|p' | sort -u | tr "\n" "," | sed "s/,$//"); else SERVICE_ID=""; fi +popd +echo "Service ID: ${SERVICE_ID}" export TEST_LAMBDA_CODE_PATH=${PREFIX_DIR}/aws-sdk-cpp/tests/aws-cpp-sdk-lambda-integration-tests/resources export sts=$(aws sts assume-role --role-arn "$TEST_ASSUME_ROLE_ARN" --role-session-name "${AWS_ROLE_SESSION_NAME}" --query 'Credentials.[AccessKeyId,SecretAccessKey,SessionToken]') export profile=sdk-integ-test @@ -32,4 +38,4 @@ export AWS_PROFILE=$profile export DYLD_LIBRARY_PATH="${CATAPULT_WORKSPACE_DIR}/mac-install/lib:${CATAPULT_WORKSPACE_DIR}/mac-build/tests/testing-resources/" cd "${PREFIX_DIR}/mac-build" if [ -f "${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt" ]; then export LSAN_OPTIONS=suppressions="${PREFIX_DIR}/aws-sdk-cpp/tools/scripts/suppressions.txt"; fi -python3 ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./tests +python3 ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./tests --serviceId ${SERVICE_ID:-""} diff --git a/tools/scripts/build-tests/run-windows-integ-tests.ps1 b/tools/scripts/build-tests/run-windows-integ-tests.ps1 index 5795b0051c8..22fe72fa39c 100755 --- a/tools/scripts/build-tests/run-windows-integ-tests.ps1 +++ b/tools/scripts/build-tests/run-windows-integ-tests.ps1 @@ -17,6 +17,12 @@ aws configure set aws_access_key_id (${sts}[1] -replace " " -replace "`"" -repla aws configure set aws_secret_access_key (${sts}[2] -replace " " -replace "`"" -replace ",") aws configure set aws_session_token (${sts}[3] -replace " " -replace "`"" -replace ",") aws configure list +$BUILD_TYPE=$(cat build-request.json | jq .buildType | tr -d \\) +Write-Host BUILD_TYPE:$BUILD_TYPE +Push-Location "${env:CATAPULT_WORKSPACE_DIR}\\aws-sdk-cpp" +if ($BUILD_TYPE -eq "PREVIEW") { $SERVICE_ID = (git status generated/src/aws-cpp-sdk-* --porcelain | Select-String "generated/src/" | ForEach-Object { if($_ -match "generated/src/aws-cpp-sdk-([^/]*)") { $matches[1] } } | Sort-Object -Unique) -join "," } else { $SERVICE_ID="" } +Write-Host "SERVICE_ID: $SERVICE_ID" +Pop-Location # Run tests cd "${env:PREFIX_DIR}\\win-build" -python3 ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./bin/Debug +if ($SERVICE_ID) { & python ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./bin/Debug --serviceId $SERVICE_ID } else { & python ../aws-sdk-cpp/tools/scripts/run_integration_tests.py --testDir ./bin/Debug } diff --git a/tools/scripts/run_integration_tests.py b/tools/scripts/run_integration_tests.py index 616afc661e0..5627fc35f55 100644 --- a/tools/scripts/run_integration_tests.py +++ b/tools/scripts/run_integration_tests.py @@ -17,9 +17,11 @@ def parse_arguments(): parser = argparse.ArgumentParser(description="AWSNativeSDK Run all Integration Tests") parser.add_argument("--testDir", action="store") + parser.add_argument("--serviceId", action="store") args = vars(parser.parse_args()) arg_map["testDir"] = args["testDir"] or "./build" + arg_map["serviceId"] = args["serviceId"] or "" return arg_map @@ -35,7 +37,7 @@ def main(): test_has_parent_dir = platform.system() != "Windows" exe_extension = ".exe" if platform.system() == "Windows" else "" - test_list = [ + all_tests = [ "aws-cpp-sdk-core-integration-tests", "aws-cpp-sdk-transcribestreaming-integ-tests", "aws-cpp-sdk-dynamodb-unit-tests", @@ -59,6 +61,21 @@ def main(): "aws-cpp-sdk-bedrock-runtime-integration-tests" ] + if arguments["serviceId"]: + service_ids = arguments["serviceId"].split(",") + test_list = [] + for test in all_tests: + service = test.replace('aws-cpp-sdk-', '').replace('-integration-tests', '').replace('-unit-tests', '').replace('-tests', '') + if service != "core": + for service_id in service_ids: + if service_id == service: + test_list.append(test) + break + else: + test_list.append(test) + else: + test_list = all_tests.copy() + # check for existence of these binaries before adding them to tests # as they will not always be present cmake_dependent_tests = [