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

Fix all tests on macOS #58

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 2 deletions cmake/SgFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#
# Cross-platform library which helps to develop web servers or frameworks.
#
# Copyright (C) 2016-2019 Silvio Clecio <[email protected]>
# Copyright (C) 2016-2024 Silvio Clecio <[email protected]>
#
# Sagui library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -49,7 +49,7 @@ if(MINGW)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
endif()

if(BUILD_TESTING)
if(BUILD_TESTING AND NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -Wl,--allow-multiple-definition")
endif()
Expand Down
6 changes: 3 additions & 3 deletions test/test_str.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Cross-platform library which helps to develop web servers or frameworks.
*
* Copyright (C) 2016-2020 Silvio Clecio <[email protected]>
* Copyright (C) 2016-2024 Silvio Clecio <[email protected]>
*
* Sagui library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -44,9 +44,9 @@ static void test_str_printf_va(struct sg_str *str, const char *fmt,
va_list ap) {
ASSERT(sg_str_printf_va(NULL, fmt, ap) == EINVAL);
ASSERT(sg_str_printf_va(str, NULL, ap) == EINVAL);
#ifndef __arm__
#if !(defined(__arm__) || defined(__arm64__))
ASSERT(sg_str_printf_va(str, fmt, NULL) == EINVAL);
#endif /* __arm__ */
#endif /* !(__arm__ || __arm64__) */

sg_str_clear(str);
sg_str_printf_va(str, fmt, ap);
Expand Down
6 changes: 4 additions & 2 deletions test/test_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Cross-platform library which helps to develop web servers or frameworks.
*
* Copyright (C) 2016-2020 Silvio Clecio <[email protected]>
* Copyright (C) 2016-2024 Silvio Clecio <[email protected]>
*
* Sagui library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down Expand Up @@ -477,7 +477,9 @@ static void test_tmpdir(void) {
ASSERT(strcmp(tmp, path) == 0);
#elif defined(__ANDROID__) /* _WIN32 */
ASSERT(strcmp(tmp, "/data/local/tmp") == 0);
#else /* __ANDROID__ */
#elif defined(__APPLE__) /* __ANDROID__*/
ASSERT(strncmp(tmp, getenv("TMPDIR"), strlen(tmp)) == 0);
#else /* __APPLE__ */
ASSERT(strcmp(tmp, "/tmp") == 0);
#endif /* _WIN32 */
sg_free(tmp);
Expand Down
Loading