diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2021-10-01 14:43:02 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2021-10-01 17:45:20 +0200 |
| commit | db0f57870523a9bff1629dad1a340ba8aac79d82 (patch) | |
| tree | 33b82e919cef96856bf952c78c76190885877fdd /pkg/csource/csource_test.go | |
| parent | cc80db955d0551c2456692da6176530dd27e08ed (diff) | |
pkg/csource: remove calls instead of skipping them
Currently csource skips calls at the very last moment, which has an
unpleasant consequence - if we make choice of enabled defines depend on
the individual calls or call properties, we may end up with defined yet
unused functions.
The perfect solution would be to untie
syz_emit_ethernet/syz_extract_tcp_res and NetInjection, and also to
untie VhciInjection and syz_emit_vhci.
For the time being, move these checks to the very beginning of csource
processing, so that these calls could be removed before we construct our
defines.
Adjust pkg/csource/csource_test.go to better cover fault injection
generation problems.
Diffstat (limited to 'pkg/csource/csource_test.go')
| -rw-r--r-- | pkg/csource/csource_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go index ebf22d5f9..aa242e876 100644 --- a/pkg/csource/csource_test.go +++ b/pkg/csource/csource_test.go @@ -58,10 +58,6 @@ func testTarget(t *testing.T, target *prog.Target, full bool) { // Testing 2 programs takes too long since we have lots of options permutations and OS/arch. // So we use the as-is in short tests and minimized version in full tests. syzProg := target.GenerateAllSyzProg(rs) - if len(syzProg.Calls) > 0 { - // Test fault injection generation as well. - p.Calls[0].Props.FailNth = 1 - } var opts []Options if !full || testing.Short() { p.Calls = append(p.Calls, syzProg.Calls...) @@ -74,6 +70,10 @@ func testTarget(t *testing.T, target *prog.Target, full bool) { p.Calls = append(p.Calls, minimized.Calls...) opts = allOptionsPermutations(target.OS) } + if len(p.Calls) > 0 { + // Test fault injection code generation as well. + p.Calls[0].Props.FailNth = 1 + } for opti, opts := range opts { if testing.Short() && opts.HandleSegv { // HandleSegv can radically increase compilation time/memory consumption on large programs. |
