From 88b8bd0f1e404174ce992e4194395bba0f14cf3f Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Thu, 13 Sep 2018 19:13:56 +0100 Subject: [PATCH] Tests: use consistent output spacing and flush before running each test. --- src/tests/cptests/cptests.cc | 20 ++++++++++---------- src/tests/loadtests.cc | 8 ++++---- src/tests/proctests.cc | 2 +- src/tests/tests.cc | 35 ++++++++++++++++++----------------- 4 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/tests/cptests/cptests.cc b/src/tests/cptests/cptests.cc index 33f2bde..ab3fdb5 100644 --- a/src/tests/cptests/cptests.cc +++ b/src/tests/cptests/cptests.cc @@ -646,20 +646,20 @@ void cptest_addrmdeps() #define RUN_TEST(name, spacing) \ - std::cout << #name "..." spacing; \ + std::cout << #name "..." spacing << std::flush; \ name(); \ std::cout << "PASSED" << std::endl; int main(int argc, char **argv) { - RUN_TEST(cptest_queryver, " "); - RUN_TEST(cptest_listservices, ""); - RUN_TEST(cptest_findservice1, ""); - RUN_TEST(cptest_findservice2, ""); - RUN_TEST(cptest_findservice3, ""); - RUN_TEST(cptest_loadservice, " "); - RUN_TEST(cptest_startstop, " "); - RUN_TEST(cptest_unload, " "); - RUN_TEST(cptest_addrmdeps, " "); + RUN_TEST(cptest_queryver, " "); + RUN_TEST(cptest_listservices, " "); + RUN_TEST(cptest_findservice1, " "); + RUN_TEST(cptest_findservice2, " "); + RUN_TEST(cptest_findservice3, " "); + RUN_TEST(cptest_loadservice, " "); + RUN_TEST(cptest_startstop, " "); + RUN_TEST(cptest_unload, " "); + RUN_TEST(cptest_addrmdeps, " "); return 0; } diff --git a/src/tests/loadtests.cc b/src/tests/loadtests.cc index cbca7e0..4c786df 100644 --- a/src/tests/loadtests.cc +++ b/src/tests/loadtests.cc @@ -49,15 +49,15 @@ void test_nonexistent() } #define RUN_TEST(name, spacing) \ - std::cout << #name "..." spacing; \ + std::cout << #name "..." spacing << std::flush; \ name(); \ std::cout << "PASSED" << std::endl; int main(int argc, char **argv) { init_test_service_dir(); - RUN_TEST(test_basic, " "); - RUN_TEST(test_env_subst, " "); - RUN_TEST(test_nonexistent, ""); + RUN_TEST(test_basic, " "); + RUN_TEST(test_env_subst, " "); + RUN_TEST(test_nonexistent, " "); return 0; } diff --git a/src/tests/proctests.cc b/src/tests/proctests.cc index 0199583..27c0c64 100644 --- a/src/tests/proctests.cc +++ b/src/tests/proctests.cc @@ -788,7 +788,7 @@ void test_waitsfor_restart() #define RUN_TEST(name, spacing) \ - std::cout << #name "..." spacing; \ + std::cout << #name "..." spacing << std::flush; \ name(); \ std::cout << "PASSED" << std::endl; diff --git a/src/tests/tests.cc b/src/tests/tests.cc index cfdaf80..dd1510d 100644 --- a/src/tests/tests.cc +++ b/src/tests/tests.cc @@ -552,26 +552,27 @@ void test12() assert(sset.count_active_services() == 0); } -#define RUN_TEST(name) \ - std::cout << #name "... "; \ + +#define RUN_TEST(name, spacing) \ + std::cout << #name "..." spacing << std::flush; \ name(); \ std::cout << "PASSED" << std::endl; int main(int argc, char **argv) { - RUN_TEST(test1); - RUN_TEST(test2); - RUN_TEST(test3); - RUN_TEST(test4); - RUN_TEST(test5); - RUN_TEST(test_pin1); - RUN_TEST(test_pin2); - RUN_TEST(test_pin3); - RUN_TEST(test_pin4); - RUN_TEST(test7); - RUN_TEST(test8); - RUN_TEST(test9); - RUN_TEST(test10); - RUN_TEST(test11); - RUN_TEST(test12); + RUN_TEST(test1, " "); + RUN_TEST(test2, " "); + RUN_TEST(test3, " "); + RUN_TEST(test4, " "); + RUN_TEST(test5, " "); + RUN_TEST(test_pin1, " "); + RUN_TEST(test_pin2, " "); + RUN_TEST(test_pin3, " "); + RUN_TEST(test_pin4, " "); + RUN_TEST(test7, " "); + RUN_TEST(test8, " "); + RUN_TEST(test9, " "); + RUN_TEST(test10, " "); + RUN_TEST(test11, " "); + RUN_TEST(test12, " "); } -- 2.25.1