Skip to content
This repository was archived by the owner on Oct 13, 2020. It is now read-only.

Commit a3c6807

Browse files
committed
CDRIVER-2334 fix JSON test runner on Windows
1 parent 4e27abb commit a3c6807

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

tests/json-test.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -76,24 +76,23 @@ collect_tests_from_dir (char (*paths)[MAX_TEST_NAME_LENGTH] /* OUT */,
7676
int max_paths)
7777
{
7878
#ifdef _MSC_VER
79+
char *dir_path_plus_star;
7980
intptr_t handle;
8081
struct _finddata_t info;
8182

8283
char child_path[MAX_TEST_NAME_LENGTH];
8384

84-
handle = _findfirst (dir_path, &info);
85+
dir_path_plus_star = bson_strdup_printf ("%s/*", dir_path);
86+
handle = _findfirst (dir_path_plus_star, &info);
8587

8688
if (handle == -1) {
89+
bson_free (dir_path_plus_star);
8790
return 0;
8891
}
8992

9093
while (1) {
9194
BSON_ASSERT (paths_index < max_paths);
9295

93-
if (_findnext (handle, &info) == -1) {
94-
break;
95-
}
96-
9796
if (info.attrib & _A_SUBDIR) {
9897
/* recursively call on child directories */
9998
if (strcmp (info.name, "..") != 0 && strcmp (info.name, ".") != 0) {
@@ -105,8 +104,13 @@ collect_tests_from_dir (char (*paths)[MAX_TEST_NAME_LENGTH] /* OUT */,
105104
/* if this is a JSON test, collect its path */
106105
assemble_path (dir_path, info.name, paths[paths_index++]);
107106
}
107+
108+
if (_findnext (handle, &info) == -1) {
109+
break;
110+
}
108111
}
109112

113+
bson_free (dir_path_plus_star);
110114
_findclose (handle);
111115

112116
return paths_index;

0 commit comments

Comments
 (0)