From 8e1412d59319a19d61ea48985b13ef550e3ab9ec Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Wed, 3 May 2023 17:17:58 +0200 Subject: pkg/csource: compile single pseudo syscalls There seem to be a lot of unclear dependencies between pseudo syscall code and global methods. By testing them only together we have little chance to detect these problems because implementations can indiretly help one another. In addition to existing tests, also compile all pseudo syscalls independently. --- pkg/csource/csource_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'pkg/csource') diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go index 3e2c75a23..2eb8cd150 100644 --- a/pkg/csource/csource_test.go +++ b/pkg/csource/csource_test.go @@ -53,6 +53,23 @@ func TestGenerate(t *testing.T) { checked[target.OS] = true t.Parallel() testTarget(t, target, full) + testPseudoSyscalls(t, target) + }) + } +} + +func testPseudoSyscalls(t *testing.T, target *prog.Target) { + // Use options that are as minimal as possible. + // We want to ensure that the code can always be compiled. + opts := Options{ + Slowdown: 1, + } + rs := testutil.RandSource(t) + for _, meta := range target.PseudoSyscalls() { + p := target.GenSampleProg(meta, rs) + t.Run(fmt.Sprintf("single_%s", meta.CallName), func(t *testing.T) { + t.Parallel() + testOne(t, p, opts) }) } } -- cgit mrf-deployment