[geos-commits] [SCM] GEOS branch main updated. ad2d66fb863fdfdc213dc6f07d8349e839bf801d

git at osgeo.org git at osgeo.org
Tue Jul 14 10:54:15 PDT 2026


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, main has been updated
       via  ad2d66fb863fdfdc213dc6f07d8349e839bf801d (commit)
      from  1d559c659e0862d5e4ff738391a9258d048d68b9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ad2d66fb863fdfdc213dc6f07d8349e839bf801d
Author: Daniel Baston <dbaston at gmail.com>
Date:   Tue Jul 14 13:53:53 2026 -0400

    XMLTester: add --test-index and --case-index arguments (#1477)

diff --git a/tests/xmltester/XMLTester.cpp b/tests/xmltester/XMLTester.cpp
index 3e4aac3a0..c493890de 100644
--- a/tests/xmltester/XMLTester.cpp
+++ b/tests/xmltester/XMLTester.cpp
@@ -419,11 +419,17 @@ XMLTester::parseRun(const tinyxml2::XMLNode* node)
     wkbwriter.reset(new io::WKBWriter());
 
     const tinyxml2::XMLNode* casenode;
+
+    int icase = 1;
+
     for(casenode = node->FirstChildElement("case");
             casenode;
             casenode = casenode->NextSiblingElement("case")) {
         try {
-            parseCase(casenode);
+            if (caseNum == 0 || icase == caseNum) {
+                parseCase(casenode);
+            }
+            icase++;
         }
         catch(const std::exception& exc) {
             std::cerr << exc.what() << std::endl;
@@ -592,12 +598,16 @@ XMLTester::parseCase(const tinyxml2::XMLNode* node)
 
     ++caseCount;
     testCount = 0;
+    int itest = 1;
 
     const tinyxml2::XMLNode* testnode;
     for(testnode = node->FirstChildElement("test");
             testnode;
             testnode = testnode->NextSiblingElement("test")) {
-       runTest(testnode);
+        if (testNum == 0 || itest == testNum) {
+            runTest(testnode);
+        }
+        itest++;
     }
 
     totalTestCount += testCount;
@@ -1426,7 +1436,9 @@ usage(char* me, int exitcode, std::ostream& os)
        << "--test-valid-output  Test output validity" << std::endl
        << "--test-valid-input   Test input validity" << std::endl
        << "--sql-output         Produce SQL output" << std::endl
-       << "--wkb-output         Print Geometries as HEXWKB" << std::endl;
+       << "--wkb-output         Print Geometries as HEXWKB" << std::endl
+       << "--case-index [n]     Run only the specified case number (1-indexed)" << std::endl
+       << "--test-index [n]     Run only the specified test number (1-indexed)" << std::endl;
 
     std::exit(exitcode);
 }
@@ -1482,6 +1494,16 @@ main(int argC, char* argV[])
                 tester.setTestInputValidity(true);
                 continue;
             }
+            if (!std::strcmp(argV[i], "--case-index")) {
+                int caseNum = std::atoi(argV[++i]);
+                tester.setCaseNumber(caseNum);
+                continue;
+            }
+            if (!std::strcmp(argV[i], "--test-index")) {
+                int opNum = std::atoi(argV[++i]);
+                tester.setTestNumber(opNum);
+                continue;
+            }
 
             std::string source = argV[i];
 
diff --git a/tests/xmltester/XMLTester.h b/tests/xmltester/XMLTester.h
index 4a10b9fb1..170bb5d18 100644
--- a/tests/xmltester/XMLTester.h
+++ b/tests/xmltester/XMLTester.h
@@ -56,6 +56,9 @@ private:
     int testFileCount;
     int totalTestCount;
 
+    int caseNum = 0;
+    int testNum = 0;
+
     const std::string* curr_file;
     std::string curr_case_desc;
 
@@ -89,6 +92,14 @@ public:
      */
     int setVerbosityLevel(int val);
 
+    void setCaseNumber(int num) {
+        caseNum = num;
+    }
+
+    void setTestNumber(int num) {
+        testNum = num;
+    }
+
     void setTestOutputValidity(bool val)
     {
         testValidOutput = val;

-----------------------------------------------------------------------

Summary of changes:
 tests/xmltester/XMLTester.cpp | 28 +++++++++++++++++++++++++---
 tests/xmltester/XMLTester.h   | 11 +++++++++++
 2 files changed, 36 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list