1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: update unit-tests

Fix some memleaks.
Drop call of bcache_clear_fd() when bache was not initialized.
This commit is contained in:
Zdenek Kabelac 2024-04-09 23:04:25 +02:00
parent 8a2839c867
commit 8d1a946a9b
3 changed files with 9 additions and 3 deletions

View File

@ -34,8 +34,8 @@
#define SECTOR_SHIFT 9L
#define FD_TABLE_INC 1024
static int _fd_table_size;
static int *_fd_table;
static int _fd_table_size = 0;
static int *_fd_table = NULL;
//----------------------------------------------------------------

View File

@ -107,7 +107,6 @@ static void _fix_exit(void *fixture)
if (f) {
(void) close(f->fd);
bcache_clear_fd(f->di);
(void) unlink(f->fname);
free(f->data);
if (f->e)
@ -157,6 +156,9 @@ static void _test_read(void *fixture)
T_ASSERT(!io.error);
_check_buffer(f->data, 123, SECTOR_SIZE * BLOCK_SIZE_SECTORS);
bcache_destroy(cache);
f->e = NULL; // already destroyed
}
static void _test_write(void *fixture)
@ -175,6 +177,9 @@ static void _test_write(void *fixture)
T_ASSERT(f->e->wait(f->e, _complete_io));
T_ASSERT(io.completed);
T_ASSERT(!io.error);
bcache_destroy(cache);
f->e = NULL; // already destroyed
}
static void _test_write_bytes(void *fixture)

View File

@ -99,6 +99,7 @@ static void _check_good(struct example_good *es, unsigned count)
fprintf(stderr, "\n");
#endif
T_ASSERT(_status_eq(&e->status, pr.status));
free(pr.status->device);
free(pr.status);
}
}