test: make pty test work under asan (#4996)
AddressSanitizer was right to complain about the test because it was passing an uninitialized `struct winsize` to openpty().
This commit is contained in:
parent
d67f9d2fba
commit
3908e54252
@ -421,10 +421,6 @@ TEST_IMPL(tty_pty) {
|
|||||||
#if defined(__QEMU__)
|
#if defined(__QEMU__)
|
||||||
RETURN_SKIP("Test does not currently work in QEMU");
|
RETURN_SKIP("Test does not currently work in QEMU");
|
||||||
#endif
|
#endif
|
||||||
#if defined(__ASAN__)
|
|
||||||
RETURN_SKIP("Test does not currently work in ASAN");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__APPLE__) || \
|
#if defined(__APPLE__) || \
|
||||||
defined(__DragonFly__) || \
|
defined(__DragonFly__) || \
|
||||||
defined(__FreeBSD__) || \
|
defined(__FreeBSD__) || \
|
||||||
@ -432,16 +428,14 @@ TEST_IMPL(tty_pty) {
|
|||||||
defined(__NetBSD__) || \
|
defined(__NetBSD__) || \
|
||||||
defined(__OpenBSD__)
|
defined(__OpenBSD__)
|
||||||
int master_fd, slave_fd, r;
|
int master_fd, slave_fd, r;
|
||||||
struct winsize w;
|
|
||||||
uv_loop_t loop;
|
uv_loop_t loop;
|
||||||
uv_tty_t master_tty, slave_tty;
|
uv_tty_t master_tty, slave_tty;
|
||||||
|
|
||||||
ASSERT_OK(uv_loop_init(&loop));
|
r = openpty(&master_fd, &slave_fd, NULL, NULL, NULL);
|
||||||
|
|
||||||
r = openpty(&master_fd, &slave_fd, NULL, NULL, &w);
|
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
RETURN_SKIP("No pty available, skipping.");
|
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, &slave_tty, slave_fd, 0));
|
||||||
ASSERT_OK(uv_tty_init(&loop, &master_tty, master_fd, 0));
|
ASSERT_OK(uv_tty_init(&loop, &master_tty, master_fd, 0));
|
||||||
ASSERT(uv_is_readable((uv_stream_t*) &slave_tty));
|
ASSERT(uv_is_readable((uv_stream_t*) &slave_tty));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user