From nobody Tue Nov 26 15:27:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1707156917; cv=none; d=zohomail.com; s=zohoarc; b=D4kocXGB8qQeW3E7dbCxDyjKoLVywPQhmFooxFQ7xOl1xis8yqc91wC1E9kXRSQJPfspdFMDrNmS3bXSa1lrQSWe6qGgwFM9vwouhzqThH/3oPLNeERihPowK561WvbnfFcem3FIBEJBs28OZOIhy4TKDdZBg39j0Mh4O+QeSws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707156917; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=OjpwU5KDoZLOFP+X0NzCRTTWcd2Mc/m/SMvsZ+X6Cz4=; b=PuWCcRsU33B9XPJi0S9T3J7vLYMcy79JilOialv+B2WggQ/13vPhOFpedIFBegMpmAbG7dkict+4w9poGpA4JIZM8FWbnW+xLWOIaAxsQXIkWdiir22NUwipvIcOVvGudSuxMXF/Hcao3gWEnPpD6LXJHnwqaiO4S701pEZNrB4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170715691785234.24660472084747; Mon, 5 Feb 2024 10:15:17 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rX3Tu-00060g-AE; Mon, 05 Feb 2024 13:14:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rX3Tr-0005zj-GW for qemu-devel@nongnu.org; Mon, 05 Feb 2024 13:14:07 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rX3Tq-0005vC-0w for qemu-devel@nongnu.org; Mon, 05 Feb 2024 13:14:07 -0500 Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 415HfKdY030782; Mon, 5 Feb 2024 18:14:02 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w341c17fm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Feb 2024 18:14:02 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 415HQ6au005911; Mon, 5 Feb 2024 18:14:01 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3w341c17ey-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Feb 2024 18:14:01 +0000 Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 415I2jBP008478; Mon, 5 Feb 2024 18:14:00 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3w221jsrya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 05 Feb 2024 18:14:00 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 415IDwZ237814786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 5 Feb 2024 18:13:58 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6AD8A20040; Mon, 5 Feb 2024 18:13:58 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9C3E20043; Mon, 5 Feb 2024 18:13:57 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.57.170]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 5 Feb 2024 18:13:57 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=OjpwU5KDoZLOFP+X0NzCRTTWcd2Mc/m/SMvsZ+X6Cz4=; b=eVXSaxcxGEAvx0zLCorm3fGgWkbyZ920kOS/DMWIBo/jxuuSdjBfgLkBJUSAVXtQ6/aV gfK3fLt5D3VQtQM0bSa37aivupVrNJe1FPhhSmqXKxcuL29GQaSLZjHcRJ7zTs7ur1CB Dohr2cKNyPvorCgHFqeCtMGBTYNOdmRkl+lKhpfWQA50Fh9nY30kieLmImEkXxgwpk0c 5spr89X/bfeihLdxO/5v+CQUrsj7juKRepn1Yb6Mqema4ix7pBOKzbqXPIjDP3QCFc2V Gg3ePnKg9Pa5RrTQXyuw3Wt8ojDrUPdQUxLAQb9eBSnoqXQGw6dnbCHt8ydjzqJU9D3W ZQ== From: Ilya Leoshkevich To: Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ed Maste , Li-Wen Hsu , Warner Losh Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Wainer dos Santos Moschetta , Beraldo Leal , Kyle Evans , qemu-devel@nongnu.org, Ilya Leoshkevich Subject: [PATCH v2 3/4] tests/test-util-filemonitor: Adapt to FreeBSD inotify rename semantics Date: Mon, 5 Feb 2024 19:11:34 +0100 Message-ID: <20240205181352.1567-4-iii@linux.ibm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240205181352.1567-1-iii@linux.ibm.com> References: <20240205181352.1567-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: TKvzF6rb8w3FB_1-6OVzMt_oO24HccLN X-Proofpoint-GUID: i1yEtzIAmxO4G28gF1ajzyA9y5ZTgwvz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-05_12,2024-01-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 adultscore=0 mlxlogscore=999 spamscore=0 mlxscore=0 lowpriorityscore=0 phishscore=0 bulkscore=0 impostorscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402050137 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=iii@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1707156919985100002 Content-Type: text/plain; charset="utf-8" Unlike on Linux, on FreeBSD renaming a file when the destination already exists results in IN_DELETE event for that existing file: $ FILEMONITOR_DEBUG=3D1 build/tests/unit/test-util-filemonitor Rename /tmp/test-util-filemonitor-K13LI2/fish/one.txt -> /tmp/test-util= -filemonitor-K13LI2/two.txt Event id=3D200000000 event=3D2 file=3Done.txt Queue event id 200000000 event 2 file one.txt Queue event id 100000000 event 2 file two.txt Queue event id 100000002 event 2 file two.txt Queue event id 100000000 event 0 file two.txt Queue event id 100000002 event 0 file two.txt Event id=3D100000000 event=3D0 file=3Dtwo.txt Expected event 0 but got 2 This difference in behavior is not expected to break the real users, so teach the test to accept it. Suggested-by: Daniel P. Berrange Signed-off-by: Ilya Leoshkevich --- tests/unit/test-util-filemonitor.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/unit/test-util-filemonitor.c b/tests/unit/test-util-file= monitor.c index a22de275955..02e67fc96ac 100644 --- a/tests/unit/test-util-filemonitor.c +++ b/tests/unit/test-util-filemonitor.c @@ -333,60 +333,68 @@ test_file_monitor_events(void) =20 =20 { .type =3D QFILE_MONITOR_TEST_OP_MKDIR, .filesrc =3D "fish", }, { .type =3D QFILE_MONITOR_TEST_OP_EVENT, .filesrc =3D "fish", .watchid =3D &watch0, .eventid =3D QFILE_MONITOR_EVENT_CREATED }, =20 =20 { .type =3D QFILE_MONITOR_TEST_OP_ADD_WATCH, .filesrc =3D "fish/", .watchid =3D &watch4 }, { .type =3D QFILE_MONITOR_TEST_OP_ADD_WATCH, .filesrc =3D "fish/one.txt", .watchid =3D &watch5 }, { .type =3D QFILE_MONITOR_TEST_OP_CREATE, .filesrc =3D "fish/one.txt", }, { .type =3D QFILE_MONITOR_TEST_OP_EVENT, .filesrc =3D "one.txt", .watchid =3D &watch4, .eventid =3D QFILE_MONITOR_EVENT_CREATED }, { .type =3D QFILE_MONITOR_TEST_OP_EVENT, .filesrc =3D "one.txt", .watchid =3D &watch5, .eventid =3D QFILE_MONITOR_EVENT_CREATED }, =20 =20 { .type =3D QFILE_MONITOR_TEST_OP_DEL_WATCH, .filesrc =3D "fish/one.txt", .watchid =3D &watch5 }, { .type =3D QFILE_MONITOR_TEST_OP_RENAME, .filesrc =3D "fish/one.txt", .filedst =3D "two.txt", }, { .type =3D QFILE_MONITOR_TEST_OP_EVENT, .filesrc =3D "one.txt", .watchid =3D &watch4, .eventid =3D QFILE_MONITOR_EVENT_DELETED }, +#ifdef __FreeBSD__ + { .type =3D QFILE_MONITOR_TEST_OP_EVENT, + .filesrc =3D "two.txt", .watchid =3D &watch0, + .eventid =3D QFILE_MONITOR_EVENT_DELETED }, + { .type =3D QFILE_MONITOR_TEST_OP_EVENT, + .filesrc =3D "two.txt", .watchid =3D &watch2, + .eventid =3D QFILE_MONITOR_EVENT_DELETED }, +#endif { .type =3D QFILE_MONITOR_TEST_OP_EVENT, .filesrc =3D "two.txt", .watchid =3D &watch0, .eventid =3D QFILE_MONITOR_EVENT_CREATED }, { .type =3D QFILE_MONITOR_TEST_OP_EVENT, .filesrc =3D "two.txt", .watchid =3D &watch2, .eventid =3D QFILE_MONITOR_EVENT_CREATED }, =20 =20 { .type =3D QFILE_MONITOR_TEST_OP_RMDIR, .filesrc =3D "fish", }, { .type =3D QFILE_MONITOR_TEST_OP_EVENT, .filesrc =3D "", .watchid =3D &watch4, .eventid =3D QFILE_MONITOR_EVENT_IGNORED, .swapnext =3D true }, { .type =3D QFILE_MONITOR_TEST_OP_EVENT, .filesrc =3D "fish", .watchid =3D &watch0, .eventid =3D QFILE_MONITOR_EVENT_DELETED }, { .type =3D QFILE_MONITOR_TEST_OP_DEL_WATCH, .filesrc =3D "fish", .watchid =3D &watch4 }, =20 =20 { .type =3D QFILE_MONITOR_TEST_OP_UNLINK, .filesrc =3D "two.txt", }, { .type =3D QFILE_MONITOR_TEST_OP_EVENT, .filesrc =3D "two.txt", .watchid =3D &watch0, .eventid =3D QFILE_MONITOR_EVENT_DELETED }, { .type =3D QFILE_MONITOR_TEST_OP_EVENT, .filesrc =3D "two.txt", .watchid =3D &watch2, .eventid =3D QFILE_MONITOR_EVENT_DELETED }, =20 --=20 2.43.0