Fix leaks from not freeing status in tests (#5973)
Part of https://github.com/google/iree/issues/5715
diff --git a/build_tools/kokoro/gcp_ubuntu/cmake/linux/x86-swiftshader-asan/build.sh b/build_tools/kokoro/gcp_ubuntu/cmake/linux/x86-swiftshader-asan/build.sh
index 66f0e1b..081139f 100755
--- a/build_tools/kokoro/gcp_ubuntu/cmake/linux/x86-swiftshader-asan/build.sh
+++ b/build_tools/kokoro/gcp_ubuntu/cmake/linux/x86-swiftshader-asan/build.sh
@@ -107,9 +107,6 @@
# These tests currently have asan failures
# TODO(#5715): Fix these
declare -a excluded_tests=(
- "iree/base/internal/file_io_test"
- "iree/base/internal/wait_handle_test"
- "iree/base/testing/dynamic_library_test"
"iree/hal/cts/allocator_test"
"iree/hal/cts/buffer_mapping_test"
"iree/hal/cts/command_buffer_test"
diff --git a/iree/base/internal/wait_handle_test.cc b/iree/base/internal/wait_handle_test.cc
index b2d9f28..02e0332 100644
--- a/iree/base/internal/wait_handle_test.cc
+++ b/iree/base/internal/wait_handle_test.cc
@@ -211,10 +211,10 @@
TEST(WaitSet, UnreasonableCapacity) {
iree_wait_set_t* wait_set = NULL;
- IREE_EXPECT_STATUS_IS(
- IREE_STATUS_INVALID_ARGUMENT,
- iree_wait_set_allocate(1 * 1024 * 1024, iree_allocator_system(),
- &wait_set));
+ iree_status_t status = iree_wait_set_allocate(
+ 1 * 1024 * 1024, iree_allocator_system(), &wait_set);
+ IREE_EXPECT_STATUS_IS(IREE_STATUS_INVALID_ARGUMENT, status);
+ iree_status_free(status);
}
// Tests that inserting the same handles multiple times is tracked correctly.
diff --git a/iree/base/testing/dynamic_library_test.cc b/iree/base/testing/dynamic_library_test.cc
index 322a0d1..27c4ba5 100644
--- a/iree/base/testing/dynamic_library_test.cc
+++ b/iree/base/testing/dynamic_library_test.cc
@@ -85,10 +85,11 @@
TEST_F(DynamicLibraryTest, LoadLibraryFailure) {
iree_dynamic_library_t* library = NULL;
- EXPECT_THAT(iree_dynamic_library_load_from_file(
- kUnknownName, IREE_DYNAMIC_LIBRARY_FLAG_NONE,
- iree_allocator_system(), &library),
- StatusIs(iree::StatusCode::kNotFound));
+ iree_status_t status = iree_dynamic_library_load_from_file(
+ kUnknownName, IREE_DYNAMIC_LIBRARY_FLAG_NONE, iree_allocator_system(),
+ &library);
+ IREE_EXPECT_STATUS_IS(IREE_STATUS_NOT_FOUND, status);
+ iree_status_free(status);
}
TEST_F(DynamicLibraryTest, LoadLibraryTwice) {
@@ -126,9 +127,10 @@
iree_allocator_system(), &library));
int (*fn_ptr)(int);
- EXPECT_THAT(
- iree_dynamic_library_lookup_symbol(library, "unknown", (void**)&fn_ptr),
- StatusIs(iree::StatusCode::kNotFound));
+ iree_status_t status =
+ iree_dynamic_library_lookup_symbol(library, "unknown", (void**)&fn_ptr);
+ IREE_EXPECT_STATUS_IS(IREE_STATUS_NOT_FOUND, status);
+ iree_status_free(status);
EXPECT_EQ(nullptr, fn_ptr);
iree_dynamic_library_release(library);