From a93049056add14aa8b15b64f63541efb4e0611a2 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sun, 3 Oct 2021 23:10:08 +0200 Subject: [PATCH] tests: Run all tests multiple times Tests are all done pretty quickly anyways and this should detect use-after-frees and co --- tests/source/main.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/source/main.cpp b/tests/source/main.cpp index 6683bc9cc..e21dbf6c8 100644 --- a/tests/source/main.cpp +++ b/tests/source/main.cpp @@ -30,10 +30,6 @@ void addFunctions() { int test(int argc, char **argv) { auto &testPatterns = TestPattern::getTests(); - ON_SCOPE_EXIT { - for (auto &[key, value] : TestPattern::getTests()) - delete value; - }; // Check if a test to run has been provided if (argc != 2) { @@ -106,7 +102,18 @@ int test(int argc, char **argv) { } int main(int argc, char **argv) { - auto result = test(argc, argv); + int result = EXIT_SUCCESS; + + for (u32 i = 0; i < 16; i++) { + result = test(argc, argv); + if (result != EXIT_SUCCESS) + break; + } + + ON_SCOPE_EXIT { + for (auto &[key, value] : TestPattern::getTests()) + delete value; + }; if (result == EXIT_SUCCESS) hex::log::info("Success!");