On Fri Feb 27, 2026 at 8:32 PM JST, Alexandre Courbot wrote:
>> +#[kunit_tests(nova_core_gsp_commands)]
>> +mod tests {
>> + use super::*;
>> +
>> + struct TestPayload {
>> + data: KVVec<u8>,
>> + }
>> +
>> + impl TestPayload {
>> + fn generate_pattern(len: usize) -> Result<KVVec<u8>> {
>> + let mut data = KVVec::with_capacity(len, GFP_KERNEL)?;
>> + for i in 0..len {
>> + data.push(i as u8, GFP_KERNEL)?;
>> + }
>> + Ok(data)
>> + }
>> +
>> + fn new(len: usize) -> Result<Self> {
>> + Ok(Self {
>> + data: Self::generate_pattern(len)?,
>> + })
>> + }
>> + }
>> +
>> + impl CommandToGsp for TestPayload {
>> + const FUNCTION: MsgFunction = MsgFunction::Nop;
>> + type Command = ();
>
> Since we are testing the size of the data written on the command queue,
> can you make the command itself larger than 0 bytes? Otherwise there is
> a potential for missing errors.
>
> I'm saying that because it actually happened to me, I used
> `MAX_CMD_SIZE` instead of `MAX_CMD_SIZE - size_of::<C::Command>()`
> somewhere, and despite it being broken the tests were passing.
Yeah good idea, particularly since you ran into it too. Added.