]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Show PPD load errors, stop test early for hard errors.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 17 Oct 2025 17:43:32 +0000 (13:43 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 17 Oct 2025 17:43:32 +0000 (13:43 -0400)
scheduler/testmime.c

index b53968bbd22c0cef3b6e35e01560ab0f51ede890..f159acde07501c6c37960bee3997092a9daee3bf 100644 (file)
@@ -70,6 +70,9 @@ main(int  argc,                               // I - Number of command-line args
         mime = mimeLoad(argv[i], filter_path);
         testEnd(mime != NULL);
 
+       if (!mime)
+         return (1);
+
        if (ppd)
          add_ppd_filters(mime, ppd);
       }
@@ -88,10 +91,21 @@ main(int  argc,                             // I - Number of command-line args
       if (i < argc)
       {
         testBegin("ppdOpenFile(\"%s\")", argv[i]);
-        ppd = ppdOpenFile(argv[i]);
-        testEnd(ppd != NULL);
-
-       if (mime)
+        if ((ppd = ppdOpenFile(argv[i])) != NULL)
+        {
+         testEnd(true);
+       }
+       else
+       {
+         ppd_status_t  status; // PPD error
+         int           linenum;// Line number of error
+
+         status = ppdLastError(&linenum);
+         testEndMessage(false, "%s on line %d", ppdErrorString(status), linenum);
+         return (1);
+       }
+
+       if (mime && ppd)
          add_ppd_filters(mime, ppd);
       }
     }
@@ -102,6 +116,8 @@ main(int  argc,                             // I - Number of command-line args
         testBegin("mimeLoad(\"../conf\", \"%s\")", filter_path);
        mime = mimeLoad("../conf", filter_path);
        testEnd(mime != NULL);
+       if (!mime)
+         return (1);
       }
 
       if (ppd)
@@ -146,6 +162,9 @@ main(int  argc,                             // I - Number of command-line args
     mime = mimeLoad("../conf", filter_path);
     testEnd(mime != NULL);
 
+    if (!mime)
+      return (1);
+
     if (ppd)
       add_ppd_filters(mime, ppd);
   }