Skip to content

Commit 6cf3b51

Browse files
guard test that uses pipe from running with mingw
1 parent fe7d458 commit 6cf3b51

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

tests/api.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33199,7 +33199,8 @@ static int test_wolfSSL_RAND_bytes(void)
3319933199
const int size4 = RNG_MAX_BLOCK_LEN * 4; /* in bytes */
3320033200
int max_bufsize;
3320133201
byte *my_buf = NULL;
33202-
#if defined(HAVE_GETPID)
33202+
#if defined(OPENSSL_EXTRA) && defined(HAVE_GETPID) && !defined(__MINGW64__) && \
33203+
!defined(__MINGW32__)
3320333204
byte seed[16] = {0};
3320433205
byte randbuf[8] = {0};
3320533206
int pipefds[2] = {0};
@@ -33225,7 +33226,8 @@ static int test_wolfSSL_RAND_bytes(void)
3322533226
ExpectIntEQ(RAND_bytes(my_buf, size4), 1);
3322633227
XFREE(my_buf, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
3322733228

33228-
#if defined(OPENSSL_EXTRA) && defined(HAVE_GETPID)
33229+
#if defined(OPENSSL_EXTRA) && defined(HAVE_GETPID) && !defined(__MINGW64__) && \
33230+
!defined(__MINGW32__)
3322933231
XMEMSET(seed, 0, sizeof(seed));
3323033232
RAND_cleanup();
3323133233

@@ -33247,17 +33249,17 @@ static int test_wolfSSL_RAND_bytes(void)
3324733249
}
3324833250
else {
3324933251
/* Parent process. */
33250-
word64 childrand64 = 0;
33252+
byte childrand[8] = {0};
3325133253
int waitstatus = 0;
3325233254

3325333255
close(pipefds[1]);
3325433256
ExpectIntEQ(RAND_bytes(randbuf, sizeof(randbuf)), 1);
33255-
ExpectIntEQ(read(pipefds[0], &childrand64, sizeof(childrand64)),
33256-
sizeof(childrand64));
33257+
ExpectIntEQ(read(pipefds[0], childrand, sizeof(childrand)),
33258+
sizeof(childrand));
3325733259
#ifdef WOLFSSL_NO_GETPID
33258-
ExpectBufEQ(randbuf, &childrand64, sizeof(randbuf));
33260+
ExpectBufEQ(randbuf, childrand, sizeof(randbuf));
3325933261
#else
33260-
ExpectBufNE(randbuf, &childrand64, sizeof(randbuf));
33262+
ExpectBufNE(randbuf, childrand, sizeof(randbuf));
3326133263
#endif
3326233264
close(pipefds[0]);
3326333265
waitpid(pid, &waitstatus, 0);

0 commit comments

Comments
 (0)