qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: unit: simplify test-visitor-serialization list tests


From: Markus Armbruster
Subject: Re: [PATCH] tests: unit: simplify test-visitor-serialization list tests
Date: Tue, 06 Sep 2022 07:17:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Paolo Bonzini <pbonzini@redhat.com> writes:

> test-visitor-serialization list tests is using an "if" to pick either the 
> first
> element of the list or the next one.  This was done presumably to mimic the
> code that creates the list, which has to fill in either the head pointer
> or the next pointer of the last element.  However, the code in the insert
> phase is a pretty standard singly-linked list insertion, while the one
> in the visit phase looks weird and even looks at the first item twice:
> this is confusing because the test puts in 32 items and finishes with
> an assertion that i == 33.
>
> So, move the "else" step in a separate switch statement, and change
> the do...while loop to a while, because cur_head has already been
> initialized beforehand.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Still a rather smelly bowl of copy-pasta, but this is incremental
improvement, so:
Reviewed-by: Markus Armbruster <armbru@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]