[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on globa
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest |
Date: |
Thu, 24 Aug 2017 12:20:54 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 24/08/2017 12:09, Markus Armbruster wrote:
> Cut-and-paste cuts both ways (pardon the pun):
>
> initialize with QTestState A
> frobnicate with QTestState A
> glomnify with QTestState A
> frobnicate with QTestState A
> initialize with QTestState B
> boingboing with QTestState B
> finalize with QTestState A
> finalize with QTestState A
>
> Uh, forgot to frobnicate after boingboing, let me fix that real quick!
>
> initialize with QTestState A
> frobnicate with QTestState A
> glomnify with QTestState A
> frobnicate with QTestState A
> initialize with QTestState B
> boingboing with QTestState B
> frobnicate with QTestState A
> finalize with QTestState A
> finalize with QTestState A
>
> Spot the pasto.
>
> This hasty paste would simply work with global_qtest. I'm not claiming
> there are cases that are just the opposite. I'm just challenging your
> apparent claim that the long forms help with avoiding or catching
> pastos. Can you explain how they help more than they hurt?
A pasto without global_qtest is local.
But cut-and-paste that involves _assigning_ global_qtest, even if it
doesn't have cut-and-paste mistakes, may create a mess of functions
knowing^Wbelieving they know what global_qtest is.
Assigning global_qtest means the short-form functions have effectively
dynamic binding. In a perfect world, global_qtest would be static and
the create-and-assign-global would assert(!global_qtest). Then >1 VM ->
don't use the short forms.
Paolo
> A bit of global state isn't automatically bad. *Shared* global state is
> what gets us into trouble. Can you point to examples where global_qtest
> is shared in ways that aren't 100% trivial?
- [Qemu-devel] [PATCH v5 08/13] tests: Rely more on global_qtest, (continued)
- [Qemu-devel] [PATCH v5 08/13] tests: Rely more on global_qtest, Eric Blake, 2017/08/18
- Re: [Qemu-devel] [PATCH v5 08/13] tests: Rely more on global_qtest, John Snow, 2017/08/18
- Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest, Paolo Bonzini, 2017/08/19
- Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest, Eric Blake, 2017/08/23
- Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest, Paolo Bonzini, 2017/08/23
- Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest, Eric Blake, 2017/08/23
- Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest, Paolo Bonzini, 2017/08/23
- Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest, Markus Armbruster, 2017/08/24
- Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest, Paolo Bonzini, 2017/08/24
- Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest, Markus Armbruster, 2017/08/24
- Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest,
Paolo Bonzini <=
- Re: [Qemu-devel] [Qemu-block] [PATCH v5 08/13] tests: Rely more on global_qtest, Markus Armbruster, 2017/08/24
[Qemu-devel] [PATCH v5 11/13] libqtest: Drop many static inline qtest_ wrappers, Eric Blake, 2017/08/18