diff options
author | David Zero <zero@cpp.edu> | 2016-12-02 04:37:23 -0800 |
---|---|---|
committer | David Zero <zero@cpp.edu> | 2017-01-04 13:44:39 -0800 |
commit | f3469070fe899e8e4fd88665386a55bad9f77cd8 (patch) | |
tree | c24743d266d3a8593792ef3e8661006cb283368a /auto_tests | |
parent | 535b8238fd191710e1e8864f302fba5a02f52b1d (diff) |
Portability fixes
- CFLAG gnu99 was changed to c99.
- CXXFLAG c++98 was changed to c++11.
- CFLAG -pedantic-errors was added so that non-ISO C now throws errors.
- _XOPEN_SOURCE feature test macro added and set to 600 to expose SUSv3
and c99 definitions in modules that required them.
- Fixed tests (and bootstrap daemon logging) that were failing due to
the altered build flags.
- Avoid string suffix misinterpretation; explicit narrowing conversion.
- Misc. additions to .gitignore to make sure build artifacts don't wind
up in version control.
Diffstat (limited to 'auto_tests')
-rw-r--r-- | auto_tests/TCP_test.c | 2 | ||||
-rw-r--r-- | auto_tests/conference_test.c | 8 | ||||
-rw-r--r-- | auto_tests/dht_test.c | 2 | ||||
-rw-r--r-- | auto_tests/network_test.c | 4 | ||||
-rw-r--r-- | auto_tests/onion_test.c | 2 | ||||
-rw-r--r-- | auto_tests/save_friend_test.c | 3 | ||||
-rw-r--r-- | auto_tests/tox_many_tcp_test.c | 2 | ||||
-rw-r--r-- | auto_tests/tox_many_test.c | 2 | ||||
-rw-r--r-- | auto_tests/tox_test.c | 2 | ||||
-rw-r--r-- | auto_tests/toxav_basic_test.c | 2 | ||||
-rw-r--r-- | auto_tests/toxav_many_test.c | 2 |
11 files changed, 26 insertions, 5 deletions
diff --git a/auto_tests/TCP_test.c b/auto_tests/TCP_test.c index d9013378..6a439261 100644 --- a/auto_tests/TCP_test.c +++ b/auto_tests/TCP_test.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | |||
1 | #ifdef HAVE_CONFIG_H | 3 | #ifdef HAVE_CONFIG_H |
2 | #include "config.h" | 4 | #include "config.h" |
3 | #endif | 5 | #endif |
diff --git a/auto_tests/conference_test.c b/auto_tests/conference_test.c index aa2f8e13..36707e0f 100644 --- a/auto_tests/conference_test.c +++ b/auto_tests/conference_test.c | |||
@@ -1,6 +1,8 @@ | |||
1 | /* Auto Tests: Conferences. | 1 | /* Auto Tests: Conferences. |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #define _XOPEN_SOURCE 600 | ||
5 | |||
4 | #ifdef HAVE_CONFIG_H | 6 | #ifdef HAVE_CONFIG_H |
5 | #include "config.h" | 7 | #include "config.h" |
6 | #endif | 8 | #endif |
@@ -175,7 +177,7 @@ group_test_restart: | |||
175 | * Either way in this case it's fine */ | 177 | * Either way in this case it's fine */ |
176 | if (peer_count != NUM_GROUP_TOX) { | 178 | if (peer_count != NUM_GROUP_TOX) { |
177 | ++test_run; | 179 | ++test_run; |
178 | printf("\tError starting up the first group (peer_count %"PRIu32" != %d, test_run = %d)\n", peer_count, NUM_GROUP_TOX, | 180 | printf("\tError starting up the first group (peer_count %" PRIu32 " != %d, test_run = %d)\n", peer_count, NUM_GROUP_TOX, |
179 | test_run); | 181 | test_run); |
180 | 182 | ||
181 | for (j = 0; j < NUM_GROUP_TOX; ++j) { | 183 | for (j = 0; j < NUM_GROUP_TOX; ++j) { |
@@ -194,7 +196,7 @@ group_test_restart: | |||
194 | * important again. | 196 | * important again. |
195 | */ | 197 | */ |
196 | ck_assert_msg(peer_count == NUM_GROUP_TOX, "\n\tBad number of group peers (pre check)." | 198 | ck_assert_msg(peer_count == NUM_GROUP_TOX, "\n\tBad number of group peers (pre check)." |
197 | "\n\t\t\tExpected: %u but tox_instance(%u) only has: %"PRIu32"\n\n", | 199 | "\n\t\t\tExpected: %u but tox_instance(%u) only has: %" PRIu32 "\n\n", |
198 | NUM_GROUP_TOX, i, peer_count); | 200 | NUM_GROUP_TOX, i, peer_count); |
199 | 201 | ||
200 | uint8_t title[2048]; | 202 | uint8_t title[2048]; |
@@ -241,7 +243,7 @@ group_test_restart: | |||
241 | for (i = 0; i < (k - 1); ++i) { | 243 | for (i = 0; i < (k - 1); ++i) { |
242 | uint32_t peer_count = tox_conference_peer_count(toxes[i], 0, NULL); | 244 | uint32_t peer_count = tox_conference_peer_count(toxes[i], 0, NULL); |
243 | ck_assert_msg(peer_count == (k - 1), "\n\tBad number of group peers (post check)." | 245 | ck_assert_msg(peer_count == (k - 1), "\n\tBad number of group peers (post check)." |
244 | "\n\t\t\tExpected: %u but tox_instance(%u) only has: %"PRIu32"\n\n", | 246 | "\n\t\t\tExpected: %u but tox_instance(%u) only has: %" PRIu32 "\n\n", |
245 | (k - 1), i, peer_count); | 247 | (k - 1), i, peer_count); |
246 | } | 248 | } |
247 | } | 249 | } |
diff --git a/auto_tests/dht_test.c b/auto_tests/dht_test.c index 9cec1643..633e7002 100644 --- a/auto_tests/dht_test.c +++ b/auto_tests/dht_test.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | |||
1 | #ifdef HAVE_CONFIG_H | 3 | #ifdef HAVE_CONFIG_H |
2 | #include "config.h" | 4 | #include "config.h" |
3 | #endif | 5 | #endif |
diff --git a/auto_tests/network_test.c b/auto_tests/network_test.c index 783f3f7b..ca918778 100644 --- a/auto_tests/network_test.c +++ b/auto_tests/network_test.c | |||
@@ -114,8 +114,8 @@ START_TEST(test_ip_equal) | |||
114 | ip2.ip6.uint32[2] = htonl(0xFFFF); | 114 | ip2.ip6.uint32[2] = htonl(0xFFFF); |
115 | ip2.ip6.uint32[3] = htonl(0x7F000001); | 115 | ip2.ip6.uint32[3] = htonl(0x7F000001); |
116 | 116 | ||
117 | ck_assert_msg(IN6_IS_ADDR_V4MAPPED(&ip2.ip6.in6_addr) != 0, | 117 | ck_assert_msg(IPV6_IPV4_IN_V6(ip2.ip6) != 0, |
118 | "IN6_IS_ADDR_V4MAPPED(::ffff:127.0.0.1): expected != 0, got 0."); | 118 | "IPV6_IPV4_IN_V6(::ffff:127.0.0.1): expected != 0, got 0."); |
119 | 119 | ||
120 | res = ip_equal(&ip1, &ip2); | 120 | res = ip_equal(&ip1, &ip2); |
121 | ck_assert_msg(res != 0, "ip_equal( {AF_INET, 127.0.0.1}, {AF_INET6, ::ffff:127.0.0.1} ): expected result != 0, got 0."); | 121 | ck_assert_msg(res != 0, "ip_equal( {AF_INET, 127.0.0.1}, {AF_INET6, ::ffff:127.0.0.1} ): expected result != 0, got 0."); |
diff --git a/auto_tests/onion_test.c b/auto_tests/onion_test.c index 44ea9c7d..05264927 100644 --- a/auto_tests/onion_test.c +++ b/auto_tests/onion_test.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | |||
1 | #ifdef HAVE_CONFIG_H | 3 | #ifdef HAVE_CONFIG_H |
2 | #include "config.h" | 4 | #include "config.h" |
3 | #endif | 5 | #endif |
diff --git a/auto_tests/save_friend_test.c b/auto_tests/save_friend_test.c index 9d36ff2d..448160c0 100644 --- a/auto_tests/save_friend_test.c +++ b/auto_tests/save_friend_test.c | |||
@@ -1,7 +1,10 @@ | |||
1 | /* Auto Tests: Save and load friends. | 1 | /* Auto Tests: Save and load friends. |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #define _XOPEN_SOURCE 600 | ||
5 | |||
4 | #include "helpers.h" | 6 | #include "helpers.h" |
7 | #include "../toxcore/tox.h" | ||
5 | 8 | ||
6 | #include <assert.h> | 9 | #include <assert.h> |
7 | #include <stdio.h> | 10 | #include <stdio.h> |
diff --git a/auto_tests/tox_many_tcp_test.c b/auto_tests/tox_many_tcp_test.c index 197c6e47..48f5671c 100644 --- a/auto_tests/tox_many_tcp_test.c +++ b/auto_tests/tox_many_tcp_test.c | |||
@@ -1,6 +1,8 @@ | |||
1 | /* Auto Tests: Many TCP. | 1 | /* Auto Tests: Many TCP. |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #define _XOPEN_SOURCE 600 | ||
5 | |||
4 | #ifdef HAVE_CONFIG_H | 6 | #ifdef HAVE_CONFIG_H |
5 | #include "config.h" | 7 | #include "config.h" |
6 | #endif | 8 | #endif |
diff --git a/auto_tests/tox_many_test.c b/auto_tests/tox_many_test.c index 0c4c8c7d..b44bbb0c 100644 --- a/auto_tests/tox_many_test.c +++ b/auto_tests/tox_many_test.c | |||
@@ -1,6 +1,8 @@ | |||
1 | /* Auto Tests: Many clients. | 1 | /* Auto Tests: Many clients. |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #define _XOPEN_SOURCE 600 | ||
5 | |||
4 | #ifdef HAVE_CONFIG_H | 6 | #ifdef HAVE_CONFIG_H |
5 | #include "config.h" | 7 | #include "config.h" |
6 | #endif | 8 | #endif |
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index dfd1d80a..ab2202d1 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -10,6 +10,8 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define _XOPEN_SOURCE 600 | ||
14 | |||
13 | #ifdef HAVE_CONFIG_H | 15 | #ifdef HAVE_CONFIG_H |
14 | #include "config.h" | 16 | #include "config.h" |
15 | #endif | 17 | #endif |
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c index 767fca87..79f552de 100644 --- a/auto_tests/toxav_basic_test.c +++ b/auto_tests/toxav_basic_test.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | |||
1 | #ifdef HAVE_CONFIG_H | 3 | #ifdef HAVE_CONFIG_H |
2 | #include "config.h" | 4 | #include "config.h" |
3 | #endif | 5 | #endif |
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index b33b93c8..1a10db44 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -1,3 +1,5 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | |||
1 | #ifdef HAVE_CONFIG_H | 3 | #ifdef HAVE_CONFIG_H |
2 | #include "config.h" | 4 | #include "config.h" |
3 | #endif | 5 | #endif |