Skip to content

Commit 44b4992

Browse files
authored
Merge pull request #305 from maxmind/greg/require-linux-for-test
Require Linux for external symbols test
2 parents 2fac991 + ff42640 commit 44b4992

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

Changes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.7.1
2+
3+
* The external symbols test now only runs on Linux. It assumes a Linux
4+
environment. Reported by Carlo Cabrera. GitHub #304.
5+
16
## 1.7.0 - 2022-09-28
27

38
* `FD_CLOEXEC` is now set on platforms that do not support `O_CLOEXEC`.

t/data_entry_list_t.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ test_map_value(MMDB_entry_data_list_s *entry_data_list) {
203203
"==",
204204
MMDB_DATA_TYPE_UTF8_STRING,
205205
"found a map key in 'map'");
206-
char *map_key_1_name =
207-
dup_entry_string_or_bail(map_key_1->entry_data);
206+
char *map_key_1_name = dup_entry_string_or_bail(map_key_1->entry_data);
208207
ok(strcmp(map_key_1_name, "mapX") == 0, "key name is mapX");
209208
free(map_key_1_name);
210209

@@ -323,15 +322,15 @@ test_utf8_string_value(MMDB_entry_data_list_s *entry_data_list) {
323322
0x65,
324323
0x21,
325324
0x20,
326-
(char) 0xe2,
327-
(char) 0x98,
328-
(char) 0xaf,
325+
(char)0xe2,
326+
(char)0x98,
327+
(char)0xaf,
329328
0x20,
330329
0x2d,
331330
0x20,
332-
(char) 0xe2,
333-
(char) 0x99,
334-
(char) 0xab,
331+
(char)0xe2,
332+
(char)0x99,
333+
(char)0xab,
335334
0x00};
336335

337336
is(utf8_string, expect, "got expected value for utf8_string key");

t/data_types_t.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ void test_all_data_types(MMDB_lookup_result_s *result,
2525
0x65,
2626
0x21,
2727
0x20,
28-
(char) 0xe2,
29-
(char) 0x98,
30-
(char) 0xaf,
28+
(char)0xe2,
29+
(char)0x98,
30+
(char)0xaf,
3131
0x20,
3232
0x2d,
3333
0x20,
34-
(char) 0xe2,
35-
(char) 0x99,
36-
(char) 0xab,
34+
(char)0xe2,
35+
(char)0x99,
36+
(char)0xab,
3737
0x00};
3838
is(string, expect, "got expected utf8_string value");
3939

t/external_symbols_t.pl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55

66
use FindBin qw( $Bin );
77

8+
_skip_tests_if_not_linux();
89
_skip_tests_if_required_modules_are_not_present();
910
_skip_tests_if_nm_is_not_present();
1011
_test_libs_external_symbols();
1112

1213
done_testing();
1314

15+
sub _skip_tests_if_not_linux {
16+
return if $^O eq 'linux';
17+
18+
print "1..0 # skip all tests skipped - this test requires Linux.\n";
19+
exit 0;
20+
}
21+
1422
sub _skip_tests_if_required_modules_are_not_present {
1523
eval <<'EOF';
1624
use Test::More 0.88;

t/maxminddb_test_helper.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ char *test_database_path(const char *filename) {
6767
}
6868

6969
char *dup_entry_string_or_bail(MMDB_entry_data_s entry_data) {
70-
char *string =
71-
mmdb_strndup(entry_data.utf8_string, entry_data.data_size);
70+
char *string = mmdb_strndup(entry_data.utf8_string, entry_data.data_size);
7271
if (NULL == string) {
7372
BAIL_OUT("mmdb_strndup failed");
7473
}

t/threads_t.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ void run_ipX_tests(MMDB_s *mmdb,
130130
int pairs_rows,
131131
const char *mode_desc) {
132132
pthread_t *threads = malloc((unsigned long)pairs_rows * sizeof(pthread_t));
133-
struct thread_arg *thread_args = malloc((unsigned long)pairs_rows * sizeof(struct thread_arg));
133+
struct thread_arg *thread_args =
134+
malloc((unsigned long)pairs_rows * sizeof(struct thread_arg));
134135

135136
for (int i = 0; i < pairs_rows; i += 1) {
136137
thread_args[i].thread_id = i;

0 commit comments

Comments
 (0)