mirror of
https://github.com/linux-can/can-utils.git
synced 2026-11-04 07:21:13 +01:00
Add expected_size field to test patterns to properly validate cases where the requested read size exceeds the actual file size. This allows testing the server's behavior when clients request more data than is available. When a read request is larger than the file, the server correctly returns data up to EOF. The test framework now distinguishes between this expected scenario and genuine read failures. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> [socketcan: addressed review comments from PR #629: - keep uint32_t instead of size_t for offset/read_size/expected_size: ISO 11783-13 limits the file offset (Seek File) and the file size (directory entry) to 32 bit, so uint32_t matches the protocol. The sum offset + read_size can exceed 32 bit (see UINT32_MAX pattern) and is therefore calculated in int64_t. size_t would not help here as it is only 32 bit wide on 32 bit targets. - remaining_size is a signed int64_t: the signed type is needed to detect the 'remaining_size < 0' case (server returned more data than requested) and int64_t holds the 33 bit sum on all platforms. - fix printf format for the uint32_t read_offset (%zu -> %u)] Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>