@@ -235,7 +235,7 @@ func pkgnames(pkgs []*pkg.LocalPackage) string {
235
235
return s
236
236
}
237
237
238
- func testRunCmd (cmd * cobra.Command , args []string , exclude string , executeShell bool ) {
238
+ func testRunCmd (cmd * cobra.Command , args []string , exclude string , executeShell bool , valgrind bool ) {
239
239
if len (args ) < 1 {
240
240
NewtUsage (cmd , nil )
241
241
}
@@ -320,7 +320,7 @@ func testRunCmd(cmd *cobra.Command, args []string, exclude string, executeShell
320
320
util .StatusMessage (util .VERBOSITY_DEFAULT , "Testing package %s\n " ,
321
321
pack .FullName ())
322
322
323
- err = b .SelfTestExecute ()
323
+ err = b .SelfTestExecute (valgrind )
324
324
if err == nil {
325
325
passedPkgs = append (passedPkgs , pack )
326
326
} else {
@@ -435,6 +435,7 @@ func sizeRunCmd(cmd *cobra.Command, args []string, ram bool, flash bool, section
435
435
func AddBuildCommands (cmd * cobra.Command ) {
436
436
var printShellCmds bool
437
437
var executeShell bool
438
+ var valgrind bool
438
439
439
440
buildCmd := & cobra.Command {
440
441
Use : "build <target-name> [target-names...]" ,
@@ -474,12 +475,14 @@ func AddBuildCommands(cmd *cobra.Command) {
474
475
Use : "test <package-name> [package-names...] | all" ,
475
476
Short : "Executes unit tests for one or more packages" ,
476
477
Run : func (cmd * cobra.Command , args []string ) {
477
- testRunCmd (cmd , args , exclude , executeShell )
478
+ testRunCmd (cmd , args , exclude , executeShell , valgrind )
478
479
},
479
480
}
480
481
testCmd .Flags ().StringVarP (& exclude , "exclude" , "e" , "" , "Comma separated list of packages to exclude" )
481
482
testCmd .Flags ().BoolVar (& executeShell , "executeShell" , false ,
482
483
"Execute build command using /bin/sh (Linux and MacOS only)" )
484
+ testCmd .Flags ().BoolVar (& valgrind , "valgrind" , false ,
485
+ "Run test executables under Valgrind" )
483
486
cmd .AddCommand (testCmd )
484
487
AddTabCompleteFn (testCmd , func () []string {
485
488
return append (testablePkgList (), "all" , "allexcept" )
0 commit comments