From 9a3e39e29c78944b7e6181404a517118e54d40e4 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 15 Jan 2026 21:00:11 +0100 Subject: [PATCH] test: make pty test work under asan AddressSanitizer was right to complain about the test because it was passing an uninitialized `struct winsize` to openpty(). --- test/test-tty.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/test/test-tty.c b/test/test-tty.c index 1b1130382..abb76f348 100644 --- a/test/test-tty.c +++ b/test/test-tty.c @@ -421,10 +421,6 @@ TEST_IMPL(tty_pty) { #if defined(__QEMU__) RETURN_SKIP("Test does not currently work in QEMU"); #endif -#if defined(__ASAN__) - RETURN_SKIP("Test does not currently work in ASAN"); -#endif - #if defined(__APPLE__) || \ defined(__DragonFly__) || \ defined(__FreeBSD__) || \ @@ -432,16 +428,14 @@ TEST_IMPL(tty_pty) { defined(__NetBSD__) || \ defined(__OpenBSD__) int master_fd, slave_fd, r; - struct winsize w; uv_loop_t loop; uv_tty_t master_tty, slave_tty; - ASSERT_OK(uv_loop_init(&loop)); - - r = openpty(&master_fd, &slave_fd, NULL, NULL, &w); + r = openpty(&master_fd, &slave_fd, NULL, NULL, NULL); if (r != 0) RETURN_SKIP("No pty available, skipping."); + ASSERT_OK(uv_loop_init(&loop)); ASSERT_OK(uv_tty_init(&loop, &slave_tty, slave_fd, 0)); ASSERT_OK(uv_tty_init(&loop, &master_tty, master_fd, 0)); ASSERT(uv_is_readable((uv_stream_t*) &slave_tty));