wtwire: s/harness/wireMsgHarness
This slightly more descriptive name obviates the repetitive comments at every call site.
This commit is contained in:
1 file changed
+12
-28
@@ -18,12 +18,12 @@ func prefixWithMsgType(data []byte, prefix MessageType) []byte {
|
|||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
// harness performs the actual fuzz testing of the appropriate wire message.
|
// wireMsgHarness performs the actual fuzz testing of the appropriate wire
|
||||||
// This function will check that the passed-in message passes wire length
|
// message. This function will check that the passed-in message passes wire
|
||||||
// checks, is a valid message once deserialized, and passes a sequence of
|
// length checks, is a valid message once deserialized, and passes a sequence of
|
||||||
// serialization and deserialization checks. Returns an int that determines
|
// serialization and deserialization checks. Returns an int that determines
|
||||||
// whether the input is unique or not.
|
// whether the input is unique or not.
|
||||||
func harness(t *testing.T, data []byte, emptyMsg Message) {
|
func wireMsgHarness(t *testing.T, data []byte, emptyMsg Message) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
// Create a reader with the byte array.
|
// Create a reader with the byte array.
|
||||||
@@ -64,9 +64,7 @@ func FuzzCreateSessionReply(f *testing.F) {
|
|||||||
// check if the max payload constraint is violated.
|
// check if the max payload constraint is violated.
|
||||||
emptyMsg := CreateSessionReply{}
|
emptyMsg := CreateSessionReply{}
|
||||||
|
|
||||||
// Pass the message into our general fuzz harness for wire
|
wireMsgHarness(t, data, &emptyMsg)
|
||||||
// messages!
|
|
||||||
harness(t, data, &emptyMsg)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,9 +77,7 @@ func FuzzCreateSession(f *testing.F) {
|
|||||||
// check if the max payload constraint is violated.
|
// check if the max payload constraint is violated.
|
||||||
emptyMsg := CreateSession{}
|
emptyMsg := CreateSession{}
|
||||||
|
|
||||||
// Pass the message into our general fuzz harness for wire
|
wireMsgHarness(t, data, &emptyMsg)
|
||||||
// messages!
|
|
||||||
harness(t, data, &emptyMsg)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,9 +90,7 @@ func FuzzDeleteSessionReply(f *testing.F) {
|
|||||||
// check if the max payload constraint is violated.
|
// check if the max payload constraint is violated.
|
||||||
emptyMsg := DeleteSessionReply{}
|
emptyMsg := DeleteSessionReply{}
|
||||||
|
|
||||||
// Pass the message into our general fuzz harness for wire
|
wireMsgHarness(t, data, &emptyMsg)
|
||||||
// messages!
|
|
||||||
harness(t, data, &emptyMsg)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,9 +103,7 @@ func FuzzDeleteSession(f *testing.F) {
|
|||||||
// check if the max payload constraint is violated.
|
// check if the max payload constraint is violated.
|
||||||
emptyMsg := DeleteSession{}
|
emptyMsg := DeleteSession{}
|
||||||
|
|
||||||
// Pass the message into our general fuzz harness for wire
|
wireMsgHarness(t, data, &emptyMsg)
|
||||||
// messages!
|
|
||||||
harness(t, data, &emptyMsg)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,9 +116,7 @@ func FuzzError(f *testing.F) {
|
|||||||
// check if the max payload constraint is violated.
|
// check if the max payload constraint is violated.
|
||||||
emptyMsg := Error{}
|
emptyMsg := Error{}
|
||||||
|
|
||||||
// Pass the message into our general fuzz harness for wire
|
wireMsgHarness(t, data, &emptyMsg)
|
||||||
// messages!
|
|
||||||
harness(t, data, &emptyMsg)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,9 +129,7 @@ func FuzzInit(f *testing.F) {
|
|||||||
// check if the max payload constraint is violated.
|
// check if the max payload constraint is violated.
|
||||||
emptyMsg := Init{}
|
emptyMsg := Init{}
|
||||||
|
|
||||||
// Pass the message into our general fuzz harness for wire
|
wireMsgHarness(t, data, &emptyMsg)
|
||||||
// messages!
|
|
||||||
harness(t, data, &emptyMsg)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,9 +142,7 @@ func FuzzStateUpdateReply(f *testing.F) {
|
|||||||
// check if the max payload constraint is violated.
|
// check if the max payload constraint is violated.
|
||||||
emptyMsg := StateUpdateReply{}
|
emptyMsg := StateUpdateReply{}
|
||||||
|
|
||||||
// Pass the message into our general fuzz harness for wire
|
wireMsgHarness(t, data, &emptyMsg)
|
||||||
// messages!
|
|
||||||
harness(t, data, &emptyMsg)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,8 +155,6 @@ func FuzzStateUpdate(f *testing.F) {
|
|||||||
// check if the max payload constraint is violated.
|
// check if the max payload constraint is violated.
|
||||||
emptyMsg := StateUpdate{}
|
emptyMsg := StateUpdate{}
|
||||||
|
|
||||||
// Pass the message into our general fuzz harness for wire
|
wireMsgHarness(t, data, &emptyMsg)
|
||||||
// messages!
|
|
||||||
harness(t, data, &emptyMsg)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user