Skip to content

Commit

Permalink
fix(ci): Fix azure pipeline builds (open62541#3674)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pro authored Jun 5, 2020
1 parent 174e655 commit ba5cf14
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .azure-pipelines/azure-pipelines-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:

- powershell: ./tools/azure-devops/win/install.ps1
displayName: Install Requirements
errorActionPreference: continue # Errors are handled in the script
- powershell: ./tools/azure-devops/win/build.ps1
displayName: "Build: $(CC_NAME)"
errorActionPreference: continue # If set to Stop, we only get a truncated exception message. Error is handled by checking exit code
Expand Down Expand Up @@ -83,6 +84,7 @@ jobs:

- powershell: ./tools/azure-devops/win/install.ps1
displayName: Install Requirements
errorActionPreference: continue # Errors are handled in the script
- powershell: ./tools/azure-devops/win/build.ps1
displayName: "Build: $(CC_NAME)"
errorActionPreference: continue # If set to Stop, we only get a truncated exception message. Error is handled by checking exit code
Expand Down
4 changes: 4 additions & 0 deletions src/pubsub/ua_pubsub_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,10 @@ UA_Server_addDataSetWriter(UA_Server *server,
return UA_STATUSCODE_BADOUTOFMEMORY;
}
newDataSetWriter->lastSamplesCount = currentDataSetContext->fieldSize;
for(size_t i = 0; i < newDataSetWriter->lastSamplesCount; i++) {
UA_DataValue_init(&newDataSetWriter->lastSamples[i].value);
newDataSetWriter->lastSamples[i].valueChanged = false;
}
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,11 @@ if(UA_ENABLE_PUBSUB)
if(UA_ENABLE_PUBSUB_INFORMATIONMODEL)
add_executable(check_pubsub_informationmodel pubsub/check_pubsub_informationmodel.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-plugins>)
target_link_libraries(check_pubsub_informationmodel ${LIBS})
add_test(check_pubsub_informationmodel ${TESTS_BINARY_DIR}/check_pubsub_informationmodel)
add_test_valgrind(check_pubsub_informationmodel ${TESTS_BINARY_DIR}/check_pubsub_informationmodel)
if(UA_ENABLE_PUBSUB_INFORMATIONMODEL_METHODS)
add_executable(check_pubsub_informationmodel_methods pubsub/check_pubsub_informationmodel_methods.c $<TARGET_OBJECTS:open62541-object> $<TARGET_OBJECTS:open62541-plugins>)
target_link_libraries(check_pubsub_informationmodel_methods ${LIBS})
add_test(check_pubsub_informationmodel_methods ${TESTS_BINARY_DIR}/check_pubsub_informationmodel_methods)
add_test_valgrind(check_pubsub_informationmodel_methods ${TESTS_BINARY_DIR}/check_pubsub_informationmodel_methods)

endif()
endif()
Expand Down
6 changes: 4 additions & 2 deletions tests/client/check_client_subscriptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ static void setup(void) {
}

static void teardown(void) {
running = false;
THREAD_JOIN(server_thread);
if (running) {
running = false;
THREAD_JOIN(server_thread);
}
UA_Server_run_shutdown(server);
UA_Server_delete(server);
}
Expand Down
68 changes: 36 additions & 32 deletions tools/azure-devops/win/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,40 @@ try {
Copy-Item AUTHORS pack
Copy-Item README.md pack

# Only execute unit tests on vs2017 to save compilation time
if ($env:CC_SHORTNAME -eq "vs2017") {
Write-Host -ForegroundColor Green "`n###################################################################"
Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with unit tests #####`n"
New-Item -ItemType directory -Path "build"
cd build
& cmake $cmake_cnf `
-DBUILD_SHARED_LIBS:BOOL=OFF `
-DCMAKE_BUILD_TYPE=Debug `
-DUA_BUILD_EXAMPLES=OFF `
-DUA_BUILD_UNIT_TESTS=ON `
-DUA_ENABLE_DA=ON `
-DUA_ENABLE_DISCOVERY=ON `
-DUA_ENABLE_DISCOVERY_MULTICAST=ON `
-DUA_ENABLE_ENCRYPTION:BOOL=$build_encryption `
-DUA_ENABLE_JSON_ENCODING:BOOL=ON `
-DUA_ENABLE_PUBSUB:BOOL=ON `
-DUA_ENABLE_PUBSUB_DELTAFRAMES:BOOL=ON `
-DUA_ENABLE_PUBSUB_INFORMATIONMODEL:BOOL=ON `
-DUA_ENABLE_UNIT_TESTS_MEMCHECK=ON ..
& cmake --build . --config Debug
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
exit $LASTEXITCODE
}
& cmake --build . --target test-verbose --config Debug -j 1
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
exit $LASTEXITCODE
}
cd ..
Remove-Item -Path build -Recurse -Force
}

Write-Host -ForegroundColor Green "`n###################################################################"
Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with amalgamation #####`n"
New-Item -ItemType directory -Path "build"
Expand All @@ -55,6 +89,7 @@ try {
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
-DUA_BUILD_EXAMPLES:BOOL=OFF `
-DUA_ENABLE_AMALGAMATION:BOOL=ON `
-DUA_ENABLE_SUBSCRIPTIONS_EVENTS:BOOL=ON `
-DUA_ENABLE_ENCRYPTION:BOOL=$build_encryption ..
& cmake --build . --config RelWithDebInfo
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Expand All @@ -79,7 +114,7 @@ try {
-DUA_ENABLE_PUBSUB_INFORMATIONMODEL:BOOL=ON `
-DUA_ENABLE_SUBSCRIPTIONS_EVENTS:BOOL=ON `
-DUA_NAMESPACE_ZERO:STRING=FULL ..
& cmake --build . --config RelWithDebInfo
& cmake --build . --config Debug
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
exit $LASTEXITCODE
Expand Down Expand Up @@ -137,37 +172,6 @@ try {
}
Remove-Item -Path build -Recurse -Force

# Only execute unit tests on vs2017 to save compilation time
if ($env:CC_SHORTNAME -eq "vs2017") {
Write-Host -ForegroundColor Green "`n###################################################################"
Write-Host -ForegroundColor Green "`n##### Testing $env:CC_NAME with unit tests #####`n"
New-Item -ItemType directory -Path "build"
cd build
& cmake $cmake_cnf `
-DBUILD_SHARED_LIBS:BOOL=OFF `
-DCMAKE_BUILD_TYPE=Debug `
-DUA_BUILD_EXAMPLES=OFF `
-DUA_BUILD_UNIT_TESTS=ON `
-DUA_ENABLE_DA=ON `
-DUA_ENABLE_DISCOVERY=ON `
-DUA_ENABLE_DISCOVERY_MULTICAST=ON `
-DUA_ENABLE_ENCRYPTION:BOOL=$build_encryption `
-DUA_ENABLE_JSON_ENCODING:BOOL=ON `
-DUA_ENABLE_PUBSUB:BOOL=ON `
-DUA_ENABLE_PUBSUB_DELTAFRAMES:BOOL=ON `
-DUA_ENABLE_PUBSUB_INFORMATIONMODEL:BOOL=ON `
-DUA_ENABLE_UNIT_TESTS_MEMCHECK=ON ..
& cmake --build . --config Debug
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
exit $LASTEXITCODE
}
& cmake --build . --target test-verbose --config Debug
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Make failed. Exiting ... ***"
exit $LASTEXITCODE
}
}

# # do not cache log
# Remove-Item -Path c:\miktex\texmfs\data\miktex\log -Recurse -Force
Expand Down
41 changes: 29 additions & 12 deletions tools/azure-devops/win/install.ps1
Original file line number Diff line number Diff line change
@@ -1,36 +1,53 @@
$ErrorActionPreference = "Stop"

try {

Write-Host -ForegroundColor Green "`n### Installing sphinx ###`n"
& choco install -y sphinx --no-progress --source python
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Install failed. Exiting ... ***"
exit $LASTEXITCODE
}

if ($env:CC_SHORTNAME -eq "mingw" -or $env:CC_SHORTNAME -eq "clang-mingw") {
Write-Host -ForegroundColor Green "`n### Installing msys64 ###`n"
# Install specific version of msys2. See https://github.com/open62541/open62541/issues/3233
& choco install -y msys2 --version 20180531.0.0 --no-progress --params="/InstallDir:$env:MSYS2_ROOT /NoUpdate /NoPath"
& choco install -y msys2 --no-progress --params="/InstallDir:$env:MSYS2_ROOT /NoUpdate /NoPath"
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Install failed. Exiting ... ***"
exit $LASTEXITCODE
}

Write-Host -ForegroundColor Green "`n### Installing mbedtls via PacMan ###`n"
# pacman may complain that the directory does not exist, thus create it.
# See https://github.com/open62541/open62541/issues/2068
& C:\msys64\usr\bin\mkdir -p /var/cache/pacman/pkg
& cmd /c 'C:\\msys64\\usr\\bin\\pacman 2>&1' --noconfirm --needed -S mingw-w64-x86_64-mbedtls
& C:\msys64\usr\bin\pacman --noconfirm --needed -S mingw-w64-x86_64-mbedtls
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Install failed. Exiting ... ***"
exit $LASTEXITCODE
}

Write-Host -ForegroundColor Green "`n### Installing clang via PacMan ###`n"
& cmd /c 'C:\\msys64\\usr\\bin\\pacman 2>&1' --noconfirm --needed -S mingw-w64-x86_64-clang mingw-w64-i686-clang
} elseif ($env:CC_SHORTNAME -eq "vs2015" -or $env:CC_SHORTNAME -eq "vs2017") {
Write-Host -ForegroundColor Green "`n### Installing mbedtls via vcpkg ###`n"
& vcpkg install mbedtls:x86-windows-static
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Install failed. Exiting ... ***"
exit $LASTEXITCODE
}

Write-Host -ForegroundColor Green "`n### Installing libcheck via vcpkg ###`n"
& vcpkg install check:x86-windows-static
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Install failed. Exiting ... ***"
exit $LASTEXITCODE
}

Write-Host -ForegroundColor Green "`n### Installing DrMemory ###`n"
# 12. March 2020: Hardcode Dr Memory Version to 2.2. Otherwise it fails with
# "Failed to take over all threads after multiple attempts."
# See: https://dev.azure.com/open62541/open62541/_build/results?buildId=1242&view=logs&j=0690d606-4da6-5fc6-313c-2fce474be087&t=6290dcff-a4f0-5630-9345-7cbc0279a890&l=1871
& choco install -y --no-progress drmemory.portable --version 2.2.0
$env:Path = 'C:\Program Files (x86)\Dr. Memory\bin;' + $env:Path
& choco install -y --no-progress drmemory.portable
if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Write-Host -ForegroundColor Red "`n`n*** Install failed. Exiting ... ***"
exit $LASTEXITCODE
}
#$env:Path = 'C:\Program Files (x86)\Dr. Memory\bin;' + $env:Path
#[System.Environment]::SetEnvironmentVariable('Path', $path, 'Machine')
}

if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
Expand Down

0 comments on commit ba5cf14

Please sign in to comment.