Skip to content

Commit 9e8599f

Browse files
authored
move to dev ops OSX (#640)
* move to dev ops OSX * include #include <stdio.h> * update to VS2022 * added #include <string.h> * update includes * disable constbuffer_ut * disable lock_ut * disable refcount_ut * try macOS-12 * try macOS-13 * exclude MAC * conversion * handle main() int return * compile issues * no-strict-prototypes * strict-prototypes * add_definitions(-DOPENSSL_NO_DEPRECATED) * compile flags * c99
1 parent 1aa49d3 commit 9e8599f

File tree

69 files changed

+105
-94
lines changed

Some content is hidden

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

69 files changed

+105
-94
lines changed

CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ if(WIN32)
5454

5555
else()
5656
option(use_schannel "set use_schannel to ON if schannel is to be used, set to OFF to not use schannel" OFF)
57-
if(MACOSX)
57+
if(DEFINED MACOSX)
5858
option(use_openssl "set use_openssl to ON if openssl is to be used, set to OFF to not use openssl" OFF)
5959
option(use_socketio "set use_socketio to ON if socketio is to be included in the library, set to OFF if a different implementation will be provided" OFF)
6060
else()
@@ -71,7 +71,7 @@ option(no_logging "disable logging (default is OFF)" OFF)
7171

7272
# The options setting for use_socketio is not reliable. If openssl is used, make sure it's on,
7373
# and if apple tls is used then use_socketio must be off.
74-
if (MACOSX)
74+
if (DEFINED MACOSX)
7575
if (${use_openssl})
7676
set(use_socketio ON)
7777
else()
@@ -472,7 +472,7 @@ SOURCE_GROUP(devdoc FILES ${aziotsharedutil_md_files})
472472

473473
# Add ignore deprecated functions so we may use 1.1.1 APIs
474474
# in OpenSSL 3
475-
if(LINUX OR MACOSX)
475+
if(DEFINED LINUX OR DEFINED MACOSX)
476476
set_property(
477477
SOURCE
478478
${CMAKE_CURRENT_LIST_DIR}/adapters/tlsio_openssl.c

build/.vsts-ci.yml

+5-8
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@ jobs:
5151
- job: windowsx86
5252
displayName: Windows x86
5353
pool:
54-
name: 'sdk-c--win-vs2017'
54+
name: 'sdk-c--win-vs2022'
5555
steps:
5656
- script: |
5757
if exist jenkins\windows_c.cmd (
58-
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
5958
call jenkins\windows_c.cmd)
6059
displayName: 'Build'
6160
- script: |
@@ -83,12 +82,11 @@ jobs:
8382
CodeQL.Enabled: true
8483
CodeQL.Language: cpp
8584
pool:
86-
name: 'sdk-c--win-vs2017'
85+
name: 'sdk-c--win-vs2022'
8786
displayName: 'Windows x64'
8887
steps:
8988
- script: |
9089
if exist jenkins\windows_c.cmd (
91-
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
9290
call jenkins\windows_c.cmd --platform x64)
9391
displayName: 'Build'
9492
- script: |
@@ -117,11 +115,10 @@ jobs:
117115
- job: windowsdynamic
118116
displayName: Windows Dynamic
119117
pool:
120-
name: 'sdk-c--win-vs2017'
118+
name: 'sdk-c--win-vs2022'
121119
steps:
122120
- script: |
123121
if exist jenkins\windows_c_build_as_dynamic.cmd (
124-
call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
125122
call jenkins\windows_c_build_as_dynamic.cmd)
126123
displayName: 'Build'
127124
env:
@@ -480,7 +477,7 @@ jobs:
480477
- job: OSX
481478
displayName: OSX
482479
pool:
483-
name: OSX
480+
vmImage: 'macOS-13'
484481
steps:
485482
- script: |
486483
if [ -f "jenkins/osx_gcc_openssl.sh" ]
@@ -515,7 +512,7 @@ jobs:
515512
- job: xcodenative
516513
displayName: XCode Native
517514
pool:
518-
name: OSX
515+
vmImage: 'macOS-13'
519516
steps:
520517
- script: |
521518
if [ -f "jenkins/osx_xcode_native.sh" ]

tests/CMakeLists.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ if(${run_unittests})
3030
add_subdirectory(httpapicompact_ut)
3131
endif()
3232
add_subdirectory(singlylinkedlist_ut)
33-
add_subdirectory(lock_ut)
33+
add_subdirectory(lock_ut)
3434
add_subdirectory(map_ut)
3535
add_subdirectory(refcount_ut)
3636
add_subdirectory(sastoken_ut)
@@ -47,7 +47,7 @@ if(${run_unittests})
4747
endif()
4848

4949
#normally, with proper include paths, the below tests can be run under windows too.
50-
if(${use_openssl})
50+
if(${use_openssl} AND NOT DEFINED MACOSX)
5151
add_subdirectory(x509_openssl_ut/engine)
5252
add_subdirectory(x509_openssl_ut/no_engine)
5353
endif()
@@ -93,9 +93,9 @@ if(${run_unittests})
9393

9494
add_subdirectory(utf8_checker_ut)
9595
add_subdirectory(http_proxy_io_ut)
96-
if(NOT DEFINED MACOSX)
97-
#add_subdirectory(socket_async_ut)
98-
#add_subdirectory(dns_resolver_ut)
96+
if(DEFINED LINUX)
97+
add_subdirectory(dns_resolver_ut)
98+
add_subdirectory(socket_async_ut)
9999
endif()
100100

101101
#Add template as reference for new tests

tests/agenttime_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(agenttime_unittests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/azure_base32_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(azure_base32_ut, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/azure_base64_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(base64_unittests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/condition_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(Condition_UnitTests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/connectionstringparser_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(connectionstringparser_ut, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/constbuffer_array_batcher_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ int main(void)
77
{
88
size_t failedTestCount = 0;
99
RUN_TEST_SUITE(constbuffer_array_batcher_unittests, failedTestCount);
10-
return failedTestCount;
10+
return (int)failedTestCount;
1111
}

tests/constbuffer_array_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ int main(void)
77
{
88
size_t failedTestCount = 0;
99
RUN_TEST_SUITE(constbuffer_array_unittests, failedTestCount);
10-
return failedTestCount;
10+
return (int)failedTestCount;
1111
}

tests/constbuffer_ut/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ set(${theseTestsName}_h_files
1616

1717
build_c_test_artifacts(${theseTestsName} ON "tests/azure_c_shared_utility_tests")
1818

19+
compile_c_test_artifacts_as(${theseTestsName} C99)

tests/constmap_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(constmap_unittests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/crtabstractions_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(CRTAbstractions_UnitTests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/dns_resolver_ut/dns_resolver_ut.c

+18-12
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ void* my_gballoc_malloc(size_t size)
3939
return malloc(size);
4040
}
4141

42+
void* my_gballoc_calloc(size_t nmemb, size_t size)
43+
{
44+
return calloc(nmemb, size);
45+
}
46+
4247
void* my_gballoc_realloc(void* ptr, size_t size)
4348
{
4449
return realloc(ptr, size);
@@ -140,6 +145,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
140145
ASSERT_ARE_EQUAL(int, 0, result);
141146

142147
REGISTER_GLOBAL_MOCK_HOOK(gballoc_malloc, my_gballoc_malloc);
148+
REGISTER_GLOBAL_MOCK_HOOK(gballoc_calloc, my_gballoc_calloc);
143149
REGISTER_GLOBAL_MOCK_FAIL_RETURN(gballoc_malloc, NULL);
144150
REGISTER_GLOBAL_MOCK_HOOK(gballoc_free, my_gballoc_free);
145151

@@ -187,7 +193,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
187193
TEST_FUNCTION(dns_resolver__is_complete_repeated_call__succeeds)
188194
{
189195
///arrange
190-
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", NULL);
196+
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", 53, NULL);
191197
// We're calling this twice
192198
bool result = dns_resolver_is_lookup_complete(dns);
193199
uint32_t ipv4 = dns_resolver_get_ipv4(dns);
@@ -220,7 +226,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
220226
{
221227
///arrange
222228
bool result;
223-
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", NULL);
229+
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", 53, NULL);
224230
umock_c_reset_all_calls();
225231
STRICT_EXPECTED_CALL(getaddrinfo(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG));
226232

@@ -240,7 +246,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
240246
///arrange
241247
bool result;
242248
uint32_t ipv4;
243-
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", NULL);
249+
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", 53, NULL);
244250
umock_c_reset_all_calls();
245251
STRICT_EXPECTED_CALL(getaddrinfo(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG));
246252
result = dns_resolver_is_lookup_complete(dns);
@@ -261,7 +267,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
261267
{
262268
///arrange
263269
bool result;
264-
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", NULL);
270+
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", 53, NULL);
265271
umock_c_reset_all_calls();
266272
STRICT_EXPECTED_CALL(getaddrinfo(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG)).SetReturn(GETADDRINFO_FAIL);
267273

@@ -281,7 +287,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
281287
///arrange
282288
bool result;
283289
uint32_t ipv4;
284-
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", NULL);
290+
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", 53, NULL);
285291
umock_c_reset_all_calls();
286292
STRICT_EXPECTED_CALL(getaddrinfo(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG)).SetReturn(GETADDRINFO_FAIL);
287293
result = dns_resolver_is_lookup_complete(dns);
@@ -314,7 +320,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
314320
TEST_FUNCTION(dns_resolver__get_ipv4_too_early__fails)
315321
{
316322
///arrange
317-
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", NULL);
323+
DNSRESOLVER_HANDLE dns = dns_resolver_create("fake.com", 53, NULL);
318324

319325
///act
320326
uint32_t result = dns_resolver_get_ipv4(dns);
@@ -355,7 +361,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
355361
TEST_FUNCTION(dns_resolver__destroy__success)
356362
{
357363
///arrange
358-
DNSRESOLVER_HANDLE result = dns_resolver_create("fake.com", NULL);
364+
DNSRESOLVER_HANDLE result = dns_resolver_create("fake.com", 53, NULL);
359365
umock_c_reset_all_calls();
360366

361367
STRICT_EXPECTED_CALL(gballoc_free(IGNORED_NUM_ARG)); // copy hostname
@@ -373,11 +379,11 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
373379
{
374380
///arrange
375381
DNSRESOLVER_HANDLE result;
376-
STRICT_EXPECTED_CALL(gballoc_malloc(IGNORED_NUM_ARG)); // copy hostname
382+
STRICT_EXPECTED_CALL(gballoc_calloc(IGNORED_NUM_ARG, IGNORED_NUM_ARG)); // copy hostname
377383
STRICT_EXPECTED_CALL(gballoc_malloc(IGNORED_NUM_ARG)); // instance
378384

379385
///act
380-
result = dns_resolver_create("fake.com", NULL);
386+
result = dns_resolver_create("fake.com", 53, NULL);
381387

382388
///assert
383389
ASSERT_IS_NOT_NULL(result);
@@ -395,7 +401,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
395401
int negativeTestsInitResult = umock_c_negative_tests_init();
396402
ASSERT_ARE_EQUAL(int, 0, negativeTestsInitResult);
397403

398-
STRICT_EXPECTED_CALL(gballoc_malloc(IGNORED_NUM_ARG)); // copy hostname
404+
STRICT_EXPECTED_CALL(gballoc_calloc(IGNORED_NUM_ARG, IGNORED_NUM_ARG)); // copy hostname
399405
STRICT_EXPECTED_CALL(gballoc_malloc(IGNORED_NUM_ARG)); // instance
400406
umock_c_negative_tests_snapshot();
401407

@@ -407,7 +413,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
407413
umock_c_negative_tests_fail_call(i);
408414

409415
///act
410-
result = dns_resolver_create("fake.com", NULL);
416+
result = dns_resolver_create("fake.com", 53, NULL);
411417

412418
///assert
413419
ASSERT_IS_NULL(result);
@@ -423,7 +429,7 @@ BEGIN_TEST_SUITE(dns_resolver_ut)
423429
///arrange
424430

425431
///act
426-
DNSRESOLVER_HANDLE result = dns_resolver_create(NULL, NULL);
432+
DNSRESOLVER_HANDLE result = dns_resolver_create(NULL, 53, NULL);
427433

428434
///assert
429435
ASSERT_IS_NULL(result, "Unexpected success with NULL hostname");

tests/dns_resolver_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ int main(void)
1212
*/
1313
RUN_TEST_SUITE(dns_resolver_ut, failedTestCount);
1414

15-
return failedTestCount;
15+
return (int)failedTestCount;
1616
}

tests/doublylinkedlist_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(doublylinkedlist_unittests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/gballoc_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(GBAlloc_UnitTests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/gballoc_without_init_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(GBAlloc_For_Init_UnitTests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/hmacsha256_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(HMACSHA256_UnitTests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/http_proxy_io_ut/http_proxy_io_ut.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -1582,15 +1582,14 @@ TEST_FUNCTION(http_proxy_io_clone_option_succeeds)
15821582
{
15831583
// arrange
15841584
CONCRETE_IO_HANDLE http_io;
1585-
OPTIONHANDLER_HANDLE options;
15861585

15871586
http_io = http_proxy_io_get_interface_description()->concrete_io_create((void*)&default_http_proxy_io_config);
15881587

15891588
umock_c_reset_all_calls();
15901589
STRICT_EXPECTED_CALL(OptionHandler_Create(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG));
15911590
STRICT_EXPECTED_CALL(xio_retrieveoptions(TEST_IO_HANDLE));
15921591
STRICT_EXPECTED_CALL(OptionHandler_AddOption(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG));
1593-
options = http_proxy_io_get_interface_description()->concrete_io_retrieveoptions(http_io);
1592+
http_proxy_io_get_interface_description()->concrete_io_retrieveoptions(http_io);
15941593

15951594
ASSERT_IS_NOT_NULL(tlsio_clone_option);
15961595

@@ -1614,15 +1613,14 @@ TEST_FUNCTION(http_proxy_io_destroy_option_succeeds)
16141613
{
16151614
// arrange
16161615
CONCRETE_IO_HANDLE http_io;
1617-
OPTIONHANDLER_HANDLE options;
16181616

16191617
http_io = http_proxy_io_get_interface_description()->concrete_io_create((void*)&default_http_proxy_io_config);
16201618

16211619
umock_c_reset_all_calls();
16221620
STRICT_EXPECTED_CALL(OptionHandler_Create(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG));
16231621
STRICT_EXPECTED_CALL(xio_retrieveoptions(TEST_IO_HANDLE));
16241622
STRICT_EXPECTED_CALL(OptionHandler_AddOption(IGNORED_PTR_ARG, IGNORED_PTR_ARG, IGNORED_PTR_ARG));
1625-
options = http_proxy_io_get_interface_description()->concrete_io_retrieveoptions(http_io);
1623+
http_proxy_io_get_interface_description()->concrete_io_retrieveoptions(http_io);
16261624

16271625
ASSERT_IS_NOT_NULL(tlsio_destroy_option);
16281626

tests/http_proxy_io_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(http_proxy_io_unittests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/httpapicompact_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(httpapicompact_ut, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

tests/httpapiex_ut/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ int main(void)
88
{
99
size_t failedTestCount = 0;
1010
RUN_TEST_SUITE(httpapiex_unittests, failedTestCount);
11-
return failedTestCount;
11+
return (int)failedTestCount;
1212
}

0 commit comments

Comments
 (0)