From nobody Sun May 5 09:04:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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 (zoho.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=1573815928; cv=none; d=zoho.com; s=zohoarc; b=X8T8Bzdvu6z5hgCAn2WutmTp54FACDF7HirvJza1rtgI5u2SOJ7e3rsk5IUFI/Y9PvlrxfmVfSfFBIFFHAmzhNuGGqX8m2qFyiQv99GZ6PM4fz3PjW5UKhqdVX55YHwo0oa8Sfm1cVYCeRv4lGRJsS6e3lCGnseFFS2y4jEvqUE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573815928; 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=JUm/fLyV8+wnnGgs4WlYroFixp9b9WA//Buma4FGRB8=; b=IzOWkk6tT7jDwmrIyrZsSRLVRleUNs1OnJpZ46KHa5OZrjAX0PA+UGT7dg3MaHQENs1seYmyA898W2Sgqh4IafrohQ8iSl6X0sIdNtQEjrNUp0V46ayrP1zKPrTQqAeRH7TUzFIR854hkm5WGqr7uuVY5THACKoYZ9QcSZcrnRU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.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 1573815928070153.65148536594438; Fri, 15 Nov 2019 03:05:28 -0800 (PST) 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-244-IvwpmdtHOEuyQAnq9GqgZQ-1; Fri, 15 Nov 2019 06:05:25 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B859801E7E; Fri, 15 Nov 2019 11:05:19 +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 124366293B; Fri, 15 Nov 2019 11:05:17 +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 826C94BB65; Fri, 15 Nov 2019 11:05:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAFB5AnX022120 for ; Fri, 15 Nov 2019 06:05:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id BA0D51036C7E; Fri, 15 Nov 2019 11:05:10 +0000 (UTC) Received: from moe.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4548D1036C74 for ; Fri, 15 Nov 2019 11:05:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573815926; 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=JUm/fLyV8+wnnGgs4WlYroFixp9b9WA//Buma4FGRB8=; b=YVN0VLDJmYld4h4NVR5j4Gy705jgqiE3FokDyfpUvWfHTn8Rh0f+vKPBC6l7F+tAUPeM8I F1AOnMd6JGUjp+I2//yyZ4drUri+ctJeveYAmJ9Yxpg3FdNHaHf9t+LPL2iMM9p9WILIgY Df197ctJsmnxlgVM9FDXn36laNpfJco= From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 15 Nov 2019 12:05:06 +0100 Message-Id: <9e4445ebc31aeea2b8e961d8756e4e015f5ac71d.1573815871.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] tests: Mock access to /dev/kvm 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.15 X-MC-Unique: IvwpmdtHOEuyQAnq9GqgZQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Some of our tests try to validate domain XMLs they are working with (not intentionally, simply because they call top level domain XML parse function). Anyway, this implies that we build domain capabilities also - see virQEMUDriverGetDomainCapabilities(). And since some domain XMLs are type of 'kvm' the control gets through virQEMUCapsFillDomainCaps() and virHostCPUGetKVMMaxVCPUs() to opening /dev/kvm which may be missing on the machine we're running 'make check'. Previously, we did not see this issue, because it was masked. If building domain capabilities failed for whatever reason, we ignored the failure. Only v5.9.0-207-gc69e6edea3 uncovered the problem (it changed reval from 0 to -1 if virQEMUDriverGetDomainCapabilities() fails). Since the referenced commit is correct, we need to mock access to /dev/kvm in our tests. Signed-off-by: Michal Privoznik --- Pushed under broken build rule. tests/qemuhotplugtest.c | 1 + tests/qemumemlocktest.c | 4 +++- tests/qemusecuritytest.c | 3 ++- tests/qemuxml2argvtest.c | 1 + tests/qemuxml2xmltest.c | 1 + tests/securityselinuxlabeltest.c | 4 +++- 6 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index a914a8a8b5..7d70113b6e 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -878,5 +878,6 @@ mymain(void) =20 VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virpci"), + VIR_TEST_MOCK("domaincaps"), VIR_TEST_MOCK("virprocess"), VIR_TEST_MOCK("qemuhotplug")); diff --git a/tests/qemumemlocktest.c b/tests/qemumemlocktest.c index 52cd9f9f26..ef3bfa0345 100644 --- a/tests/qemumemlocktest.c +++ b/tests/qemumemlocktest.c @@ -151,7 +151,9 @@ mymain(void) return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } =20 -VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virpci")) +VIR_TEST_MAIN_PRELOAD(mymain, + VIR_TEST_MOCK("virpci"), + VIR_TEST_MOCK("domaincaps")) =20 #else =20 diff --git a/tests/qemusecuritytest.c b/tests/qemusecuritytest.c index 685ac4dca2..8c0a48bb65 100644 --- a/tests/qemusecuritytest.c +++ b/tests/qemusecuritytest.c @@ -217,4 +217,5 @@ mymain(void) return ret; } =20 -VIR_TEST_MAIN(mymain) +VIR_TEST_MAIN_PRELOAD(mymain, + VIR_TEST_MOCK("domaincaps")) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 9bb186ed95..3d42cabdb8 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3033,6 +3033,7 @@ mymain(void) =20 VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("qemuxml2argv"), + VIR_TEST_MOCK("domaincaps"), VIR_TEST_MOCK("virrandom"), VIR_TEST_MOCK("qemucpu"), VIR_TEST_MOCK("virpci")) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 757e0a33e1..1dfa834f6b 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1355,6 +1355,7 @@ mymain(void) VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("virpci"), VIR_TEST_MOCK("virrandom"), + VIR_TEST_MOCK("domaincaps"), VIR_TEST_MOCK("virdeterministichash")) =20 #else diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabelt= est.c index 741c39d4d1..cbc7018e27 100644 --- a/tests/securityselinuxlabeltest.c +++ b/tests/securityselinuxlabeltest.c @@ -371,4 +371,6 @@ mymain(void) return (ret =3D=3D 0) ? EXIT_SUCCESS : EXIT_FAILURE; } =20 -VIR_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/libsecurityselinuxhelpe= r.so") +VIR_TEST_MAIN_PRELOAD(mymain, + VIR_TEST_MOCK("domaincaps"), + abs_builddir "/.libs/libsecurityselinuxhelper.so") --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list