From nobody Tue May 7 00:56:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1588603193; cv=none; d=zohomail.com; s=zohoarc; b=dL2yZdTUNKKy+6ot9iII1ExSec2w9SM2gHM2+N5488L+Bc1oI3/GE/4fR2t8lQm8/LGluNv7rZH/V8ZN4YU+5tBzRgb13h2TGEkNdlKAzSiXy8ThvHP34PLOZbAyApxWAU5YPHFq6SvkrMDeREdCXzCMOhq4c5fsPgNxYnHXvIg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588603193; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=jpODtHtQW3yPYuR7Mqvcj4U+tAQ8zdEsYXt6dJbHbMA=; b=CI5SaniM0+K3JejcFY8vxzLVeBSCVgterVqBxnENE6gcXCanE4jW8gEVizs5boyZ7WMSNTqTCUAd8C69lM+ct3A2luRTxjI9hUsDQPcgFeYM6xgr1gO2p7nVA/zCTaFTBUDt2Zp10WAFPnPpX9GBdMJehjJKL8nNqF12En13VFE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 15886031935743.6159543203448266; Mon, 4 May 2020 07:39:53 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-352-Muh_DG5YOmawJYm_w9UCKA-1; Mon, 04 May 2020 10:39:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB43C57092; Mon, 4 May 2020 14:39:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3738519C4F; Mon, 4 May 2020 14:39:41 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E12494CAA0; Mon, 4 May 2020 14:39:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 044EdY0T028744 for ; Mon, 4 May 2020 10:39:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5AA5057990; Mon, 4 May 2020 14:39:34 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.36.110.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03DF86B8E6; Mon, 4 May 2020 14:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588603192; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jpODtHtQW3yPYuR7Mqvcj4U+tAQ8zdEsYXt6dJbHbMA=; b=ZEB+DHKQe85kcJU8e8S/DOSiTtNRNe0IxfBqwwwnF9NDoqoPj4Af4EgwIoqjQ6dJRZJDk1 Dk2mAUly7INB+CVUpVUTPQ3qx2fH0nnM9PPlmUgJMfzsNUTitndLgyY3M1e5YElspn3PFA U5NCFWdOeWgK4V+WLe3+IeyZp7CaqFI= X-MC-Unique: Muh_DG5YOmawJYm_w9UCKA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH] tests: poison $HOME and $XDG_RUNTIME_DIR env variables Date: Mon, 4 May 2020 15:39:25 +0100 Message-Id: <20200504143925.728767-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" To attempt to catch unit tests which accidentally create files in $HOME, or $XDG_RUNTIME_DIR, poison these env vars by pointing them to directories which don't exist. This should give easier to debug test failures. For example: $ VIR_TEST_DEBUG=3D1 ./qemuhotplugtest Could not initialize HostdevManager - operation failed: Failed to create st= ate dir '/bad-test-used-env-xdg-runtime-dir/libvirt/hostdevmgr' Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michal Privoznik --- tests/testutils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/testutils.c b/tests/testutils.c index 5fd81b70a2..8533a02d73 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -767,6 +767,9 @@ int virTestMain(int argc, preloads[npreloads] =3D NULL; } =20 + setenv("HOME", "/bad-test-used-env-home", 1); + setenv("XDG_RUNTIME_DIR", "/bad-test-used-env-xdg-runtime-dir", 1); + va_start(ap, func); while ((lib =3D va_arg(ap, const char *))) { if (!virFileIsExecutable(lib)) { --=20 2.26.2