ignore result of function to compile on G++ 5 (#2784)

* ignore result of function

* changelog

* Add g++5 to CI legs

* use inline config for g++ 5

* update flag

* set default values for variables

* fix format
This commit is contained in:
Victor Vazquez 2021-08-24 15:55:46 -07:00 committed by GitHub
parent 28d7a22fbd
commit 49636a2f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 2 deletions

View File

@ -26,6 +26,15 @@ jobs:
condition: and(succeededOrFailed(), ne(variables['Skip.Test'], 'true'))
strategy:
matrix:
Linux_x64_gcc5:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
VcpkgInstall: 'curl[ssl] libxml2 openssl'
VCPKG_DEFAULT_TRIPLET: 'x64-linux'
# Can't set CC and CXX to env because it would affect VCPKG building which requires g++ > 7
# So, this conf will set the CXX for cmake inline.
CmakeEnvArg: 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake'
BuildArgs: '-j 4'
Linux_x64_gcc8:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
@ -138,6 +147,10 @@ jobs:
value: "xml"
- name: BuildArgs
value: ""
- name: CmakeEnvArg
value: ""
- name: CmakeArgs
value: ""
steps:
- checkout: self
@ -147,6 +160,26 @@ jobs:
parameters:
AgentImage: $(OSVmImage)
# Add g++5 repo to ubuntu
- bash: sudo sh -c "echo 'deb http://ftp.debian.org/debian/ stretch main' >> /etc/apt/sources.list"
displayName: Add g++ 5
condition: >-
and(
succeeded(),
contains(variables['OSVmImage'], 'Ubuntu'),
contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake')
)
# Install g++5
- bash: sudo apt-get update & sudo apt-get install g++-5
displayName: Install g++ 5
condition: >-
and(
succeeded(),
contains(variables['OSVmImage'], 'Ubuntu'),
contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake')
)
# Install gcc and g++ 8 if it is needed on the image.
- bash: sudo apt-get install gcc-8 g++-8 -y
displayName: Install gcc and g++ 8
@ -211,6 +244,7 @@ jobs:
parameters:
GenerateArgs: "$(CmakeArgs)"
BuildArgs: "$(BuildArgs)"
Env: "$(CmakeEnvArg)"
- script: ctest -C Debug -V --tests-regex ${{ parameters.CtestRegex }}
workingDirectory: build

View File

@ -27,6 +27,16 @@ jobs:
timeoutInMinutes: ${{ parameters.TimeoutInMinutes }}
strategy:
matrix:
Linux_x64_gcc5_with_unit_test:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
VcpkgInstall: 'curl[ssl] libxml2 openssl'
VCPKG_DEFAULT_TRIPLET: 'x64-linux'
# Can't set CC and CXX to env because it would affect VCPKG building which requires g++ > 7
# So, this conf will set the CXX for cmake inline.
CmakeEnvArg: 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake'
BuildArgs: '-j 4'
CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON'
Linux_x64_with_unit_test:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
@ -105,6 +115,9 @@ jobs:
CMOCKA_MESSAGE_OUTPUT: "xml"
AZURE_ENABLE_STATIC_ANALYSIS: 1
AZURE_KEYVAULT_AVOID_THROTTLED: 1
BuildArgs: ""
CmakeEnvArg: ""
CmakeArgs: ""
steps:
- checkout: self
@ -116,6 +129,26 @@ jobs:
- template: /eng/common/pipelines/templates/steps/bypass-local-dns.yml
# Add g++5 repo to ubuntu
- bash: sudo sh -c "echo 'deb http://ftp.debian.org/debian/ stretch main' >> /etc/apt/sources.list"
displayName: Add g++ 5
condition: >-
and(
succeeded(),
contains(variables['OSVmImage'], 'Ubuntu'),
contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake')
)
# Install g++5
- bash: sudo apt-get update & sudo apt-get install g++-5
displayName: Install g++ 5
condition: >-
and(
succeeded(),
contains(variables['OSVmImage'], 'Ubuntu'),
contains(variables['CmakeEnvArg'], 'CC=/usr/bin/gcc-5 CXX=/usr/bin/g++-5 cmake')
)
# Install apt dependencies (if appropriate)
- bash: sudo apt install -y $(AptDependencies)
condition: and(succeededOrFailed(), ne(variables['AptDependencies'], ''))
@ -137,6 +170,7 @@ jobs:
parameters:
GenerateArgs: $(CmakeArgs)
BuildArgs: "$(BuildArgs)"
Env: "$(CmakeEnvArg)"
- template: /eng/common/TestResources/deploy-test-resources.yml
parameters:

View File

@ -1,4 +1,5 @@
parameters:
Env: ''
GenerateArgs: ''
Build: true
BuildArgs: ''
@ -12,7 +13,7 @@ steps:
workingDirectory: build
displayName: cmake --version
- script: cmake ${{ parameters.GenerateArgs }} ..
- script: ${{ parameters.Env }} cmake ${{ parameters.GenerateArgs }} ..
workingDirectory: build
displayName: cmake generate

View File

@ -8,6 +8,8 @@
### Bugs Fixed
- [2785](https://github.com/Azure/azure-sdk-for-cpp/issues/2785) Fix to build on g++ 5.5.
### Other Changes
- Fixed compilation error on POSIX platforms where OpenSSL was not available.

View File

@ -64,7 +64,7 @@ namespace Azure { namespace Core {
bio = BIO_push(BIO_new(BIO_f_base64()), bio);
BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
BIO_write(bio, data.data(), static_cast<int>(data.size()));
BIO_flush(bio);
(void)BIO_flush(bio);
BUF_MEM* bufferPtr;
BIO_get_mem_ptr(bio, &bufferPtr);
std::string toReturn(bufferPtr->data, bufferPtr->length);