aboutsummaryrefslogtreecommitdiffstats
path: root/prog/encoding.go
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2021-09-03 16:20:07 +0000
committerAleksandr Nogikh <wp32pw@gmail.com>2021-09-22 15:40:02 +0200
commit1c202847db0380015a8920bfd21375c2d9f28ddb (patch)
tree6693da3a936398a9ac6678842ac181c5f0e3e429 /prog/encoding.go
parenta7ce77be27d8e3728b97122a005bc5b23298cfc3 (diff)
all: refactor fault injection into call props
Now that call properties mechanism is implemented, we can refactor fault injection. Unfortunately, it is impossible to remove all traces of the previous apprach. In reprolist and while performing syz-ci jobs, syzkaller still needs to parse the old format. Remove the old prog options-based approach whenever possible and replace it with the use of call properties.
Diffstat (limited to 'prog/encoding.go')
-rw-r--r--prog/encoding.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/prog/encoding.go b/prog/encoding.go
index 3f1c918a7..9161da6b2 100644
--- a/prog/encoding.go
+++ b/prog/encoding.go
@@ -81,11 +81,9 @@ func (ctx *serializer) call(c *Call) {
}
ctx.printf(")")
- defaultProps := DefaultCallProps()
anyChangedProps := false
c.Props.ForeachProp(func(name, key string, value reflect.Value) {
- defaultValue := reflect.ValueOf(defaultProps).FieldByName(name)
- if reflect.DeepEqual(value.Interface(), defaultValue.Interface()) {
+ if value.IsZero() {
return
}
@@ -352,7 +350,7 @@ func (p *parser) parseProg() (*Prog, error) {
func (p *parser) parseCallProps() CallProps {
nameToValue := map[string]reflect.Value{}
- callProps := DefaultCallProps()
+ callProps := CallProps{}
callProps.ForeachProp(func(_, key string, value reflect.Value) {
nameToValue[key] = value
})