Skip to content

Commit eb958fb

Browse files
authored
Move to devops hosted agent (#539)
* Test windows hosted agent * Update CMakeLists.txt * Update CMakeLists.txt * generate c++ wrappers * added generate_c_wrapper * supress 4505 * fix 4505 warning * vsprintf_wchar_with_empty_string_succeeds test * fixed warnings and x64 build * fix unix build * fix guid tests * fix win32 unit test * putback compile_c_test_artifacts_as directive * added back compile_c_test_artifacts_as * fixed uniqueid_ut_test_file * default use_cppunittest to off x64 build will enable it to test both c and cpp unit tests * fix cmake warnings * move to cmake v3.5 * update to use our 1es agents * pr feedback * remove guid comment * fixed EOF
1 parent 74f8c80 commit eb958fb

File tree

79 files changed

+183
-274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+183
-274
lines changed

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
if (TARGET aziotsharedutil)
77
RETURN()
@@ -26,7 +26,7 @@ option(use_default_uuid "set use_default_uuid to ON to use the out of the box UU
2626
option(run_e2e_tests "set run_e2e_tests to ON to run e2e tests (default is OFF). Chsare dutility does not have any e2e tests, but the option needs to exist to evaluate in IF statements" OFF)
2727
option(run_int_tests "set run_int_tests to ON to integration tests (default is OFF)." OFF)
2828
option(use_builtin_httpapi "set use_builtin_httpapi to ON to use the built-in httpapi_compact that comes with C shared utility (default is OFF)" OFF)
29-
option(use_cppunittest "set use_cppunittest to ON to build CppUnitTest tests on Windows (default is ON)" ON)
29+
option(use_cppunittest "set use_cppunittest to ON to build CppUnitTest tests on Windows (default is OFF)" OFF)
3030
option(suppress_header_searches "do not try to find headers - used when compiler check will fail" OFF)
3131
option(use_custom_heap "use externally defined heap functions instead of the malloc family" OFF)
3232

adapters/string_utils.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ IMPLEMENT_MOCKABLE_FUNCTION(, char*, vsprintf_char, const char*, format, va_list
2424
}
2525
else
2626
{
27-
result = (char*)malloc((neededSize + 1) * sizeof(char));
27+
result = (char*)malloc(((unsigned long long)neededSize + 1) * sizeof(char));
2828
if (result == NULL)
2929
{
3030
LogError("failure in malloc");
3131
/*return as is*/
3232
}
3333
else
3434
{
35-
if (vsnprintf(result, neededSize + 1, format, va) != neededSize)
35+
if (vsnprintf(result, (unsigned long long)neededSize + 1, format, va) != neededSize)
3636
{
3737
LogError("inconsistent vsnprintf behavior");
3838
free(result);
@@ -54,15 +54,15 @@ IMPLEMENT_MOCKABLE_FUNCTION(, wchar_t*, vsprintf_wchar, const wchar_t*, format,
5454
}
5555
else
5656
{
57-
result = (wchar_t*)malloc((neededSize + 1)*sizeof(wchar_t));
57+
result = (wchar_t*)malloc(((unsigned long long)neededSize + 1)*sizeof(wchar_t));
5858
if (result == NULL)
5959
{
6060
LogError("failure in malloc");
6161
/*return as is*/
6262
}
6363
else
6464
{
65-
if (vswprintf(result, neededSize + 1, format, va) != neededSize)
65+
if (vswprintf(result, (unsigned long long)neededSize + 1, format, va) != neededSize)
6666
{
6767
LogError("inconsistent vswprintf behavior");
6868
free(result);

build/.vsts-ci.yml

+22-14
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ jobs:
2323
displayName: 'build'
2424
- job: windowsx86
2525
pool:
26-
name: 'aziotbld-win03'
26+
vmImage: 'vs2017-win2016'
2727
steps:
2828
- script: |
2929
if exist jenkins\windows_c.cmd (
30-
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
30+
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
3131
call jenkins\windows_c.cmd)
3232
displayName: 'build'
3333
env:
@@ -51,7 +51,8 @@ jobs:
5151
- job: raspberrypi
5252
variables:
5353
_PREVIEW_VSTS_DOCKER_IMAGE: "aziotbld/raspberrypi-c-buster:brown"
54-
pool: aziotbld-lin01
54+
pool:
55+
name: 'sdk-c--ubuntu-18'
5556
displayName: raspberrypi
5657
steps:
5758
- script: |
@@ -63,7 +64,8 @@ jobs:
6364
- job: linuxoptions
6465
variables:
6566
_PREVIEW_VSTS_DOCKER_IMAGE: "aziotbld/vsts-linux-c-ubuntu"
66-
pool: aziotbld-lin01
67+
pool:
68+
name: 'sdk-c--ubuntu-18'
6769
displayName: 'linux-options'
6870
steps:
6971
- script: |
@@ -78,11 +80,11 @@ jobs:
7880
condition: always()
7981
- job: windowsdynamic
8082
pool:
81-
name: 'aziotbld-win03'
83+
vmImage: 'vs2017-win2016'
8284
steps:
8385
- script: |
8486
if exist jenkins\windows_c_build_as_dynamic.cmd (
85-
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
87+
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
8688
call jenkins\windows_c_build_as_dynamic.cmd)
8789
displayName: 'build'
8890
env:
@@ -139,7 +141,8 @@ jobs:
139141
- job: clang
140142
variables:
141143
_PREVIEW_VSTS_DOCKER_IMAGE: "aziotbld/ubuntu-clang"
142-
pool: aziotbld-lin01
144+
pool:
145+
name: 'sdk-c--ubuntu-18'
143146
displayName: 'clang'
144147
steps:
145148
- script: |
@@ -174,7 +177,8 @@ jobs:
174177
- job: ubuntu1604
175178
variables:
176179
_PREVIEW_VSTS_DOCKER_IMAGE: "aziotbld/linux-c-ubuntu"
177-
pool: aziotbld-lin02
180+
pool:
181+
name: 'sdk-c--ubuntu-18'
178182
displayName: 'ubuntu1604'
179183
steps:
180184
- script: |
@@ -209,7 +213,8 @@ jobs:
209213
- job: debian
210214
variables:
211215
_PREVIEW_VSTS_DOCKER_IMAGE: "aziotbld/c-debian"
212-
pool: aziotbld-lin01
216+
pool:
217+
name: 'sdk-c--ubuntu-18'
213218
displayName: 'debian'
214219
steps:
215220
- script: |
@@ -244,7 +249,8 @@ jobs:
244249
- job: linux_mbed
245250
variables:
246251
_PREVIEW_VSTS_DOCKER_IMAGE: "aziotbld/linux-c-mbed"
247-
pool: aziotbld-lin01
252+
pool:
253+
name: 'sdk-c--ubuntu-18'
248254
displayName: 'linux_mbed'
249255
steps:
250256
- script: |
@@ -277,7 +283,8 @@ jobs:
277283
- job: wolfssl
278284
variables:
279285
_PREVIEW_VSTS_DOCKER_IMAGE: "aziotbld/vsts-c-wolfssl"
280-
pool: aziotbld-lin01
286+
pool:
287+
name: 'sdk-c--ubuntu-18'
281288
displayName: 'wolfssl'
282289
steps:
283290
- script: |
@@ -316,7 +323,8 @@ jobs:
316323
- job: bearssl
317324
variables:
318325
_PREVIEW_VSTS_DOCKER_IMAGE: "aziotbld/vsts-c-bearssl"
319-
pool: aziotbld-lin01
326+
pool:
327+
name: 'sdk-c--ubuntu-18'
320328
displayName: 'bearssl'
321329
steps:
322330
- script: |
@@ -350,12 +358,12 @@ jobs:
350358
condition: always()
351359
- job: windowsx64
352360
pool:
353-
name: 'aziotbld-win03'
361+
vmImage: 'vs2017-win2016'
354362
displayName: 'windowsx64'
355363
steps:
356364
- script: |
357365
if exist jenkins\windows_c.cmd (
358-
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
366+
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
359367
call jenkins\windows_c.cmd --platform x64)
360368
displayName: 'build'
361369
env:

build_all/mbed/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
set(shared_util_base_path ../..)
77
set(mbed_project_base "azure_c_shared_utility" CACHE STRING "The item being built")

build_all/windows/build.cmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ if %MAKE_NUGET_PKG% == yes (
132132
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
133133
) else (
134134
echo ***Running CMAKE for Win64***
135-
cmake %build-root% -G "Visual Studio 15 2017" -A x64 -Drun_unittests:bool=ON -Drun_int_tests=ON
135+
cmake %build-root% -G "Visual Studio 15 2017" -A x64 -Drun_unittests:bool=ON -Drun_int_tests=ON -Duse_cppunittest=ON
136136
if not !ERRORLEVEL!==0 exit /b !ERRORLEVEL!
137137
)
138138

configs/azure_iot_build_rules.cmake

+17
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,23 @@ function(compileTargetAsC11 theTarget)
187187
endif()
188188
endfunction()
189189

190+
macro(generate_cpp_wrapper setVar whatIsBuilding)
191+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${whatIsBuilding}.cxx "#include \"${CMAKE_CURRENT_SOURCE_DIR}/${whatIsBuilding}.c\"")
192+
set(${setVar} ${CMAKE_CURRENT_BINARY_DIR}/${whatIsBuilding}.cxx)
193+
endmacro(generate_cpp_wrapper)
194+
195+
macro(generate_cppunittest_wrapper whatIsBuilding)
196+
if (${use_cppunittest} AND WIN32)
197+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${whatIsBuilding}.cxx "#include \"${CMAKE_CURRENT_SOURCE_DIR}/${whatIsBuilding}.c\"")
198+
set(${whatIsBuilding}_test_files ${CMAKE_CURRENT_BINARY_DIR}/${whatIsBuilding}.cxx)
199+
#CPP compiler on windows likes to complain about unused local function removed (C4505)
200+
#C compiler doesn't like to complain about the same thing
201+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4505")
202+
else()
203+
set(${whatIsBuilding}_test_files ${whatIsBuilding}.c)
204+
endif()
205+
endmacro(generate_cppunittest_wrapper)
206+
190207
IF((WIN32) AND (NOT(MINGW)))
191208
#windows needs this define
192209
add_definitions(-D_CRT_SECURE_NO_WARNINGS)

inc/azure_c_shared_utility/string_utils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ printf("PartitionId = %" GUID_FORMAT "\n", GUID_VALUES(fabricDeployedStatefulSer
4949
PartitionId=316132b8-96a0-4bc7-aecc-a16e7c5a6bf6
5050
*/
5151
#define GUID_FORMAT "8.8" PRIx32 "-%4.4" PRIx16 "-%4.4" PRIx16 "-%4.4" PRIx16 "-%12.12" PRIx64
52-
#define GUID_VALUES(guid) (guid).Data1, (guid).Data2, (guid).Data3, ((guid).Data4[0]<<8) + (guid).Data4[1], ((uint64_t)((guid).Data4[2])<<40) + ((uint64_t)((guid).Data4[3])<<32) + (((uint64_t)(guid).Data4[4])<<24) + ((guid).Data4[5]<<16) + ((guid).Data4[6]<<8) + ((guid).Data4[7])
52+
#define GUID_VALUES(guid) (guid).Data1, (guid).Data2, (guid).Data3, (unsigned int)((((uint64_t)(guid).Data4[0]))<<8) + (guid).Data4[1], (((uint64_t)((guid).Data4[2]))<<40) + (((uint64_t)((guid).Data4[3]))<<32) + (((uint64_t)((guid).Data4[4]))<<24) + (((uint64_t)((guid).Data4[5]))<<16) + (((uint64_t)((guid).Data4[6]))<<8) + ((guid).Data4[7])
5353

5454
/*takes a FILETIME, returns a nice string representation of it*/
5555
char* FILETIME_toAsciiArray(const FILETIME* fileTime);

samples/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
function(add_sample_directory whatIsBuilding)
77
add_subdirectory(${whatIsBuilding})

samples/socketio_connect/mbed/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
set(shared_util_base_path ../../..)
77
set(mbed_project_base "socketio_connect" CACHE STRING "The item being built")

samples/tlsio_connect/CMakeLists.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
set(tlsio_connect_c_files
5-
main.c
6-
)
4+
generate_cpp_wrapper(tlsio_connect_c_files main)
75

86
IF(WIN32)
97
#windows needs this define

samples/tlsio_connect/mbed/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
set(shared_util_base_path ../../..)
77
set(mbed_project_base "tlsio_connect" CACHE STRING "The item being built")

tests/agenttime_ut/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
set(theseTestsName agenttime_ut)
77

8-
set(${theseTestsName}_test_files
9-
${theseTestsName}.c
10-
)
8+
generate_cppunittest_wrapper(${theseTestsName})
119

1210
set(${theseTestsName}_c_files
1311
../../pal/agenttime.c

tests/azure_base32_ut/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
set(theseTestsName azure_base32_ut)
77

8-
set(${theseTestsName}_test_files
9-
${theseTestsName}.c
10-
)
8+
generate_cppunittest_wrapper(${theseTestsName})
119

1210
set(${theseTestsName}_c_files
1311
../../src/azure_base32.c

tests/azure_base64_ut/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
set(theseTestsName azure_base64_ut)
77

8-
set(${theseTestsName}_test_files
9-
${theseTestsName}.c
10-
)
8+
generate_cppunittest_wrapper(${theseTestsName})
119

1210
set(${theseTestsName}_c_files
1311
../../src/azure_base64.c

tests/buffer_ut/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
set(theseTestsName buffer_ut)
77

8-
set(${theseTestsName}_test_files
9-
${theseTestsName}.c
10-
)
8+
generate_cppunittest_wrapper(${theseTestsName})
119

1210
set(${theseTestsName}_c_files
1311
../../src/buffer.c

tests/condition_ut/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
set(theseTestsName condition_ut)
77

8-
set(${theseTestsName}_test_files
9-
${theseTestsName}.c
10-
)
8+
generate_cppunittest_wrapper(${theseTestsName})
119

1210
set(${theseTestsName}_c_files
1311
${CONDITION_C_FILE}

tests/connectionstringparser_ut/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#Copyright (c) Microsoft. All rights reserved.
22
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
cmake_minimum_required(VERSION 2.8.11)
4+
cmake_minimum_required (VERSION 3.5)
55

66
set(theseTestsName connectionstringparser_ut)
77

8-
set(${theseTestsName}_test_files
9-
${theseTestsName}.c
10-
)
8+
generate_cppunittest_wrapper(${theseTestsName})
119

1210
include_directories(${SHARED_UTIL_REAL_TEST_FOLDER})
1311

tests/constbuffer_array_batcher_ut/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#Copyright (c) Microsoft. All rights reserved.
22

3-
cmake_minimum_required(VERSION 2.8.11)
3+
cmake_minimum_required (VERSION 3.5)
44

55
set(theseTestsName constbuffer_array_batcher_ut)
66

7-
set(${theseTestsName}_test_files
8-
${theseTestsName}.c
9-
)
7+
generate_cppunittest_wrapper(${theseTestsName})
108

119
set(${theseTestsName}_c_files
1210
../../src/constbuffer_array_batcher.c

tests/constbuffer_array_ut/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
#Copyright (c) Microsoft. All rights reserved.
22

3-
cmake_minimum_required(VERSION 2.8.11)
3+
cmake_minimum_required (VERSION 3.5)
44

55
set(theseTestsName constbuffer_array_ut)
66

7-
set(${theseTestsName}_test_files
8-
${theseTestsName}.c
9-
)
7+
generate_cppunittest_wrapper(${theseTestsName})
108

119
set(${theseTestsName}_c_files
1210
../../src/constbuffer_array.c

0 commit comments

Comments
 (0)