Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync main branch with feature/dmlib #4075

Merged
merged 22 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
be4cb8f
Update VCPKG Baseline due to zlib (#4027)
gearama Oct 14, 2022
01254a6
Fixed CURL build breaks discovered by newer openssl baselines (#4034)
LarryOsterman Oct 17, 2022
5f64eea
Vcpkg baseline to latest (#4036)
gearama Oct 18, 2022
378ee6c
Removed version override for opentelemetry (#4037)
LarryOsterman Oct 19, 2022
90f1ff9
Sync eng/common directory with azure-sdk-tools for PR 3790 (#4041)
azure-sdk Oct 20, 2022
fc50c08
Storageblob (#4043)
gearama Oct 21, 2022
5ddcbe8
Upgrade cspell packages to version `^6.12.0` (#4044)
azure-sdk Oct 21, 2022
17a0ad5
Sync eng/common directory with azure-sdk-tools for PR 4480 (#4046)
azure-sdk Oct 24, 2022
6c225cd
Converted WinHTTP to Async. (#4015)
LarryOsterman Oct 24, 2022
66fd7da
Updated OpenTelemetry tests to use their own `SpanExporter` rather th…
LarryOsterman Oct 24, 2022
fd24627
[Perf] Include GA versions of core package (#4053)
mikeharder Oct 25, 2022
34485a7
Fix to for a SAL annotation (#4054)
RickWinter Oct 25, 2022
4de2423
In-memory Identity token cache (#4024)
antkmsft Oct 25, 2022
673bacb
identicalize the comments type (#4063)
gearama Oct 26, 2022
f174d97
Improve scenario matrix edge case handling (#4065)
azure-sdk Oct 26, 2022
4c55046
docV1 (#4051)
gearama Oct 27, 2022
7cc5f46
bump version to newest (#4066)
azure-sdk Oct 27, 2022
214f4a3
Sync eng/common directory with azure-sdk-tools for PR 4543 (#4071)
azure-sdk Oct 28, 2022
bb95a22
Added the ability to select OpenSSL 1.1.1n if desired. (#4045)
LarryOsterman Oct 28, 2022
4c70c2f
Dump out correlation id without verbose logging for resource deployme…
azure-sdk Oct 31, 2022
e9a322d
fix typo in PerformanceTesting.md (#4076)
Jinming-Hu Nov 1, 2022
4e9e92f
Merge remote-tracking branch 'upstream/main' into dmlib-sync
Jinming-Hu Nov 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
".github/CODEOWNERS",
".gitignore",
".vscode/cspell.json",
"vcpkg-custom-ports",
"ci.yml",
"squid.conf*",
"eng/common/**/*",
Expand Down Expand Up @@ -54,6 +55,7 @@
"Deserializes",
"DFETCH",
"DMSVC",
"DVCPKG",
"docfx",
"DPAPI",
"DRUN",
Expand All @@ -73,7 +75,9 @@
"HKEY",
"HRESULT",
"IMDS",
"immutability",
"Intel",
"issecret",
"itfactor",
"iusg",
"jepio",
Expand Down
58 changes: 58 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,64 @@
"name": "MSVC_USE_STATIC_CRT",
"value": "True",
"type": "BOOL"
},
{
"name": "VCPKG_MANIFEST_MODE",
"value": "True",
"type": "BOOL"
}
]
},
{
"name": "x64-DebugWithTests-OpenSSL111",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "-v",
"ctestCommandArgs": "",
"variables": [
{
"name": "VCPKG_TARGET_TRIPLET",
"value": "x64-windows-static",
"type": "STRING"
},
{
"name": "MSVC_USE_STATIC_CRT",
"value": "True",
"type": "BOOL"
},
{
"name": "VCPKG_MANIFEST_MODE",
"value": "True",
"type": "BOOL"
},
{
"name": "VCPKG_OVERLAY_PORTS",
"value": "${projectDir}\\vcpkg-custom-ports",
"type": "STRING"
},
{
"name": "INSTALL_GTEST",
"value": "False",
"type": "BOOL"
},
{
"name": "BUILD_TESTING",
"value": "True",
"type": "BOOL"
},
{
"name": "BUILD_TRANSPORT_CURL",
"value": "True",
"type": "BOOL"
},
{
"name": "BUILD_SAMPLES",
"value": "True",
"type": "BOOL"
}
]
},
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,41 @@ The following SDK library releases are available on [vcpkg](https://github.com/m

> NOTE: In case of getting linker errors when consuming the SDK on Windows, make sure that [vcpkg triplet](https://vcpkg.readthedocs.io/en/latest/users/triplets/) being consumed matches the [CRT link flags](https://docs.microsoft.com/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-160) being set for your app or library build. See also `MSVC_USE_STATIC_CRT` build flag.

## OpenSSL Version

Several packages within the Azure SDK for C++ use the OpenSSL library. By default, the Azure SDK will use whatever the most recent version of OpenSSL is within the VCPKG repository.

If you need to use a specific version of OpenSSL, you can use the vcpkg custom ports feature to specify the version of OpenSSL to use.
For example, if you want to use OpenSSL 1.1.1, you should create a folder named `vcpkg-custom-ports` next to to your vcpkg.json file.

Navigate to your clone of the vcpkg vcpkg repo and execute "git checkout 3b3bd424827a1f7f4813216f6b32b6c61e386b2e" - this will reset your repo to the last version of OpenSSL 1.1.1
in vcpkg. Then, copy the contents of the `ports/openssl` folder from the vcpkg repo to the `vcpkg-custom-ports` folder you created earlier:

```sh
cd <your vcpkg repo>
git checkout 3b3bd424827a1f7f4813216f6b32b6c61e386b2e
cd ports
cp -r openssl <the location of the vcpkg-custom-ports directory listed above>
```

This will copy the port information for OpenSSL 1.1.1n to your vcpkg-custom-ports directory.

Once that is done, you can install the custom port of OpenSSL 1.1.1n using the vcpkg tool:

```sh
vcpkg install --overlay-ports=<path to the vcpkg-custom-ports above>
```

If you are building using CMAKE, you can instruct CMAKE to apply the overlay ports using the following command line switches:

```sh
vcpkg -DVCPKG_MANIFEST_MODE=ON -DVCPKG_OVERLAY_PORTS=<path to the vcpkg-custom-ports above> -DVCPKG_MANIFEST_DIR=<path to the directory containing the vcpkg.json file>
```

In addition, if you need to consume OpenSSL from a dynamic linked library/shared object, you can set the VCPKG triplet to reflect that you want to build the library with dynamic
entries.Set the VCPKG_you can set the environment variable to `x64-windows-static` or `x64-windows-dynamic` depending on whether you want to use the static or dynamic version of OpenSSL.
Similarly you can use the x64-linux-dynamic and x64-linux-static triplet to specify consumption of libraries as a shared object or dynamic.

## Need help

- For reference documentation visit the [Azure SDK for C++ documentation](https://azure.github.io/azure-sdk-for-cpp).
Expand Down
3 changes: 2 additions & 1 deletion cmake-modules/AddGoogleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ macro(add_gtest TESTNAME)
else()
gtest_discover_tests(${TESTNAME}
TEST_PREFIX "${TESTNAME}."
PROPERTIES FOLDER "Tests")
PROPERTIES FOLDER "Tests"
DISCOVERY_TIMEOUT 600)
endif()
else()
add_test(${TESTNAME} ${TESTNAME})
Expand Down
2 changes: 1 addition & 1 deletion cmake-modules/AzureVcpkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ macro(az_vcpkg_integrate)
if(NOT DEFINED ENV{AZURE_SDK_DISABLE_AUTO_VCPKG})
# GET VCPKG FROM SOURCE
# User can set env var AZURE_SDK_VCPKG_COMMIT to pick the VCPKG commit to fetch
set(VCPKG_COMMIT_STRING f0aa678b7471497f1adedcc99f40e1599ad22f69) # default SDK tested commit
set(VCPKG_COMMIT_STRING 6ca56aeb457f033d344a7106cb3f9f1abf8f4e98) # default SDK tested commit
if(DEFINED ENV{AZURE_SDK_VCPKG_COMMIT})
set(VCPKG_COMMIT_STRING "$ENV{AZURE_SDK_VCPKG_COMMIT}") # default SDK tested commit
endif()
Expand Down
11 changes: 11 additions & 0 deletions cmake-modules/PerfTest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
macro(SetPerfDeps PACKAGE VAR_RESULT)
string(TOUPPER ${PACKAGE} SUFFIX)
string(CONCAT VAR_TRIGGER "VCPKG-" ${SUFFIX})
message(STATUS "trigger name ${VAR_TRIGGER}")
if(DEFINED ENV{${VAR_TRIGGER}})
find_package(${PACKAGE} $ENV{${VAR_TRIGGER}} EXACT)
add_compile_definitions(${VAR_RESULT}="$ENV{${VAR_TRIGGER}}")
else()
add_compile_definitions(${VAR_RESULT}="source")
endif()
endmacro()
6 changes: 1 addition & 5 deletions doc/DistributedTracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ in-memory logger.
opentelemetry::nostd::shared_ptr<opentelemetry::trace::TracerProvider>
CreateOpenTelemetryProvider()
{
#if USE_MEMORY_EXPORTER
auto exporter = std::make_unique<opentelemetry::exporter::memory::InMemorySpanExporter>();
#else
auto exporter = std::make_unique<opentelemetry::exporter::trace::OStreamSpanExporter>();
#endif
auto exporter = std::make_unique<MyExporter>();

// simple processor
auto simple_processor = std::unique_ptr<opentelemetry::sdk::trace::SpanProcessor>(
Expand Down
171 changes: 171 additions & 0 deletions doc/PerformanceTesting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# Performance Testing

## Writing a test

Adding tests , at the moment relies in making modifications in a couple of repositories.

## Azure-SDK-For-Cpp repo

E.G. https://github.com/Azure/azure-sdk-for-cpp/tree/main/sdk/storage/azure-storage-blobs

### Location

Performance tests are located under **"test/perf"** folder under the service folder(e.g. alongside ut folder).

The perf test folder should be added in the parent CMakeLists.txt guarded by the **BUILD_PERFORMANCE_TESTS** flag.

E.G.

```markdown

if(BUILD_PERFORMANCE_TESTS)
add_subdirectory(test/perf)
endif()

```

### Structure

As any other CPP project you will need a **CMakeLists.txt** file , along side **src** and **inc** folders

#### Contents of the **inc** directory

Under inc folder create a subfolder structure following your namespace hierarchy ending with another test folder since these are in the ...Test namespace.

E.G. test/perf/inc/azure/storage/blobs/test

The tests are defined in .hpp files under this folder.

##### Test definition

In a .hpp file we define a class that will be contain the tests methods. The class is defined in the ::Test namespace for your service.

The class will inherit from the **PerfTest** base class and will override several methods as follows:
- Constructor(Azure::Perf::TestOptions options) : PerfTest(options)
Options field are passed from the perf test framework and constain the various options defined for running the test.
- void Run(Azure::Core::Context const&) override {...}.
Runs the actual test code. It is strongly recommended that the test code does as little extra work here as possible, it should consist solely of the actual test invocation. The test code should remove all assert, conditional statements ("if"/"else") or any other unnecessary work as any extra work will skew the results.
- std::vector<Azure::Perf::TestOption> GetTestOptions() override
Defines the various parameters for the test run that can be passed to the test from the performance framework. The perf framework uses these params to run various combinations(e.g. blob size)
- static Azure::Perf::TestMetadata GetTestMetadata()
Returns TestMetadate object used to identify the test.

#### Contents of the **src** directory

Contains one cpp file that contains the main method defintion

```cpp
int main(int argc, char** argv)
{
std::cout << "SERVICE VERSION " << VCPKG_SERVICE_VERSION << std::endl;
// Create the test list
std::vector<Azure::Perf::TestMetadata> tests{
Service::Namespace::Test::TestName::GetTestMetadata(),
};

Azure::Perf::Program::Run(Azure::Core::Context::ApplicationContext, tests, argc, argv);

return 0;
}
```

#### CMakeLists.txt

Beyond the regular cmake defintion in your cmake file make sure to add

```makefile
include(AzureVcpkg)
az_vcpkg_integrate()
...
include(PerfTest)
SETPERFDEPS(azure-storage-blobs-cpp VCPKG_SERVICE_VERSION)
```

The crucial part here is the SETPERFDEPS cmake macro.
The perf framework will set an environment variable based on the service name with the value representing a version, thus allowing to run the tests against diffrent VCPKG published versions. If the env is not defined then the test will build against the current source code of the service.
There can be multiple set perf for each dependency of the service ( e.g. identity, storage).

## Pipeline definition
The file should be named `perf.yml`, and should be located in the service directory that is to be tested, for consistency and to keep service related resources in the service folder.

```yml
parameters:
- name: PackageVersions
displayName: PackageVersions (regex of package versions to run)
type: string
default: '12|source'
- name: Tests
displayName: Tests (regex of tests to run)
type: string
default: '^(download|upload|list-blobs)$'
- name: Arguments
displayName: Arguments (regex of arguments to run)
type: string
default: '(10240)|(10485760)|(1073741824)|(5 )|(500 )|(50000 )'
- name: Iterations
displayName: Iterations (times to run each test)
type: number
default: '5'
- name: AdditionalArguments
displayName: AdditionalArguments (passed to PerfAutomation)
type: string
default: ' '

extends:
template: /eng/pipelines/templates/jobs/perf.yml
parameters:
ServiceDirectory: service folder
Services: "^service name$"
PackageVersions: ${{ parameters.PackageVersions }}
Tests: ${{ parameters.Tests }}
Arguments: ${{ parameters.Arguments }}
Iterations: ${{ parameters.Iterations }}
AdditionalArguments: ${{ parameters.AdditionalArguments }}
InstallLanguageSteps:
- pwsh: |
Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azblob,https://cppvcpkgcache.blob.core.windows.net/public-vcpkg-container,,read"
displayName: Set Vcpkg Variables

EnvVars:
# This is set in the InstallLanguageSteps
VCPKG_BINARY_SOURCES_SECRET: $(VCPKG_BINARY_SOURCES_SECRET)

```

The fields of interest here are the parameters:
- Tests which define which test s run in this pipeline ( which tests are available)
- Arguments which allow to filter which subset of parameters are acceptable for the tests from the plurality in the framework
- ServiceDirectory which represents the root folder of the service
- Services which represents the services which these tests target.

## Resources

If the tests require certain resources to exist beforehand the pipeline can deploy them based on the presence of the **perf-resources.bicep** file which will be used to deploy the required resources defined within.

## Azure-SDK-Tools repo

## Location

The performance automation is located under azure-sdk-tools\tools\perf-automation\Azure.Sdk.Tools.PerfAutomation folder.
(https://github.com/Azure/azure-sdk-tools/tree/main/tools/perf-automation/Azure.Sdk.Tools.PerfAutomation)

## Test definition

in the above mentioned folder resided the test defintion file "tests.yml".

### The tests exists in other languages

If the test exists in other languages then making the CPP version visible to the framework requires adding an entry with the name **CPP** under **Service**/**Languages** followed by the packages and versions available for the testing(this ties into the CMakeLists SetPerfDeps macro).

Next under the **Tests**/**Test** node with the desired name add the CPP test name. In this section mind the aArguments list , this ies with the regex in the cpp sdk pipeline.yml definition.

### The test does not exist in other languages

In this case you are the first to add the required nodes. The defintion is fairly simple and straightforward.

## Pipeline

Once you have everything in place create a pipeline using the definition in your in the cpp repo by going to https://dev.azure.com/azure-sdk/internal/_build?definitionScope=%5Cperf and create a new one under the cpp node.

To test intermediate definitions of your pipeline you can run the https://dev.azure.com/azure-sdk/internal/_build?definitionId=5121 pipline and set the proper values for the cpp node( make sure to deselect all other languages except cpp unless you want to run them).

32 changes: 15 additions & 17 deletions eng/common/TestResources/New-TestResources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -723,29 +723,27 @@ try {
Log $msg

$deployment = Retry {
$lastDebugPreference = $DebugPreference
try {
if ($CI) {
$DebugPreference = 'Continue'
}
New-AzResourceGroupDeployment -Name $BaseName -ResourceGroupName $resourceGroup.ResourceGroupName -TemplateFile $templateFile.jsonFilePath -TemplateParameterObject $templateFileParameters -Force:$Force
} catch {
Write-Output @'
New-AzResourceGroupDeployment `
-Name $BaseName `
-ResourceGroupName $resourceGroup.ResourceGroupName `
-TemplateFile $templateFile.jsonFilePath `
-TemplateParameterObject $templateFileParameters `
-Force:$Force
}

if ($deployment.ProvisioningState -ne 'Succeeded') {
Write-Host "Deployment '$($deployment.DeploymentName)' has state '$($deployment.ProvisioningState)' with CorrelationId '$($deployment.CorrelationId)'. Exiting..."
Write-Host @'
#####################################################
# For help debugging live test provisioning issues, #
# see http://aka.ms/azsdk/engsys/live-test-help, #
# see http://aka.ms/azsdk/engsys/live-test-help #
#####################################################
'@
throw
} finally {
$DebugPreference = $lastDebugPreference
}
exit 1
}

if ($deployment.ProvisioningState -eq 'Succeeded') {
# New-AzResourceGroupDeployment would've written an error and stopped the pipeline by default anyway.
Write-Verbose "Successfully deployed template '$($templateFile.jsonFilePath)' to resource group '$($resourceGroup.ResourceGroupName)'"
}
Write-Host "Deployment '$($deployment.DeploymentName)' has CorrelationId '$($deployment.CorrelationId)'"
Write-Host "Successfully deployed template '$($templateFile.jsonFilePath)' to resource group '$($resourceGroup.ResourceGroupName)'"

$deploymentOutputs = SetDeploymentOutputs $serviceName $context $deployment $templateFile

Expand Down
Loading