From nobody Wed May 8 21:36:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1588336243; cv=none; d=zohomail.com; s=zohoarc; b=OKusDTvGZOLGtOyK5MDvuZOfInXQsGHa5xmj9xaInPOVnKEg7cr16UKvg0nsqL0Io7vRkOcaLzEuGgFSR96sqBInLcLplLXH/8hVVype1S5xnMbiiKbWWzDl9kdtW/HsfVO2JxkorOw7gylVQ2sfu8yKEyy2ZTY08aLx0khno+E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588336243; 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=Zu6RhUfQtAmnV209PVEfRke36P+mcAAH/ndLbwbu5QM=; b=dQmKYfM6dY1LB0yZGtHPuq8MSN2bYrnw/45JrViKquKCMLl8qMx3WiGlHRvPctD/W1A6fgv1k/mD5T8yGxcBqcGtVo7PDwK6bemV0rRSVZY+NBYNbHohVZZ/+2EBRx74rTGdb9CpLhXh3uJtEZJ6Zn8s7grPy7x8I9fUjIMGEiE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1588336243273364.7557735578414; Fri, 1 May 2020 05:30:43 -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-237-3-4-rV1IMTG3OGNFV5N4Rg-1; Fri, 01 May 2020 08:30:39 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2BB8E462; Fri, 1 May 2020 12:30:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B1AEE5D9CA; Fri, 1 May 2020 12:30:30 +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 DE27D1809542; Fri, 1 May 2020 12:30:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 041CUO92015890 for ; Fri, 1 May 2020 08:30:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7545D5EE11; Fri, 1 May 2020 12:30:24 +0000 (UTC) Received: from kinshicho.usersys.redhat.com (unknown [10.40.192.163]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A39415D787 for ; Fri, 1 May 2020 12:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588336242; 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=Zu6RhUfQtAmnV209PVEfRke36P+mcAAH/ndLbwbu5QM=; b=DUxBBDkTN96klIyzZYyOj/wZO8hR9/6xnSaRnb2okrvgdoAFPS8ByWSHQRAAFA0g3NwaUj L1s256BbHLj8DSc4RUYmNNkOPM/16sTT3IEB9MU5jQo/+E99WCWozdgSb61auY93EmvHbo lgwZbPPz/Kt2yUcMddKiLDMEOwbo1Iw= X-MC-Unique: 3-4-rV1IMTG3OGNFV5N4Rg-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH] tests: Mock virGetUserRuntimeDirectory() for qemuhotplug Date: Fri, 1 May 2020 14:30:16 +0200 Message-Id: <20200501123016.453866-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.79 on 10.5.11.14 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" Not mocking this function results in files being created in the user's home directory when running the test and in the build failing altogether inside a constrained environment such as the one used by pbuilder: Could not initialize HostdevManager - operation failed: Failed to create state dir '/nonexistent/.cache/libvirt/hostdevmgr' Signed-off-by: Andrea Bolognani --- tests/qemuhotplugmock.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/qemuhotplugmock.c b/tests/qemuhotplugmock.c index d2324913cf..27c81670a3 100644 --- a/tests/qemuhotplugmock.c +++ b/tests/qemuhotplugmock.c @@ -27,6 +27,7 @@ =20 static int (*real_virGetDeviceID)(const char *path, int *maj, int *min); static bool (*real_virFileExists)(const char *path); +static char *(*real_virGetUserRuntimeDirectory)(void); =20 static void init_syms(void) @@ -36,6 +37,7 @@ init_syms(void) =20 VIR_MOCK_REAL_INIT(virGetDeviceID); VIR_MOCK_REAL_INIT(virFileExists); + VIR_MOCK_REAL_INIT(virGetUserRuntimeDirectory); } =20 unsigned long long @@ -106,3 +108,10 @@ void qemuProcessKillManagedPRDaemon(virDomainObjPtr vm G_GNUC_UNUSED) { } + +char * +virGetUserRuntimeDirectory(void) +{ + return g_build_filename(g_getenv("LIBVIRT_FAKE_ROOT_DIR"), + "user-runtime-directory", NULL); +} --=20 2.25.4