From a8a70f62c07261e721816445d9c408c770cf45a2 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Tue, 9 May 2023 22:25:27 +0200 Subject: Fix build errors of tests with --enable-debug-log The errors were: ../../tests/set_option.c:146:31: error: no member named 'debug' in 'struct libusb_context' LIBUSB_EXPECT(==, test_ctx->debug, 4); ~~~~~~~~ ^ ../../tests/set_option.c:74:40: note: expanded from macro 'LIBUSB_EXPECT' int64_t _lhs = (int64_t)(intptr_t)(lhs), _rhs = (int64_t)(intptr_t)(rhs); \ ^~~ ../../tests/set_option.c:152:31: error: no member named 'debug' in 'struct libusb_context' LIBUSB_EXPECT(==, test_ctx->debug, 4); ~~~~~~~~ ^ ../../tests/set_option.c:74:40: note: expanded from macro 'LIBUSB_EXPECT' int64_t _lhs = (int64_t)(intptr_t)(lhs), _rhs = (int64_t)(intptr_t)(rhs); \ ^~~ 2 errors generated. ../../tests/init_context.c:112:31: error: no member named 'debug' in 'struct libusb_context' LIBUSB_EXPECT(==, test_ctx->debug, LIBUSB_LOG_LEVEL_ERROR); ~~~~~~~~ ^ ../../tests/init_context.c:74:40: note: expanded from macro 'LIBUSB_EXPECT' int64_t _lhs = (int64_t)(intptr_t)(lhs), _rhs = (int64_t)(intptr_t)(rhs); \ ^~~ ../../tests/init_context.c:140:31: error: no member named 'log_handler' in 'struct libusb_context' LIBUSB_EXPECT(==, test_ctx->log_handler, test_log_cb); ~~~~~~~~ ^ ../../tests/init_context.c:74:40: note: expanded from macro 'LIBUSB_EXPECT' int64_t _lhs = (int64_t)(intptr_t)(lhs), _rhs = (int64_t)(intptr_t)(rhs); \ ^~~ 2 errors generated. Signed-off-by: Ludovic Rousseau --- tests/set_option.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/set_option.c') diff --git a/tests/set_option.c b/tests/set_option.c index 3c658c6..df2ae1d 100644 --- a/tests/set_option.c +++ b/tests/set_option.c @@ -143,13 +143,17 @@ static libusb_testlib_result test_set_log_level_env(void) { setenv("LIBUSB_DEBUG", "4", /*overwrite=*/0); LIBUSB_TEST_RETURN_ON_ERROR(libusb_init_context(&test_ctx, /*options=*/NULL, /*num_options=*/0)); +#ifndef ENABLE_DEBUG_LOGGING LIBUSB_EXPECT(==, test_ctx->debug, 4); +#endif LIBUSB_TEST_RETURN_ON_ERROR(libusb_set_option(test_ctx, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_ERROR)); /* environment variable should always override LIBUSB_OPTION_LOG_LEVEL if set */ +#ifndef ENABLE_DEBUG_LOGGING LIBUSB_EXPECT(==, test_ctx->debug, 4); +#endif LIBUSB_TEST_CLEAN_EXIT(TEST_STATUS_SUCCESS); #else -- cgit v1.2.1