Commit 696d754bba for ffmpeg

commit 696d754bba149239b33df9bd287cc060e24a8eba
Author: Kacper Michajłow <kasper93@gmail.com>
Date:   Tue Sep 22 18:34:17 2026 +0200

    avutil/tests/error: print only the FFmpeg-defined codes

    The errno descriptions come from the C library where strerror_r() is
    available and from the built-in table elsewhere, so the output differed
    between platforms and could not be compared against a reference. Look
    the errno codes up without printing them and fail when any code is not
    found.

    Signed-off-by: Kacper Michajłow <kasper93@gmail.com>

diff --git a/libavutil/tests/error.c b/libavutil/tests/error.c
index 774c71fcb9..0eb6c09fe7 100644
--- a/libavutil/tests/error.c
+++ b/libavutil/tests/error.c
@@ -18,27 +18,43 @@

 #include "libavutil/error.c"

-static const char *const tag_list[] = {
-#define ERROR_TAG(CODE, DESC) #CODE,
-#define ERROR_TAG2(CODE, CODE2, DESC) #CODE,
+/* errno descriptions depend on the C library, so those are only looked up */
+static const struct {
+    int num;
+    const char *tag;
+} ffmpeg_codes[] = {
+#define ERROR_TAG(CODE, DESC)         { AVERROR_ ## CODE, #CODE },
+#define ERROR_TAG2(CODE, CODE2, DESC) { AVERROR_ ## CODE, #CODE },
     AVERROR_LIST(ERROR_TAG, ERROR_TAG2)
-#if !HAVE_STRERROR_R
-    STRERROR_LIST(ERROR_TAG)
-#endif
+};
+
+static const int errno_codes[] = {
+#define ERRNO_CODE(CODE, DESC) AVERROR(CODE),
+    STRERROR_LIST(ERRNO_CODE)
 };

 int main(void)
 {
-    int i;
+    char buf[AV_ERROR_MAX_STRING_SIZE];
+    int ret = 0;
+
+    for (size_t i = 0; i < FF_ARRAY_ELEMS(ffmpeg_codes); i++) {
+        int num = ffmpeg_codes[i].num;

-    for (i = 0; i < FF_ARRAY_ELEMS(error_entries); i++) {
-        const struct ErrorEntry *entry = &error_entries[i];
-        printf("%d: %s [%s]\n", entry->num, av_err2str(entry->num), tag_list[i]);
+        if (av_strerror(num, buf, sizeof(buf)) < 0) {
+            printf("%d: lookup failed [%s]\n", num, ffmpeg_codes[i].tag);
+            ret = 1;
+            continue;
+        }
+        printf("%d: %s [%s]\n", num, buf, ffmpeg_codes[i].tag);
     }

-    for (i = 0; i < 256; i++) {
-        printf("%d: %s\n", -i, av_err2str(-i));
+    for (size_t i = 0; i < FF_ARRAY_ELEMS(errno_codes); i++) {
+        if (av_strerror(errno_codes[i], buf, sizeof(buf)) < 0) {
+            printf("errno %d: lookup failed\n", AVUNERROR(errno_codes[i]));
+            ret = 1;
+        }
     }

-    return 0;
+    return ret;
 }