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:
parent
8a2839c867
commit
8d1a946a9b
@ -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;
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user