From 686f72afdda4ff17a04878e5869934cf13988360 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Mon, 2 Nov 2026 10:47:00 -0600 Subject: [PATCH] Return strings from test plugins instead of printing The test plugins' saySomething() printed an animal noise to stdout on every call. The stress tests call it from 500 threads each, producing ~5k lines of Meow/Bark/Quack per CI run. Return the string instead so the tests still call into the loaded plugin code without the console noise. Signed-off-by: Michael Carroll --- test/base.hpp | 2 +- test/global_plugins.cpp | 18 +++++++++--------- test/plugins1.cpp | 22 +++++++++++----------- test/plugins2.cpp | 18 +++++++++--------- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/test/base.hpp b/test/base.hpp index 4e5aac2..3d82960 100644 --- a/test/base.hpp +++ b/test/base.hpp @@ -43,7 +43,7 @@ class Base { public: virtual ~Base() = default; - virtual void saySomething() = 0; + virtual std::string saySomething() = 0; }; class BaseWithInterfaceCtor diff --git a/test/global_plugins.cpp b/test/global_plugins.cpp index 3c9865d..e47c7fb 100644 --- a/test/global_plugins.cpp +++ b/test/global_plugins.cpp @@ -30,7 +30,7 @@ * 2020, Copied from plugins1.cpp and plugins2.cpp and changing class names */ -#include +#include #include "class_loader/class_loader.hpp" @@ -39,36 +39,36 @@ class Kangaroo : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("[Angry growl]\n"); + return "[Angry growl]"; } }; class Panda : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("[Excited squeaks!!!]\n"); + return "[Excited squeaks!!!]"; } }; class Hyena : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("[Cackling laugh]\n"); + return "[Cackling laugh]"; } }; class Alpaca : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("hhhaaaaaaaaaa\n"); + return "hhhaaaaaaaaaa"; } }; diff --git a/test/plugins1.cpp b/test/plugins1.cpp index 5d4872d..7ba1b45 100644 --- a/test/plugins1.cpp +++ b/test/plugins1.cpp @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include "class_loader/class_loader.hpp" @@ -36,45 +36,45 @@ class Dog : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("Bark\n"); + return "Bark"; } }; class Cat : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("Meow\n"); + return "Meow"; } }; class Duck : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("Quack\n"); + return "Quack"; } }; class Cow : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("Moooo\n"); + return "Moooo"; } }; class Sheep : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("Baaah\n"); + return "Baaah"; } }; diff --git a/test/plugins2.cpp b/test/plugins2.cpp index 40a66f2..4b50403 100644 --- a/test/plugins2.cpp +++ b/test/plugins2.cpp @@ -27,7 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include "class_loader/class_loader.hpp" @@ -36,36 +36,36 @@ class Robot : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("Beep boop\n"); + return "Beep boop"; } }; class Alien : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("Znornoff!!!\n"); + return "Znornoff!!!"; } }; class Monster : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("BEAAAHHHH\n"); + return "BEAAAHHHH"; } }; class Zombie : public Base { public: - void saySomething() override + std::string saySomething() override { - printf("Brains!!!\n"); + return "Brains!!!"; } };