Module Name:    src
Committed By:   gson
Date:           Thu Jul  8 18:10:52 UTC 2021

Modified Files:
        src/external/bsd/atf/dist/tools: atf-run.cpp

Log Message:
When running an individual test case under isolation, make the test
case count on the tp-start line of the output match the number of test
cases actually executed (one) so that the atf-run output is valid
input to atf-report.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/atf/dist/tools/atf-run.cpp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/atf/dist/tools/atf-run.cpp
diff -u src/external/bsd/atf/dist/tools/atf-run.cpp:1.6 src/external/bsd/atf/dist/tools/atf-run.cpp:1.7
--- src/external/bsd/atf/dist/tools/atf-run.cpp:1.6	Sat Apr 10 10:32:57 2021
+++ src/external/bsd/atf/dist/tools/atf-run.cpp	Thu Jul  8 18:10:52 2021
@@ -388,7 +388,22 @@ atf_run::run_test_program(const tools::f
     tools::fs::temp_dir resdir(
         tools::fs::path(tools::config::get("atf_workdir")) / "atf-run.XXXXXX");
 
-    w.start_tp(tp.str(), md.test_cases.size());
+    size_t nseltcs;
+    if (tc.empty()) {
+        nseltcs = md.test_cases.size();
+    } else {
+        nseltcs = 0;
+        for (std::map< std::string, vars_map >::const_iterator iter
+             = md.test_cases.begin(); iter != md.test_cases.end(); iter++) {
+            const std::string& tcname = (*iter).first;
+            if (tcname == tc)
+                nseltcs++;
+        }
+        if (nseltcs == 0)
+            throw std::runtime_error("No such test case");
+    }
+
+    w.start_tp(tp.str(), nseltcs);
     if (md.test_cases.empty()) {
         w.end_tp("Bogus test program: reported 0 test cases");
         errcode = EXIT_FAILURE;

Reply via email to