From 2eaf73d9e0255ed021745feee9f6b9a6823b65f8 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Fri, 21 Jun 2024 16:16:35 +0200
Subject: [PATCH] Errors on non-threaded platforms are limited to 128 bytes
---
test/testautomation_main.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/test/testautomation_main.c b/test/testautomation_main.c
index 99d39478d3acd..e1dd958b3d4e5 100644
--- a/test/testautomation_main.c
+++ b/test/testautomation_main.c
@@ -9,6 +9,7 @@
#include <SDL3/SDL.h>
#include <SDL3/SDL_test.h>
#include "testautomation_suites.h"
+#include "build_config/SDL_build_config.h"
/**
* Tests SDL_InitSubSystem() and SDL_QuitSubSystem()
@@ -96,6 +97,7 @@ main_testSetError(void *arg)
char error_input[1024];
int result;
const char *error;
+ size_t expected_len;
SDLTest_AssertPass("SDL_SetError(NULL)");
result = SDL_SetError(NULL);
@@ -118,8 +120,14 @@ main_testSetError(void *arg)
result = SDL_SetError("%s", error_input);
SDLTest_AssertCheck(result == -1, "SDL_SetError(\"abc...\") -> %d (expected %d)", result, -1);
error = SDL_GetError();
+
+#ifdef SDL_THREADS_DISABLED
+ expected_len = 128 - 1;
+#else
+ expected_len = sizeof(error_input) - 1;
+#endif
SDLTest_AssertPass("Verify SDL error is identical to the input error");
- SDLTest_CompareMemory(error, SDL_strlen(error), error_input, SDL_strlen(error_input));
+ SDLTest_CompareMemory(error, SDL_strlen(error), error_input, expected_len);
return TEST_COMPLETED;
}