This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git

commit 19ab61477364da1481a24fc710c7adfe27b06051
Author: Szymon Janc <[email protected]>
AuthorDate: Fri Oct 9 15:11:44 2026 +0200

    newt/cli: Don't run the same unit test multiple times
    
    When overlapping packages were specified (e.g. foo and foo/test)
    the same unit test was built and executed more than once.
    
    Assisted-by: Claude:claude-opus-5-5
---
 newt/cli/build_cmds.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/newt/cli/build_cmds.go b/newt/cli/build_cmds.go
index fdde81d3..e06e7e9d 100644
--- a/newt/cli/build_cmds.go
+++ b/newt/cli/build_cmds.go
@@ -248,6 +248,7 @@ func testRunCmd(cmd *cobra.Command, args []string, exclude 
string, executeShell
        // Verify and resolve each specified package.
        testAll := false
        packs := []*pkg.LocalPackage{}
+       seen := map[*pkg.LocalPackage]struct{}{}
 
        if list {
                packItfs := proj.PackagesOfType(pkg.PACKAGE_TYPE_UNITTEST)
@@ -286,7 +287,12 @@ func testRunCmd(cmd *cobra.Command, args []string, exclude 
string, executeShell
                                        "unit tests", pack.FullName()))
                        }
 
-                       packs = append(packs, testPkgs...)
+                       for _, p := range testPkgs {
+                               if _, ok := seen[p]; !ok {
+                                       seen[p] = struct{}{}
+                                       packs = append(packs, p)
+                               }
+                       }
                }
        }
 

Reply via email to