Skip to content

Commit

Permalink
Update uAMQP vendor (#393)
Browse files Browse the repository at this point in the history
* changes from uAMQP

* update version & changelog

* use federated auth to deploy eh/sb test resources

* update macos to latest in livetests

* [temp] test adding serviceConnection to livetest yml

* move workingDirectory to inputs in test yml

* temp - comment out more tests

* typo

* remove client id/tenant id/client secret vars

* update run tests to use pwsh @ 5 and set system access token

* fix bug

* update azure subscription

* more logging

* replace >- with |

* uncomment tests

* skip most tests, add logging

* add correct logging

* [temp] get logging from modified sdk test branch

* address bens comment

* [temp] bump up timeout time to get logs from run

* change back inline set subscription id envvar

* test w/o pyamqp

* skip pyamqp

* add envvar back inline

* fix

* change back temp updates, run all live tests + builds

* reset timeout

* update sdk macos to latest image

* remove patch in macos python whl name for sdk run

* remove release date

---------

Co-authored-by: swathipil <swathip@microsoft.com>
  • Loading branch information
kashifkhan and swathipil authored Aug 26, 2024
1 parent 69c6acf commit b0b4ee4
Show file tree
Hide file tree
Showing 13 changed files with 295 additions and 142 deletions.
15 changes: 7 additions & 8 deletions .azure-pipelines/client.test.live.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
dependsOn: 'Windows'

pool:
vmImage: 'macOS-11'
vmImage: 'macos-latest'

strategy:
maxParallel: 1
Expand Down Expand Up @@ -192,7 +192,7 @@ jobs:
python -m pip --version
python -m pip install --user -r dev_requirements.txt
displayName: 'Install dependencies'
- bash: |
set -o errexit
python -m pip install cibuildwheel==2.16.2 --force
Expand Down Expand Up @@ -345,7 +345,7 @@ jobs:
artifactName: uamqp-linux-$(PythonVersion)-whl
pathToPublish: 'dist'

- job: 'SDK_LiveTest_windows2019_37'
- job: 'SDK_LiveTest_windows2019'
timeoutInMinutes: 300
dependsOn: 'Windows'
pool:
Expand Down Expand Up @@ -376,12 +376,12 @@ jobs:
versionSpec: '$(PythonVersion)'
- template: /.azure-pipelines/test-eh-sb-sdk.yml

- job: 'SDK_LiveTest_macOS1015_38'
- job: 'SDK_LiveTest_macOS1015'
timeoutInMinutes: 300
dependsOn: 'MacOS'
pool:
name: 'Azure Pipelines'
vmImage: 'macOS-11'
vmImage: 'macos-latest'
strategy:
matrix:
EventHub Python 3.12:
Expand All @@ -390,9 +390,8 @@ jobs:
SDK: 'ServiceBus'
variables:
PythonBin: 'python3'
PythonVersion: '3.12.0'
PythonVersion: '3.12'
MacOSXDeploymentTarget: '10.9'
PythonVersion382: '3.12'
OSArch: 'MacOS'
DownloadArtifactFolder: 'uamqp-macosx$(MacOSXDeploymentTarget)-$(PythonVersion)-whl'
steps:
Expand All @@ -401,7 +400,7 @@ jobs:
versionSpec: '$(PythonVersion)'
- template: /.azure-pipelines/test-eh-sb-sdk.yml

- job: 'SDK_LiveTest_ubuntu1804_39'
- job: 'SDK_LiveTest_ubuntu1804'
timeoutInMinutes: 300
dependsOn: 'Linux'
pool:
Expand Down
168 changes: 103 additions & 65 deletions .azure-pipelines/test-eh-sb-sdk.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,70 @@
steps:
- pwsh: |
$EHSdkPath='azure-sdk-for-python/sdk/eventhub/azure-eventhub'
$EHTestResultsPath='eventhub/azure-eventhub/test-results-live.xml'
$EHIgnoreTests='--ignore=tests/perfstress_tests --ignore=tests/scripts'
$EHSdkType='eventhub'
Write-Output "##vso[task.setvariable variable=SdkType;]$EHSdkType"
Write-Output "##vso[task.setvariable variable=SdkPath;]$EHSdkPath"
Write-Output "##vso[task.setvariable variable=TestResultsPath;]$EHTestResultsPath"
Write-Output "##vso[task.setvariable variable=IgnoreTests;]$EHIgnoreTests"
condition: eq(variables['SDK'], 'EventHub')
- task: AzurePowerShell@5
displayName: 'Get variables if EventHub'
- pwsh: |
$SBSdkPath='azure-sdk-for-python/sdk/servicebus/azure-servicebus'
$SBTestResultsPath='servicebus/azure-servicebus/test-results-live.xml'
$SBIgnoreTests='--ignore=tests/perf_tests --ignore=tests/stress_tests'
$SBSdkType='servicebus'
Write-Output "##vso[task.setvariable variable=SdkType;]$SBSdkType"
Write-Output "##vso[task.setvariable variable=SdkPath;]$SBSdkPath"
Write-Output "##vso[task.setvariable variable=TestResultsPath;]$SBTestResultsPath"
Write-Output "##vso[task.setvariable variable=IgnoreTests;]$SBIgnoreTests"
condition: eq(variables['SDK'], 'ServiceBus')
condition: eq(variables['SDK'], 'EventHub')
inputs:
azureSubscription: azure-sdk-tests
ScriptType: InlineScript
azurePowerShellVersion: LatestVersion
pwsh: true
Inline: |
$EHSdkPath='azure-sdk-for-python/sdk/eventhub/azure-eventhub'
$EHTestResultsPath='eventhub/azure-eventhub/test-results-live.xml'
$EHIgnoreTests='--ignore=tests/perfstress_tests --ignore=tests/scripts'
$EHSdkType='eventhub'
Write-Output "##vso[task.setvariable variable=SdkType;]$EHSdkType"
Write-Output "##vso[task.setvariable variable=SdkPath;]$EHSdkPath"
Write-Output "##vso[task.setvariable variable=TestResultsPath;]$EHTestResultsPath"
Write-Output "##vso[task.setvariable variable=IgnoreTests;]$EHIgnoreTests"
- task: AzurePowerShell@5
displayName: 'Get variables if ServiceBus'
condition: eq(variables['SDK'], 'ServiceBus')
inputs:
azureSubscription: azure-sdk-tests
ScriptType: InlineScript
azurePowerShellVersion: LatestVersion
pwsh: true
Inline: |
$SBSdkPath='azure-sdk-for-python/sdk/servicebus/azure-servicebus'
$SBTestResultsPath='servicebus/azure-servicebus/test-results-live.xml'
$SBIgnoreTests='--ignore=tests/perf_tests --ignore=tests/stress_tests'
$SBSdkType='servicebus'
Write-Output "##vso[task.setvariable variable=SdkType;]$SBSdkType"
Write-Output "##vso[task.setvariable variable=SdkPath;]$SBSdkPath"
Write-Output "##vso[task.setvariable variable=TestResultsPath;]$SBTestResultsPath"
Write-Output "##vso[task.setvariable variable=IgnoreTests;]$SBIgnoreTests"
- script: |
echo "SDKPath: $(SdkPath)"
echo "Tests: $(TestResultsPath)"
git clone https://github.com/Azure/azure-sdk-for-python.git --single-branch --depth 1
displayName: 'Clone azure-sdk-for-python'
- pwsh: |
eng/common/scripts/Import-AzModules.ps1
- task: AzurePowerShell@5
inputs:
workingDirectory: azure-sdk-for-python
azureSubscription: azure-sdk-tests
azurePowerShellVersion: LatestVersion
pwsh: True
ScriptType: InlineScript
Inline: |
eng/common/scripts/Import-AzModules.ps1
$subscriptionConfiguration = @'
$(sub-config-azure-cloud-test-resources)
'@ | ConvertFrom-Json -AsHashtable;
$subscriptionConfiguration = @'
$(sub-config-azure-cloud-test-resources)
'@ | ConvertFrom-Json -AsHashtable;
eng/common/TestResources/New-TestResources.ps1 `
-ResourceType test `
-ServiceDirectory $(SDKType) `
-Location westus `
-DeleteAfterHours 8 `
@subscriptionConfiguration `
-CI `
-Force `
-Verbose | Out-Null
workingDirectory: azure-sdk-for-python
eng/common/TestResources/New-TestResources.ps1 `
-ResourceType test `
-ServiceDirectory $(SDKType) `
-Location westus `
-DeleteAfterHours 8 `
@subscriptionConfiguration `
-CI `
-Force `
-Verbose | Out-Null
displayName: Deploy test resources
env:
TEMP: $(Agent.TempDirectory)
PoolSubnet: $(PoolSubnet)
- task: DownloadPipelineArtifact@2
displayName: 'Downloading artifact'
inputs:
Expand All @@ -61,40 +80,59 @@ steps:
runProxy: true
rootFolder: azure-sdk-for-python
templateRoot: azure-sdk-for-python
- script: |
python --version
echo "Installing $DownloadArtifactWhl"
echo "Full name $(Pipeline.Workspace)/$(DownloadArtifactFolder)/$(DownloadArtifactWhl)"
python -m pip install $(Pipeline.Workspace)/$(DownloadArtifactFolder)/$(DownloadArtifactWhl) --force
python -m pip install pytest
cd $(SdkPath)
python -m pip install futures
python -m pip install .
python -m pip install -r dev_requirements.txt
python -m pip list
python -m pytest tests -v --doctest-modules $(IgnoreTests) --junitxml=junit/$(TestResultsPath)
displayName: 'Run tests'
- task: AzurePowerShell@5
displayName: Run Tests (AzurePowerShell@5)
env:
AZURE_SUBSCRIPTION_ID: $(azure-subscription-id)
AZURE_TENANT_ID: $(aad-azure-sdk-test-tenant-id)
AZURE_CLIENT_ID: $(aad-azure-sdk-test-client-id)
AZURE_CLIENT_SECRET: $(aad-azure-sdk-test-client-secret)
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
AZURE_TEST_RUN_LIVE: 'true'
- pwsh: |
eng/common/scripts/Import-AzModules.ps1
TEST_PYAMQP: 'false'
inputs:
azureSubscription: azure-sdk-tests
azurePowerShellVersion: LatestVersion
pwsh: true
ScriptType: InlineScript
Inline: |
$account = (Get-AzContext).Account;
$env:AZURESUBSCRIPTION_CLIENT_ID = $account.Id;
$env:AZURESUBSCRIPTION_TENANT_ID = $account.Tenants;
$env:AZURE_SUBSCRIPTION_ID = (Get-AzContext).Subscription.Id;
Write-Host (Get-Command python).Source
python --version
echo "Installing $DownloadArtifactWhl"
echo "Full name $(Pipeline.Workspace)/$(DownloadArtifactFolder)/$(DownloadArtifactWhl)"
python -m pip install $(Pipeline.Workspace)/$(DownloadArtifactFolder)/$(DownloadArtifactWhl) --force
python -m pip install pytest
cd $(SdkPath)
python -m pip install futures
python -m pip install .
python -m pip install -r dev_requirements.txt
python -m pip list
python -m pytest tests -v --doctest-modules $(IgnoreTests) --junitxml=junit/$(TestResultsPath)
Write-Host "Last exit code: $LASTEXITCODE";
exit $LASTEXITCODE;
- task: AzurePowerShell@5
inputs:
workingDirectory: azure-sdk-for-python
azureSubscription: azure-sdk-tests
azurePowerShellVersion: LatestVersion
pwsh: True
ScriptType: InlineScript
Inline: |
eng/common/scripts/Import-AzModules.ps1
$subscriptionConfiguration = @'
$(sub-config-azure-cloud-test-resources)
'@ | ConvertFrom-Json -AsHashtable;
$subscriptionConfiguration = @'
$(sub-config-azure-cloud-test-resources)
'@ | ConvertFrom-Json -AsHashtable;
eng/common/TestResources/Remove-TestResources.ps1 `
@subscriptionConfiguration `
-ResourceType test `
-ServiceDirectory $(SDKType) `
-CI `
-Force `
-Verbose
workingDirectory: azure-sdk-for-python
eng/common/TestResources/Remove-TestResources.ps1 `
@subscriptionConfiguration `
-ResourceType test `
-ServiceDirectory $(SDKType) `
-CI `
-Force `
-Verbose
displayName: Remove test resources
condition: and(eq(variables['CI_HAS_DEPLOYED_RESOURCES'], 'true'), ne(variables['Skip.RemoveTestResources'], 'true'))
continueOnError: true
Expand Down
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Release History
===============
1.6.10 (Unreleased)
+++++++++++++++++++

- Incorporate fixes from `PR <https://github.com/Azure/azure-sdk-for-cpp/pull/5917>`__ to update vendor uamqp code.

1.6.9 (2024-03-20)
+++++++++++++++++++

Expand Down
10 changes: 7 additions & 3 deletions src/vendor/azure-uamqp-c/src/amqp_frame_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "azure_uamqp_c/amqp_frame_codec.h"
#include "azure_uamqp_c/frame_codec.h"
#include "azure_uamqp_c/amqpvalue.h"
#include "azure_c_shared_utility/safe_math.h"

typedef enum AMQP_FRAME_DECODE_STATE_TAG
{
Expand Down Expand Up @@ -274,10 +275,13 @@ int amqp_frame_codec_encode_frame(AMQP_FRAME_CODEC_HANDLE amqp_frame_codec, uint
}
else
{
PAYLOAD* new_payloads = (PAYLOAD*)calloc(1, (sizeof(PAYLOAD) * (payload_count + 1)));
if (new_payloads == NULL)
PAYLOAD* new_payloads;
size_t calloc_size = safe_add_size_t(payload_count, 1);
calloc_size = safe_multiply_size_t(calloc_size, sizeof(PAYLOAD));
if (calloc_size == SIZE_MAX ||
(new_payloads = (PAYLOAD*)calloc(1, calloc_size)) == NULL)
{
LogError("Could not allocate frame payloads");
LogError("Could not allocate frame payloads, size:%zu", calloc_size);
result = MU_FAILURE;
}
else
Expand Down
Loading

0 comments on commit b0b4ee4

Please sign in to comment.