diff options
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/decl.go | 16 | ||||
| -rw-r--r-- | sys/decl_test.go | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/decl.go b/sys/decl.go index 270ae4582..0956a94ee 100644 --- a/sys/decl.go +++ b/sys/decl.go @@ -521,14 +521,26 @@ func TransitivelyEnabledCalls(enabled map[*Call]bool) map[*Call]bool { for c := range enabled { supported[c] = true } + inputResources := make(map[*Call][]*ResourceType) + ctors := make(map[string][]*Call) + for c := range supported { + inputs := c.InputResources() + inputResources[c] = inputs + for _, res := range inputs { + if _, ok := ctors[res.Desc.Name]; ok { + continue + } + ctors[res.Desc.Name] = resourceCtors(res.Desc.Kind, true) + } + } for { n := len(supported) haveGettime := supported[CallMap["clock_gettime"]] for c := range supported { canCreate := true - for _, res := range c.InputResources() { + for _, res := range inputResources[c] { noctors := true - for _, ctor := range resourceCtors(res.Desc.Kind, true) { + for _, ctor := range ctors[res.Desc.Name] { if supported[ctor] { noctors = false break diff --git a/sys/decl_test.go b/sys/decl_test.go index c41a95e43..18385c321 100644 --- a/sys/decl_test.go +++ b/sys/decl_test.go @@ -8,6 +8,7 @@ import ( ) func TestTransitivelyEnabledCalls(t *testing.T) { + t.Parallel() calls := make(map[*Call]bool) for _, c := range Calls { calls[c] = true @@ -37,6 +38,7 @@ func TestTransitivelyEnabledCalls(t *testing.T) { } func TestClockGettime(t *testing.T) { + t.Parallel() calls := make(map[*Call]bool) for _, c := range Calls { calls[c] = true |
