diff --git a/tests/api-test.c b/tests/api-test.c index eee85c8a..5ab8c37f 100644 --- a/tests/api-test.c +++ b/tests/api-test.c @@ -324,28 +324,33 @@ static int _system(const char *command, int warn) return r; } +#if HAVE_DECL_DM_TASK_RETRY_REMOVE +#define DM_RETRY "--retry " +#else +#deinfe DM_RETRY "" +#endif + static void _cleanup_dmdevices(void) { struct stat st; - if (!stat(DMDIR H_DEVICE, &st)) { - _system("dmsetup remove " H_DEVICE, 0); - } - if (!stat(DMDIR H_DEVICE_WRONG, &st)) { - _system("dmsetup remove " H_DEVICE_WRONG, 0); - } - if (!stat(DMDIR L_DEVICE_0S, &st)) { - _system("dmsetup remove " L_DEVICE_0S, 0); - } - if (!stat(DMDIR L_DEVICE_1S, &st)) { - _system("dmsetup remove " L_DEVICE_1S, 0); - } - if (!stat(DMDIR L_DEVICE_WRONG, &st)) { - _system("dmsetup remove " L_DEVICE_WRONG, 0); - } - if (!stat(DMDIR L_DEVICE_OK, &st)) { - _system("dmsetup remove " L_DEVICE_OK, 0); - } + if (!stat(DMDIR H_DEVICE, &st)) + _system("dmsetup remove " DM_RETRY H_DEVICE, 0); + + if (!stat(DMDIR H_DEVICE_WRONG, &st)) + _system("dmsetup remove " DM_RETRY H_DEVICE_WRONG, 0); + + if (!stat(DMDIR L_DEVICE_0S, &st)) + _system("dmsetup remove " DM_RETRY L_DEVICE_0S, 0); + + if (!stat(DMDIR L_DEVICE_1S, &st)) + _system("dmsetup remove " DM_RETRY L_DEVICE_1S, 0); + + if (!stat(DMDIR L_DEVICE_WRONG, &st)) + _system("dmsetup remove " DM_RETRY L_DEVICE_WRONG, 0); + + if (!stat(DMDIR L_DEVICE_OK, &st)) + _system("dmsetup remove " DM_RETRY L_DEVICE_OK, 0); t_dev_offset = 0; } @@ -357,16 +362,16 @@ static void _cleanup(void) //_system("udevadm settle", 0); if (!stat(DMDIR CDEVICE_1, &st)) - _system("dmsetup remove " CDEVICE_1, 0); + _system("dmsetup remove " DM_RETRY CDEVICE_1, 0); if (!stat(DMDIR CDEVICE_2, &st)) - _system("dmsetup remove " CDEVICE_2, 0); + _system("dmsetup remove " DM_RETRY CDEVICE_2, 0); if (!stat(DEVICE_EMPTY, &st)) - _system("dmsetup remove " DEVICE_EMPTY_name, 0); + _system("dmsetup remove " DM_RETRY DEVICE_EMPTY_name, 0); if (!stat(DEVICE_ERROR, &st)) - _system("dmsetup remove " DEVICE_ERROR_name, 0); + _system("dmsetup remove " DM_RETRY DEVICE_ERROR_name, 0); _cleanup_dmdevices();