Received: from eggs.gnu.org ([2001:4830:134:3::10]:49211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b0WIi-0001Mu-NR for qemu-devel@nongnu.org; Wed, 11 May 2016 11:43:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b0WIh-0006fz-3q for qemu-devel@nongnu.org; Wed, 11 May 2016 11:43:52 -0400 References: <1460633543-7366-1-git-send-email-silbe@linux.vnet.ibm.com> <1461094442-16014-1-git-send-email-silbe@linux.vnet.ibm.com> From: Max Reitz Message-ID: Date: Wed, 11 May 2016 17:43:42 +0200 MIME-Version: 1.0 In-Reply-To: <1461094442-16014-1-git-send-email-silbe@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7brOVLKVJOBK9vBN4RieteNIp61UIWj41" Subject: Re: [Qemu-devel] [PATCH for-2.6? v2] qemu-iotests: iotests: fail hard if not run via "check" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sascha Silbe , qemu-devel@nongnu.org, qemu-block@nongnu.org, Kevin Wolf Cc: Tu Bo This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --7brOVLKVJOBK9vBN4RieteNIp61UIWj41 From: Max Reitz To: Sascha Silbe , qemu-devel@nongnu.org, qemu-block@nongnu.org, Kevin Wolf Cc: Tu Bo Message-ID: Subject: Re: [PATCH for-2.6? v2] qemu-iotests: iotests: fail hard if not run via "check" References: <1460633543-7366-1-git-send-email-silbe@linux.vnet.ibm.com> <1461094442-16014-1-git-send-email-silbe@linux.vnet.ibm.com> In-Reply-To: <1461094442-16014-1-git-send-email-silbe@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 19.04.2016 21:34, Sascha Silbe wrote: > Running an iotests-based Python test directly might appear to work, > but may fail in subtle ways and is insecure: >=20 > - It creates files with predictable file names in a world-writable > location (/var/tmp). >=20 > - Tests expect the environment to be set up by check. E.g. 041 and 055 > may take the wrong code paths if QEMU_DEFAULT_MACHINE is not > set. This can lead to false negatives. >=20 > Instead fail hard and tell the user we want to be run via "check". >=20 > The actual environment expected by the tests is currently only defined > by the implementation of "check". We use two of the environment > variables set by "check" as indication of whether we're being run via > "check". Anyone writing their own test runner (replacing "check") will > need to replicate the full environment (in a broader sense, not just > environment variables) provided by "check" anyway, including setting > the two environment variables we check. Whereas a regular developer > just trying to invoke the tests usually won't have both of these > defined in their environment so we can catch their mistake and give > out useful advice. >=20 > Signed-off-by: Sascha Silbe > Reviewed-by: Bo Tu > --- > v1=E2=86=92v2: > - Add comment indicating that it's not just TEST_DIR and > QEMU_DEFAULT_MACHINE that need to be set. Amend commit message in > a similar way. >=20 > @Tu Bo: I'm assuming your Reviewed-By: still stands as I only added > more information on the background of the change and the check. > --- > tests/qemu-iotests/iotests.py | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) Having noted Markus' objections, I have still applied this patch to my block-next tree (https://github.com/XanClic/qemu/commits/block-next), for the following reasons: First, I think it's reasonable to require users to find the source of this error (which is really trivial, and the environment is self-explaining) if they wish to write an own iotest platform. Second, most of the Python tests fail with an exception anyway because they try to os.path.join() the iotests.test_dir (which is None) with a string before the main method is even invoked. Therefore, this is basically only a backup for the few tests that somehow get past this point, so you generally won't see this error message anyway. Max --7brOVLKVJOBK9vBN4RieteNIp61UIWj41 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXM1MuAAoJEDuxQgLoOKyt9eEH/3wjD10l1LNKSL8ILR5kaWIu xgwGZ7YHg7SWYtwtIZ304w9jUs70VQkr7dACAqP9u4fYiq1YeLW+SEYjmj/lSEnk 9yNTWGyukrKrQziBd0G0MVju1bG/BrQ0Xqerma4SfW1AZ4YFRdfuZ8OwqdFnYK4F 8r6X3m0nR9IAxck/D9SdLzcVi9g/5jxnc9fnNBhoCPcX3YVtpGRTHmjY92TzXgPp mLvtH7qnS5Led2lA3yJ8wqUZYzA3dKLpRY6u2KhEbMRm+EKmkg6NPT/VL/AyKFWr +ki8ZAmuuXpFEMW+v588LWAfEDxRSfJMfdMI0clKKtDW/EFTtR1+V5Gu/LfKDsk= =QOcI -----END PGP SIGNATURE----- --7brOVLKVJOBK9vBN4RieteNIp61UIWj41--