Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/atf/dist/tools When running an individual test ...



details:   https://anonhg.NetBSD.org/src/rev/f37ae43f0436
branches:  trunk
changeset: 1022195:f37ae43f0436
user:      gson <gson%NetBSD.org@localhost>
date:      Thu Jul 08 18:10:52 2021 +0000

description:
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.

diffstat:

 external/bsd/atf/dist/tools/atf-run.cpp |  17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diffs (27 lines):

diff -r d2b972c54d7a -r f37ae43f0436 external/bsd/atf/dist/tools/atf-run.cpp
--- a/external/bsd/atf/dist/tools/atf-run.cpp   Thu Jul 08 18:02:22 2021 +0000
+++ b/external/bsd/atf/dist/tools/atf-run.cpp   Thu Jul 08 18:10:52 2021 +0000
@@ -388,7 +388,22 @@
     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;



Home | Main Index | Thread Index | Old Index