From 8fde1b9f2ce5dbae719a4323c31121f0c69ae201 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Tue, 30 Jul 2019 13:18:34 +0200 Subject: [PATCH] Mark API tests as skipped if setup phase fails. --- tests/api-test-2.c | 10 ++++++---- tests/api-test.c | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/tests/api-test-2.c b/tests/api-test-2.c index 6e3ccdd0..57e6dd99 100644 --- a/tests/api-test-2.c +++ b/tests/api-test-2.c @@ -4144,8 +4144,11 @@ int main(int argc, char *argv[]) register_cleanup(_cleanup); _cleanup(); - if (_setup()) - goto out; + if (_setup()) { + printf("Cannot set test devices.\n"); + _cleanup(); + exit(77); + } crypt_set_debug_level(_debug ? CRYPT_DEBUG_JSON : CRYPT_DEBUG_NONE); @@ -4171,7 +4174,6 @@ int main(int argc, char *argv[]) RUN_(Luks2Flags, "LUKS2 persistent flags"); RUN_(Luks2Reencryption, "LUKS2 reencryption"); RUN_(Luks2Repair, "LUKS2 repair"); // test disables metadata locking. Run always last! -out: - _cleanup(); + return 0; } diff --git a/tests/api-test.c b/tests/api-test.c index 0f58ce82..cf02aa7f 100644 --- a/tests/api-test.c +++ b/tests/api-test.c @@ -1888,8 +1888,11 @@ int main(int argc, char *argv[]) register_cleanup(_cleanup); _cleanup(); - if (_setup()) - goto out; + if (_setup()) { + printf("Cannot set test devices.\n"); + _cleanup(); + exit(77); + } crypt_set_debug_level(_debug ? CRYPT_DEBUG_ALL : CRYPT_DEBUG_NONE); @@ -1908,7 +1911,6 @@ int main(int argc, char *argv[]) RUN_(VerityTest, "DM verity"); RUN_(TcryptTest, "Tcrypt API"); RUN_(IntegrityTest, "Integrity API"); -out: - _cleanup(); + return 0; }