diff options
Diffstat (limited to 'test/quicapitest.c')
-rw-r--r-- | test/quicapitest.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/quicapitest.c b/test/quicapitest.c index 2e1e8900be..d17d704d29 100644 --- a/test/quicapitest.c +++ b/test/quicapitest.c @@ -374,7 +374,7 @@ static void strip_line_ends(char *str) static int compare_with_file(BIO *membio) { - BIO *file = NULL; + BIO *file = NULL, *newfile = NULL; char buf1[512], buf2[512]; char *reffile; int ret = 0; @@ -388,6 +388,19 @@ static int compare_with_file(BIO *membio) if (!TEST_ptr(file)) goto err; + newfile = BIO_new_file("ssltraceref-new.txt", "wb"); + if (!TEST_ptr(newfile)) + goto err; + + while (BIO_gets(membio, buf2, sizeof(buf2)) > 0) + if (BIO_puts(newfile, buf2) <= 0) { + TEST_error("Failed writing new file data"); + goto err; + } + + if (!TEST_int_ge(BIO_seek(membio, 0), 0)) + goto err; + while (BIO_gets(file, buf1, sizeof(buf1)) > 0) { if (BIO_gets(membio, buf2, sizeof(buf2)) <= 0) { TEST_error("Failed reading mem data"); @@ -417,6 +430,7 @@ static int compare_with_file(BIO *membio) err: OPENSSL_free(reffile); BIO_free(file); + BIO_free(newfile); return ret; } |