summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-05-07 13:40:18 -0700
committerLinus Groh <mail@linusgroh.de>2021-05-08 00:04:10 +0100
commit4b8b8b91c2d463b3a4ca6ea8a268f67631f84e5e (patch)
tree16cf48afd419684744367d6384cb023aa8f8a2ea
parent7f51754780f5ca0487f9fd1bba9ba9c22497643c (diff)
downloadserenity-4b8b8b91c2d463b3a4ca6ea8a268f67631f84e5e.zip
LibTest: Convert Crash test runner to outln(..)
-rw-r--r--Userland/Libraries/LibTest/CrashTest.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Userland/Libraries/LibTest/CrashTest.cpp b/Userland/Libraries/LibTest/CrashTest.cpp
index a6e1f3ae61..5eba071c75 100644
--- a/Userland/Libraries/LibTest/CrashTest.cpp
+++ b/Userland/Libraries/LibTest/CrashTest.cpp
@@ -20,19 +20,19 @@ Crash::Crash(String test_type, Function<Crash::Failure()> crash_function)
bool Crash::run(RunType run_type)
{
- printf("\x1B[33mTesting\x1B[0m: \"%s\"\n", m_type.characters());
+ outln("\x1B[33mTesting\x1B[0m: \"{}\"", m_type);
auto run_crash_and_print_if_error = [this]() -> bool {
auto failure = m_crash_function();
// If we got here something went wrong
- printf("\x1B[31mFAIL\x1B[0m: ");
+ out("\x1B[31mFAIL\x1B[0m: ");
switch (failure) {
case Failure::DidNotCrash:
- printf("Did not crash!\n");
+ outln("Did not crash!");
break;
case Failure::UnexpectedError:
- printf("Unexpected error!\n");
+ outln("Unexpected error!");
break;
default:
VERIFY_NOT_REACHED();
@@ -43,7 +43,6 @@ bool Crash::run(RunType run_type)
if (run_type == RunType::UsingCurrentProcess) {
return run_crash_and_print_if_error();
} else {
-
// Run the test in a child process so that we do not crash the crash program :^)
pid_t pid = fork();
if (pid < 0) {
@@ -57,7 +56,7 @@ bool Crash::run(RunType run_type)
int status;
waitpid(pid, &status, 0);
if (WIFSIGNALED(status)) {
- printf("\x1B[32mPASS\x1B[0m: Terminated with signal %d\n", WTERMSIG(status));
+ outln("\x1B[32mPASS\x1B[0m: Terminated with signal {}", WTERMSIG(status));
return true;
}
return false;