File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,9 +15,9 @@ import (
1515)
1616
1717var (
18- ErrDeviceNotFound = errors .New ("no such device" )
19- ErrCommandNotFound = errors .New ("no such command" )
20- ErrNoPassthroughForArgs = errors .New ("arguments provided but command has no passthrough module to receive them" )
18+ ErrDeviceNotFound = errors .New ("no such device" )
19+ ErrCommandNotFound = errors .New ("no such command" )
20+ ErrNoReceiverForArgs = errors .New ("arguments provided but command has neither a passthrough module nor declared arguments to receive them" )
2121)
2222
2323// Devlist is a list of devices-under-test.
@@ -124,8 +124,11 @@ func (c *Command) countPassthrough() int {
124124// receive their statically configured Args with template references substituted
125125// using runtimeArgs. The returned slice has the same length and ordering as c.Modules.
126126func (c * Command ) ModuleArgs (runtimeArgs []string ) ([][]string , error ) {
127- if len (runtimeArgs ) > 0 && ! c .HasPassthrough () {
128- return nil , ErrNoPassthroughForArgs
127+ // Runtime args may be consumed either by a passthrough module or by
128+ // command-level templating (declared c.Args substituted via ${name}).
129+ // Only reject when neither can receive them.
130+ if len (runtimeArgs ) > 0 && ! c .HasPassthrough () && len (c .Args ) == 0 {
131+ return nil , ErrNoReceiverForArgs
129132 }
130133
131134 result := make ([][]string , len (c .Modules ))
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ func TestModuleArgs(t *testing.T) {
191191 }},
192192 runtimeArgs : []string {"a" },
193193 want : nil ,
194- err : ErrNoPassthroughForArgs ,
194+ err : ErrNoReceiverForArgs ,
195195 },
196196 {
197197 name : "mixed passthrough and non-passthrough" ,
@@ -222,7 +222,7 @@ func TestModuleArgs(t *testing.T) {
222222 cmd : Command {},
223223 runtimeArgs : []string {"a" },
224224 want : nil ,
225- err : ErrNoPassthroughForArgs ,
225+ err : ErrNoReceiverForArgs ,
226226 },
227227 {
228228 name : "error when runtime args provided but no passthrough module" ,
@@ -231,7 +231,7 @@ func TestModuleArgs(t *testing.T) {
231231 }},
232232 runtimeArgs : []string {"a" },
233233 want : nil ,
234- err : ErrNoPassthroughForArgs ,
234+ err : ErrNoReceiverForArgs ,
235235 },
236236 {
237237 name : "passthrough module with no runtime args" ,
You can’t perform that action at this time.
0 commit comments