[Openvpn-devel,v1] test_tls_crypt: Fix test failure on Windows
Commit Message
From: Frank Lichtenheld <frank@lichtenheld.com>
- Exclude tests that use verify_script on Windows.
We currently do not have openvpn_execve available
for Windows tests. It would also need more work
to replace the hardcoded paths.
- Use platform_gen_path instead of hard-coding /
Do to the previous change that is not strictly
necessary, but it also doesn't hurt and it fixes
at least one issue if anyone ever decides to port
this to Windows).
Change-Id: I45ddc8e350d3948b3197ae725df102d8ce73fa77
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1781
---
This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1781
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Lev Stipakov <lstipakov@gmail.com>
Comments
Failing tests "on some platforms" are most annoying, because you keep
ignoring *real* fails then, after a while... so thanks for fixing this.
Gerrit says "all green" which is all I want here ;-)
Your patch has been applied to the master and release/2.7 branch
("fix test infra").
commit a3942a62ff3c8e8f0a5dc577e24552a4d4fa5fb0 (master)
commit d8bbfbc56c5f15080d781f7307aebb2d809d36e8 (release/2.7)
Author: Frank Lichtenheld
Date: Tue Jul 14 14:12:29 2026 +0200
test_tls_crypt: Fix test failure on Windows
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Lev Stipakov <lstipakov@gmail.com>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1781
Message-Id: <20260714121238.13936-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg37593.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
Hi,
On Tue, Jul 14, 2026 at 04:31:27PM +0200, Gert Doering wrote:
> Failing tests "on some platforms" are most annoying, because you keep
> ignoring *real* fails then, after a while... so thanks for fixing this.
>
> Gerrit says "all green" which is all I want here ;-)
>
> Your patch has been applied to the master and release/2.7 branch
> ("fix test infra").
>
> commit a3942a62ff3c8e8f0a5dc577e24552a4d4fa5fb0 (master)
> commit d8bbfbc56c5f15080d781f7307aebb2d809d36e8 (release/2.7)
> Author: Frank Lichtenheld
> Date: Tue Jul 14 14:12:29 2026 +0200
As it turns out, release/2.6 GHA builds also fail because of this
(the original problem patch was part of the large "CVEs everywhere"
series that was also merged to release/2.6) - so I have backported
this to 2.6 as well
commit dbffaae19600d537ddc616c507ee0df72ae2b5a3 (release/2.6)
the change is straightforward, just "git cherry-pick" was getting confused
by "older code base" and flagged many conflicts that really were none.
Tested via GHA, which builds and runs this on macOS, Linux, and Windows
(well, #ifndef _WIN32, so it does not technically "run *this* test on
Windows", but the rest of the test_tls_crypt unit test is back to "green").
gert
@@ -811,7 +811,6 @@
target_sources(test_mbuf PRIVATE
tests/unit_tests/openvpn/mock_get_random.c
- src/openvpn/buffer.c
src/openvpn/mbuf.c
)
@@ -710,7 +710,7 @@
assert_true(tls_crypt_v2_extract_client_key(&tmp, &wrap_ctx, &tls_options));
tls_wrap_free(&wrap_ctx);
-
+#ifndef _WIN32
/* Use /bin/true as verify script */
script_security_set(2);
tls_options.tls_crypt_v2_verify_script = "/usr/bin/true";
@@ -727,11 +727,12 @@
* platform_create_temp_file() */
char non_random_tmpfile[128];
snprintf(non_random_tmpfile, sizeof(non_random_tmpfile),
- "%s/" PACKAGE "_tls_crypt_v2_metadata__%08" PRIx64 "%08" PRIx64 ".tmp",
- tls_options.tmp_dir, get_random(), get_random());
- unlink(non_random_tmpfile);
+ PACKAGE "_tls_crypt_v2_metadata__%08" PRIx64 "%08" PRIx64 ".tmp",
+ get_random(), get_random());
+ const char *tmpfile_path = platform_gen_path(tls_options.tmp_dir, non_random_tmpfile, &ctx->gc);
+ unlink(tmpfile_path);
- expect_string(__wrap_buffer_write_file, filename, non_random_tmpfile);
+ expect_string(__wrap_buffer_write_file, filename, tmpfile_path);
/* We do not write the first byte (type) to the file but rather to a
* metadata_type environment variable */
@@ -752,7 +753,7 @@
tls_options.tls_crypt_v2_verify_script = "/bin/false";
}
- expect_string(__wrap_buffer_write_file, filename, non_random_tmpfile);
+ expect_string(__wrap_buffer_write_file, filename, tmpfile_path);
expect_memory(__wrap_buffer_write_file, pem, buf_bptr(&expected_metadata), buf_len(&expected_metadata));
will_return(__wrap_buffer_write_file, true);
@@ -760,8 +761,8 @@
assert_false(tls_crypt_v2_extract_client_key(&tmp, &wrap_ctx, &tls_options));
tls_wrap_free(&wrap_ctx);
-
tls_options.tls_crypt_v2_verify_script = NULL;
+#endif
/* An outdated time should fail */
tmp = create_client_key_input(ctx, 31);