From patchwork Wed Dec 17 14:27:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Dragomir, Daniel" X-Patchwork-Id: 76833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6890FD65C58 for ; Wed, 17 Dec 2025 14:38:47 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.16175.1765981664004973855 for ; Wed, 17 Dec 2025 06:27:44 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@windriver.com header.s=PPS06212021 header.b=bVmHjba4; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=444635b17a=daniel.dragomir@windriver.com) Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 5BH2snOe868324 for ; Wed, 17 Dec 2025 06:27:43 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=PPS06212021; bh=xr0VADdh5Vo4HUvoT1XH +v7sfxaK0Ujb7w8eivRgSgs=; b=bVmHjba4iOIYXO4k2NlIgW+ZPf+ZoLNC/YEg eUOrpfShV4Tu50Yw8G48LYRZIDxXp+89qprvKPeDtXUT9Lh3RqKsCXWrKpPXB0Ex D1L2BKwjLRB+ImXQjI6KJ0DTXQdmbAHmW8p26/3JQHM3K/KBbeATTYYRYncWQqs4 XUFU27NGfhahgMG2MacwMz292YDW+UWukDF+XN0JrObpp7E+WourgyYmqYQx4MyZ ElSSx23e0BH1E2tp7SydPwfuy/puRzSMCQN9VvzOUXt9Vu0wO/F2KzulLqgrPctw quM9+/qaUNgDt1nfZ+EX+D90ObRvJiPiBqz5zrwIUOeOtYqDOw== Received: from sa9pr02cu001.outbound.protection.outlook.com (mail-southcentralusazon11013045.outbound.protection.outlook.com [40.93.196.45]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4b3k6j0nhp-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Wed, 17 Dec 2025 06:27:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xKxlxtvpucgmV3NiLvGk+eNWLY/fSnbRf42hlWdEgDUYVX8K5OLyy+/8d8yEtrszTsjCdTFvZud/c7reHMpC+O2p/8JR/2I1DTTNg/uNAQGSRdq/h6gtU7bIpldbHTOc5CYSqY+D1LSxxG3GO3vUgz8siLkLysY7as/yy2rBjg/PWkjBpXFoRiY14PhWW6OCpf7HhKlpk+EE81SE9fXreiDla7VOIosEW9/HpF7c78EsYMB73ASN63AeONcpirbQdTr5aKfP5QxOTNbKlnxs0f6kAl1WoT9Qg1lBZJmZ2n/CneQ4QjoUcoeCHetpybuLS8vPxhR4TmRxiYRQaSqSpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xr0VADdh5Vo4HUvoT1XH+v7sfxaK0Ujb7w8eivRgSgs=; b=TZJguDgcvNU+6Njdv6npSa305g1apRT0lleCFRF8liVc0CIs4IfIyVxe5eLH/W78wc8tqc9Tw0eWlqXNXOKlCp+XYxP4diWpFI1t7KkDmooFNcwJNrggy8jB5xujqQzzpBIZ70swDvpBhjKxXt+J2tUThey0YrnBmYp7FyLFu5IRMdOXBBSKUOiDGRPDxgiU6iIXM74t6dadftH3Djvlfae1hf1lb8sT8nTFn1/ObshRerzkra+iZy5/pAJIxcdwbLJ03dFcoJccM5GTepzo3jHmcPu/3afriTtqOZxboTow4TmH9ODXZBtKNQVK7zwr7V5IDkY0I7CE4BbwzanOuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from BY1PR11MB7981.namprd11.prod.outlook.com (2603:10b6:a03:52f::12) by LV8PR11MB8680.namprd11.prod.outlook.com (2603:10b6:408:208::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9434.6; Wed, 17 Dec 2025 14:27:40 +0000 Received: from BY1PR11MB7981.namprd11.prod.outlook.com ([fe80::4a4e:8d21:83b0:ab7e]) by BY1PR11MB7981.namprd11.prod.outlook.com ([fe80::4a4e:8d21:83b0:ab7e%2]) with mapi id 15.20.9434.001; Wed, 17 Dec 2025 14:27:40 +0000 From: "Dragomir, Daniel" To: openembedded-core@lists.openembedded.org Subject: [OE-core][PATCH] oeqa/selftest/wic: test recursive dir copy on ext partitions Date: Wed, 17 Dec 2025 16:27:26 +0200 Message-Id: <20251217142726.3787722-1-daniel.dragomir@windriver.com> X-Mailer: git-send-email 2.25.1 X-ClientProxiedBy: VI1PR09CA0129.eurprd09.prod.outlook.com (2603:10a6:803:12c::13) To BY1PR11MB7981.namprd11.prod.outlook.com (2603:10b6:a03:52f::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY1PR11MB7981:EE_|LV8PR11MB8680:EE_ X-MS-Office365-Filtering-Correlation-Id: 96586a33-bfe3-449a-f61f-08de3d786f1e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?F04Yzg2gZZgTHv9MX3qbHaLpBaKtuK/?= =?utf-8?q?M8sJcDGMmu7jPGewYIBt8LZ5MD6Fw2qRsNBK01OhKiMYNNn+IiRHxUsKm+ytH7RDl?= =?utf-8?q?DkkmKCvTmbNy/k7u1OGNhoe5ZHaGTwF81Ch8bYUuusym5VQdKo1f1Odcf4d8icOki?= =?utf-8?q?chP8FhQnwxCjrMwiriUxuCKbuuGyyS0iqW1BozizZuM6jIbDMIrB58nLASJHiGGLD?= =?utf-8?q?Wy7Tvgc9oE526D0cwqNFLoIqj7E7m+wr7Eui7TmdcyGNy2+2i6SksdP8XbUhSIZQM?= =?utf-8?q?PPPVwpz6Q6/ym2tTZx2sR8OTRgBewfTaeEpJS1VY5vQX4miSgCV66YMIgbPidaSnb?= =?utf-8?q?nxRh8HooRqpIwZJdtUBdhzCO+KKhJryDnOhDXNuKDgIgh5DbuDMds6BbhGLBxIon7?= =?utf-8?q?Gi9ZB8xQ1NKTdE4Bkrz60y9DYvzf3Ta6fPn7XQSihSlL4XurWvusuAZLtP1EX/Iqn?= =?utf-8?q?LRDHnVxou7EPmvbpSNlI2R1YE0scKqRpb7rBQjyYiHpqO5NqzE+Y/RvIf91HVALP0?= =?utf-8?q?QC8S+faXKmRnbjcLfJ81vhRivdSe/PS8ZbSkLOr52UWSilDcXriMafieeJEhL7DOT?= =?utf-8?q?06/UMhK6Oz4uMEPJxrZ+GsU5bgBOKHUWMELTbnmFFBER/VsmabqrDcEURGCRoWzcd?= =?utf-8?q?uGSmEBolf4MxPwSrg2tUhzLPQZkEm5mnMpuDTu4xJPTy/Z8AKUc6TuZyPYHO4ORi8?= =?utf-8?q?E9/Gp0ljO6aoHngNfZrAftKYAysPq0FRrQaSaVkWd8c/Icv49e8N+43kq8Ys3hciV?= =?utf-8?q?+FzAplDnYzLr8ZnUf+MOjmDHClIvtrhQTaRr6b8h/tqnj6fBwHIXXgeTcWZUSfwzQ?= =?utf-8?q?IqQKOo/IxdsldxjYX2IgpcDRwEjURkgsxFOAkz8y+pfHfEYw1Jj3xyCfWn90IQihO?= =?utf-8?q?2ehgTbAzQ28wuxWDBMrOmhg0v1CL7FcLArZ7hv6qvLyeFx/Vh+e/TXkzW/T1r1NUE?= =?utf-8?q?J5/13JhYSDTiKtMukZLA2BfkfbIH/Uw/eXRiAe5jKsznBpT1cdH+jcnUQ5zvDZDyi?= =?utf-8?q?9j8WVLZAVxXU+aezIVbikq2PW+re/G0mWJS07mSPMlvCDuKXVMO8TI49mbIsFBGRz?= =?utf-8?q?ZpPsNCLJggaSX/dNKoFaCfjntQq2LKDBJrIS2sqieCnIexaTM5qnicTickR7l3vs6?= =?utf-8?q?tsrWQMES40s8vFrQYegxYIIow08LfSHn5fhMKieGmxp/laXLpJPdPNpvzBwPjNCWO?= =?utf-8?q?c+6oyIGP5R8masxTAsfhtPGLeJJyypqCiez5W43c4te/eWJBG7UAvsKg7Ccy1xMe6?= =?utf-8?q?EG5NNGER+ptF988eBFL8D7RWeI+fBxgJ3TtWZMJ27FW2MgMsKEDbopNsQqvF8d5mK?= =?utf-8?q?Rt7u1kj19sa8XfTqJBXbSSmWHW3aAC6fRGs3ZPn2ZQv5i/wm41t0JefHrjvG0bzEn?= =?utf-8?q?dTD0n+LfppAe5/ryHXxo5oB62nAn6T0I6nE/PTHqwBfz5dJMRGTYWKeo2qGhl8Jrj?= =?utf-8?q?Ktj+KPcQCH?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY1PR11MB7981.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Lp6mJxX0oOnRtW97YKmKInE8JI+g?= =?utf-8?q?Vjgfm3lQHdTPnNW1hDUHZG8yTmJXyhyu1QBK5M/I4bNlJvTRjsXgTV1VTcS6ovXh4?= =?utf-8?q?FVul79UeAaY6PrtGMfTHw1dUywkWrHBl/A+g7l6TGOvQ6jgvDxY24s5AeeXoNPhRh?= =?utf-8?q?RrOTCIz3LvNGiGhnEfPrbNX0SXFi5fLo4V0UJSzhqAp5IpEIPtrrAa5+qY5T1tjOK?= =?utf-8?q?QCrPjLTe/qCCwjwUM6gMjshsMUaianvWv2Acmdx7ZQXwMjLQszCI9hv9eas+ZQnBr?= =?utf-8?q?djtJRalQVpCSUv1zO+lR5eic/bMXFOp4uAYRH6nP/VCc3eiI+Fzzh/HDjEVPKh/T/?= =?utf-8?q?ynt1pTfJ1RsbZZawkgljBppeok0Mpyya93c2OYsGBQn/H93LYmeLDWRO43nXTdGIR?= =?utf-8?q?HsoRCqMO46tv+6F44Eo9UbMs5ht2XA2H+etlOBb8Pj/B4yq5bh5yi3edhUJ2QFoDS?= =?utf-8?q?/ObcxHDcT7QVRTfj0Ml+66ws80DYUvAx+03Eb/TMkWslSxjG+DTQvQgA3sm6f9vwD?= =?utf-8?q?e18H4jL1xRPJ7EM4fbsr9yE3EAzX/Lchf+MHy0cLrl0/lgkBxpayY7FYdkV0SlgCl?= =?utf-8?q?yTqKB+lmZCj3jVfv9hyZ4bRhhFbc3y1WV1v/AvIVUQ5MaKPYGTbfdEv2v+SfKupm5?= =?utf-8?q?94nmSEIkvlyzqXW1T9fMKwh69q2fvWNbtuEEOLi45siQ9DFuf1ht9ZHa8Wlr9MaBN?= =?utf-8?q?hd9j4zL/gl+gpiZlIB3Hp+2SFoQID6gSg5CE70pmcjVswY/txw8tSaldEHYgvTTzx?= =?utf-8?q?2qhg9OAet7kYX4S15gipDsOdxzQjhGPLBxOE+hWahiqvlqDC2CtGGnsjqwMMzLjAb?= =?utf-8?q?iE+o9+q5Lr6IenCXrEXmrjOAE9JZj98+ZRkk0UQDv+uEWtJ4g4LnKkddheU1BWgmM?= =?utf-8?q?2LWWt1omdnzFFgFbiO0SThbRxWWJR1OCpynOYmjj8eZwJNVHRvAq1rOiBLnV/niB9?= =?utf-8?q?B5ovQEoTq5AImB2eXYdFB5AHlCwEFQFkAF3MpwdBbJDt0UxZmkw8K/qAXpyW63tS2?= =?utf-8?q?xfy2XjAADh9YYv1R905Ml/22f7zjphqi9X8HRZNhHTCvVHGZzJDklC+tFqThO8Bg0?= =?utf-8?q?t/skNi6xs+w1P0/1QpMzgX0PgME43lWWLxDAB4Rk1z81U4PwJvTzXpoJ4Yq6ZE6uU?= =?utf-8?q?IY5ips63UkutRkwMQkm1q+75c/zOKY3xNAI2qQeiHAkbHHM+B01+TYR15KaC8QoBN?= =?utf-8?q?GI4pCnHURDfoYRidSMy4LI48jsCd/bYY0+0vuJdcGJBa60smcDLOgSuxv+kyMOtT+?= =?utf-8?q?yWLW5hpVcKWm2zANSOsM+6cxNax/MwXqKnSQN7JnbbIS41/YC1YuaFJRgOuaD1NhK?= =?utf-8?q?EeUEyDNEEE5j8aSkIIaHL2NC4appOtwu/YG2CgOwJ3crDY6B6z42naG49NB7/w9Pf?= =?utf-8?q?mJinwPkRSuLrsuf9OhjB+Wvo+fkGW1AlF9wTBczh5G2J/dSVDpzOlHObol5rvkTge?= =?utf-8?q?KSio4KjHICpLfV+uHgft5gCcZRrreps38xmQvPVxP9npkZlJzk+LRHBHW6OUAeFLS?= =?utf-8?q?XnpYiI/zTw05cB6kKtkjVxwe7rr8h0UtjQ=3D=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 96586a33-bfe3-449a-f61f-08de3d786f1e X-MS-Exchange-CrossTenant-AuthSource: BY1PR11MB7981.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2025 14:27:40.5165 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jLbK/t/OwStc0tBRpa1rxjvBz/40SqUBjZwbfiRhoXM1p29gRDVSzSO/nM80nZjBEo2CQd1lQyM4PtkP8kjKNbS7a8ugRKq1AhZ9/85yfrg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR11MB8680 X-Authority-Analysis: v=2.4 cv=ErvfbCcA c=1 sm=1 tr=0 ts=6942bddf cx=c_pps a=9wPeeuiWglyMylSd9qupQA==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=t7CeM3EgAAAA:8 a=AoXOhhOut3wUavBMMSwA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-GUID: sqK9fpr3ejqGBYWhUUfZJlR35TTNKW9o X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjE3MDExMiBTYWx0ZWRfX2ZT92+7faO2U IVGZtUwZXnR6SKMGTpY9wDJ/vKZGR61YFkt/FR7HgY3c6CfX7uPNStjw/v/vuCBTQyMLhMBQlXZ 1Oz2v4kaEDaxJzAEfwW7RPbijr/hep+Zp6FVraZU7M3KDimM2W5EeNODPfvuRz/Xkved7rfI/x0 FwfIOFUOe4DreVmvrnWXesv8UbcJXkwXN9yQt0o/MrZyal6F666Icd1nZZKbWSMyQmA/Hj1dcTS AObDurQBpMSZOf6lkzzKTpsnkd3GE74p0Q/UxjY8A8ZM5dJqqNvfXOL7Iu49VWHBbWEYITlbBc1 +eU22ZpgMAoIx9o44F2MJ9swNwx7DQqmCddDHXxvVtlSo9VkyFuU0FwmcdlX4zxdDUlGNmYdHWa u17qFVpz+4m6L6HsX0Sd6zDS0QSegQ== X-Proofpoint-ORIG-GUID: sqK9fpr3ejqGBYWhUUfZJlR35TTNKW9o X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-17_01,2025-12-16_05,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 priorityscore=1501 clxscore=1015 bulkscore=0 lowpriorityscore=0 suspectscore=0 impostorscore=0 malwarescore=0 adultscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2510240001 definitions=main-2512170112 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0064b401.pphosted.com id 5BH2snOe868324 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 17 Dec 2025 14:38:47 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/228045 Extend the wic selftests to cover recursive directory copying into ext partitions. Previously, copying a directory into an ext partition could appear to succeed, but attempting to access the directory contents would fail with: -l: Ext2 inode is not a directory This was fixed in commit 4fc3b42774 ("wic/engine: fix copying directories into wic image with ext* partition"). This test now verifies that directories copied with "wic cp" into an ext4 partition: - are created with correct inode types - can be listed recursively with "wic ls" - preserve files and subdirectories - can be copied back out of the image without data loss A simple directory structure is used in this test: wic-test-cp-ext-dir/ ├── topfile.txt └── subdir/ └── subfile.txt Signed-off-by: Daniel Dragomir --- meta/lib/oeqa/selftest/cases/wic.py | 65 +++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py index d7a9b14658..958f1d084f 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -13,6 +13,7 @@ import sys import unittest import hashlib import subprocess +import filecmp from glob import glob from shutil import rmtree, copy @@ -2084,6 +2085,70 @@ class ModifyTests(WicTestCase): runCmd("wic cp %s:2/etc/fstab %s -n %s" % (images[0], testfile.name, sysroot)) self.assertTrue(os.stat(testfile.name).st_size > 0, msg="Filesize not as expected %s" % os.stat(testfile.name).st_size) + # prepare directory structure + testdir = os.path.join(self.resultdir, "wic-test-cp-ext-dir") + testsubdir = os.path.join(testdir, "subdir") + os.makedirs(testsubdir) + + # add a file in the top-level of the directory + src_file = os.path.join(testdir, "topfile.txt") + with open(src_file, "w") as f: + f.write("top-level\n") + + # add file in the subdir + src_subfile = os.path.join(testsubdir, "subfile.txt") + with open(src_subfile, "w") as f: + f.write("sub-level\n") + + # copy directory to the partition root + runCmd("wic cp %s %s:2/ -n %s" % (testdir, images[0], sysroot)) + basedir = os.path.basename(testdir) + + # check if directory is there at partition root + result = runCmd("wic ls %s:2/ -n %s" % (images[0], sysroot)) + root_entries = set(line.split()[-1] for line in result.output.split('\n') if line) + self.assertIn(basedir, root_entries, msg="Expected directory not present at root: %s" % root_entries) + + # list INSIDE the copied directory + result = runCmd("wic ls %s:2/%s/ -n %s" % (images[0], basedir, sysroot)) + self.assertEqual(0, result.status, + msg="wic ls inside copied directory failed. Output:\n%s" % result.output) + self.assertNotIn("Ext2 inode is not a directory", result.output, + msg="Regression detected (inode not a directory). Output:\n%s" % result.output) + + inside_entries = set(line.split()[-1] for line in result.output.split('\n') if line) + self.assertTrue(set(["subdir", "topfile.txt"]).issubset(inside_entries), + msg="Expected entries missing inside dir: %s" % inside_entries) + + # list inside the subdir + result = runCmd("wic ls %s:2/%s/subdir/ -n %s" % (images[0], basedir, sysroot)) + self.assertEqual(0, result.status, + msg="wic ls inside copied subdir failed. Output:\n%s" % result.output) + self.assertNotIn("Ext2 inode is not a directory", result.output, + msg="Regression detected (inode not a directory). Output:\n%s" % result.output) + + sub_entries = set(line.split()[-1] for line in result.output.split('\n') if line) + self.assertIn("subfile.txt", sub_entries, msg="Expected file missing in subdir: %s" % sub_entries) + + # copy directory from the partition and compare with original + outparent = os.path.join(self.resultdir, "wic-test-cp-ext-out") + os.makedirs(outparent) + runCmd("wic cp %s:2/%s %s -n %s" % (images[0], basedir, outparent, sysroot)) + + copied_dir = os.path.join(outparent, basedir) + self.assertTrue(os.path.isdir(copied_dir), msg="Copied-back directory not created: %s" % copied_dir) + + copied_file = os.path.join(copied_dir, "topfile.txt") + copied_subfile = os.path.join(copied_dir, "subdir", "subfile.txt") + + self.assertTrue(os.path.isfile(copied_file), msg="Missing copied-back file: %s" % copied_file) + self.assertTrue(os.path.isfile(copied_subfile), msg="Missing copied-back subfile: %s" % copied_subfile) + + self.assertTrue(filecmp.cmp(src_file, copied_file, shallow=False), + msg="topfile.txt differs after round-trip copy") + self.assertTrue(filecmp.cmp(src_subfile, copied_subfile, shallow=False), + msg="subfile.txt differs after round-trip copy") + def test_wic_rm_ext(self): """Test removing files from the ext partition."""