From patchwork Wed Jan 28 14:35:47 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Dragomir X-Patchwork-Id: 79932 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 83CA7D3F074 for ; Wed, 28 Jan 2026 14:36:13 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.14323.1769610967089974105 for ; Wed, 28 Jan 2026 06:36:07 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@windriver.com header.s=PPS06212021 header.b=pi09Rd8T; 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=6488b4f5f7=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 60SB1mAg3275623 for ; Wed, 28 Jan 2026 06:36:06 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=PPS06212021; bh=7KI8CQQqfDbPtP2B5vZp8iZCRQ0ZYjd+76vmxRG/T9I=; b=pi09Rd8TA+Dn vD+T2Mhr4csjldQuHSFeLzakoAOi6l74Ps7vScFPiDlwAEE28Ab9OCQD5ozRA7KQ 9nzMyaCjKWf5LWdWam4TJRiVJbAu+OlvMnv5OBG1/JBZxTOw+WdPatObwvnPAqRN NaDcPUSIYVL14xeI+gt9QTf8ZoQM0/IqhVE5uxIZ34HymHk8LiwDq4LB40J+ZUwe CtQMbklJki6dxmKRG08r9+/HYre75UbMlbor0m8YpxTIp9NrLLV+5cyhSmQEFzuI VJfIn3GX9XVpk98zItaSsbauIDTAAm2YMnD9N4+H3M7GrmEqzyizZvRXRb9y4Bm0 gtIWlG+sgg== Received: from cy7pr03cu001.outbound.protection.outlook.com (mail-westcentralusazon11010032.outbound.protection.outlook.com [40.93.198.32]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4bvxfm4x5r-2 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Wed, 28 Jan 2026 06:36:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZM4AJIdTeDyc3ti8ZU+wRU01pD2B6OUzMHJ5bStI4LHmpnGc9gTtOjoIi49ThSdF26m1GWPpcW7Joy1vTATkWANKjZWtKaB4faZLfpTnMkAo0G/R5z3MnJ6WtVUjMbjJmO/yDQxwYpl62A6dyA0I5KJSTXVqZbJLaZ5pkMzlcli6a48xi7BYXHzH343P4Cq6+c5L+PUD9yGoSFv89mt31XLWg6ursHTLPoqaGZKd9xinNDUNidK2OK4M8fKlo5JSEnA+4Yh6rtIoh4Xrus2YP3kmIwDBQyzhdWOnL5DjbPhRaw1jXEhu8JI+sWdIGulZWfy/5pyWipHCZUBp810pxA== 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=7KI8CQQqfDbPtP2B5vZp8iZCRQ0ZYjd+76vmxRG/T9I=; b=yXc1YA07I7K4VpvBcg0HMUupSLMwhFgsxKgvbANlR5oF39ws1Es4VOfPSw4/6oa7zutQee+KmtPOBqP/HShzgtmzuNiuAvxmpMpYETdQ52QQNh+eTrkcvogrBWB/jY5aydh7aDBEXi2P7aEOLuFacktPorgivkdsgcYROwT5hJ43U/zyPVAdipVEbpRiLOkXx6T5QF9H6/aHM4zgjVI8NNGPe+dzBWo3WgNvb7orGuX76NvMcwIzk/ES0BNTLUZr/y23L1snWOyCaMRr4yPHmFXRshn4lTorUI0CcRD2jOOiAN68F2Pfwp01luJHRL/5y93pFghR9UeZC3KPTw+6zw== 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 PH8PR11MB7968.namprd11.prod.outlook.com (2603:10b6:510:25f::14) by DM4PR11MB6406.namprd11.prod.outlook.com (2603:10b6:8:8b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.7; Wed, 28 Jan 2026 14:36:05 +0000 Received: from PH8PR11MB7968.namprd11.prod.outlook.com ([fe80::bd3a:5dfd:4a5b:223f]) by PH8PR11MB7968.namprd11.prod.outlook.com ([fe80::bd3a:5dfd:4a5b:223f%6]) with mapi id 15.20.9542.010; Wed, 28 Jan 2026 14:36:05 +0000 From: Daniel Dragomir To: openembedded-core@lists.openembedded.org Subject: [OE-core][scarthgap][PATCH] oeqa/selftest/wic: test recursive dir copy on ext partitions Date: Wed, 28 Jan 2026 16:35:47 +0200 Message-Id: <20260128143547.1239286-2-daniel.dragomir@windriver.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20260128143547.1239286-1-daniel.dragomir@windriver.com> References: <20260128143547.1239286-1-daniel.dragomir@windriver.com> X-ClientProxiedBy: VI1PR06CA0185.eurprd06.prod.outlook.com (2603:10a6:803:c8::42) To PH8PR11MB7968.namprd11.prod.outlook.com (2603:10b6:510:25f::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH8PR11MB7968:EE_|DM4PR11MB6406:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c47a83b-ab89-4669-39be-08de5e7a9144 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Rlc7NUMJYBZSYmNZ6Z52cD/fsVL9R+X?= =?utf-8?q?oCChGHOsgjOzRAYxROgC3DZr74DOHRZsWgN8m+++QAuHSt19xP2qIc0NLTgPPk7rs?= =?utf-8?q?nhX6p6vbFajLdZI+1eBieUvkUg8ORjD3BocN0C5IAhv+KkorJyAyLq10IAxpICbRn?= =?utf-8?q?iuCVALrH0rdLVapEkP5HsQLCduMnBgobs6crLKjHOzrShzBcZ9XvXEEpYJCc4qI6R?= =?utf-8?q?LE4ow6mJKCItVOqYYCIpxZdUXe+dO0TYsK6O35PFW5g73pWo97DQax1C2C9YJ/Bid?= =?utf-8?q?IRXJUwh8tjVPji4/f70MRCcPc9IwgddrFW1wu7zMK7Eh7EJ/1zJ6odC1xIDdLSsiK?= =?utf-8?q?zxjfxXp19nsVqbgjNwoBxiUH89HxC0duzUkp0DWAWvqwjaEZnMVpjmN6EGwsmQ8vC?= =?utf-8?q?f+Y74rcXwTK9XyDgKDJo2deYN2U24RAIFNNo7nn5iAy1E0Qz2FSdLT85hbj4ZMrTi?= =?utf-8?q?8Mu8fghauYiw5/w5djdZw2k+d7bSIuwczJUE0trHXXTFEee9FmqHltExHbKl62W8J?= =?utf-8?q?ytZ9FngP3oYVEY6mwxmsXVYjj7eday+jug1EuAzKxjZBAqG4zRNfRYDbQZhX5CJ+x?= =?utf-8?q?qfNm1xjFWNvwv2YB6T0euxF803I+rNUp6IJnjlxGU7xnM8nuOVoqsg9NwRemjpHbj?= =?utf-8?q?er1fg7MLA3UAhNb9BAvzN5Wc1aR3Kg8FOybR0x/rPcq7OVcSRjEUdOHANplPGF5Eq?= =?utf-8?q?JqE9CyFg0+pwFLS9+d/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SRV:;IPV:NLI;SFV:NSPM;H:PH8PR11MB7968.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(52116014)(366016)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2R7dhd73MBIp65ilvoU8cgbs9TaC?= =?utf-8?q?7mmG+r9WOn+AiO7kCUspRodbAdWWkLWsfA5SfqmkRp1Bikg8S+tNhnPT6y9amW0Iy?= =?utf-8?q?rjd72fGvoQzK8BRMct3+io11Ha1IxN/kmBpsvF3SYsZxO/Oe7t4PUrDaw3H+sOx3c?= =?utf-8?q?TwqYLs/vhwWda37RMAQeXr/EaoLvJwo7gnfROs/K/3i9HmfhDpgWPCCSmoyUAoh3N?= =?utf-8?q?4hGMa6v0bh+0QBEssWNcek8NnB66icPMtd8GuCEVdMPcPnlBbYA1bEBCgkg+r6LF9?= =?utf-8?q?qTb1zoOrF8c1GGJ3GXyXvmVxqvEXoeCx+pOOe20UoMB4p07i768SZJ8wjl9R4FJex?= =?utf-8?q?ch+ltdhGH5JBWfPvnFBTbPL33Bw0/mrYZDvK7Wkmxwtwf2k4C1BkBgCjoB95xTbA4?= =?utf-8?q?YGmkFffwMkjs4Es2irIQTOTJ7KbCPwAFKmVjWly6Xjf6n50byocXWrL55W8B5nBB8?= =?utf-8?q?iaP4HfpThqFL0QA3+Hi4dYpwgZx2n/OMZaUDxjfUHjAZ0mv1FZbCcKoruzvNjJQXa?= =?utf-8?q?Piq9nslILWN7m1HG7YXI7fNc3q2iiELJ5ERsfy3FR2wfreoWDcY0MWptAahtv2bMV?= =?utf-8?q?1cZ8AfR2WlfQaMBWO8wpJOV3Oo+/+tffWPxmGAkjCnhusBHD+Falix4Oq7I5/+UiZ?= =?utf-8?q?hOA3RizpBpF80m9tm/7kXb+qiPo449LFaivsESH3C+jh6SO9lPedAf9Zjjg5hoNd6?= =?utf-8?q?He/C9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f-8?q?J0bxOgHIxpo5OeHVrD5AQ4c2XBGgcA/RmTV05QtTt/JZJAcw/B610xT1w8aoBlWdY?= =?utf-8?q?qijkH881RIxUtVQcwkGSU/RNFDsu4DIZtuktz4ZIkbk/IjF9KGkZ8=3D?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c47a83b-ab89-4669-39be-08de5e7a9144 X-MS-Exchange-CrossTenant-AuthSource: PH8PR11MB7968.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jan 2026 14:36:05.1137 (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: lRP0RgSwMfZ0FVI8ahEcz8aVhyfe3wXhdGp0gppXSRvzeXkgqEF2VRg/gWvGKhLJxdQUPsSHAvV+7IdlrQnKiab4cfmIqIQXxVrLfUgwwkc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6406 X-Proofpoint-ORIG-GUID: JlqvffWLyRRA2GAdinQyuBfE8jTzEjq- X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI4MDExOCBTYWx0ZWRfX3fkKekPre2A1 3SzcbspNbK2/kgsAGuUh5KWopnwSLsCM9K8/3si9eQRVaLZehNYJOG+KFIZulM47En/RwwIw8HB iWOGiZyCAT0cXMH82ZMft3a2PuUmK48TuGAiPbg+/78zMy6TcUEsq8XoSOo3uPf1eJa4Uy+NAMA rqjVxqQyFeehIlmHjTOGfHnIjIreteEJdkfoCmMM/81B90W8EOUZ7+Uzh4JHrmn+gj1id9GWmDW TJMQ1V1E4naaXRNsON7ekFMcPQQtVH7k6cQdf5w8gNw7nz4qwhOZYrs1A/b4/GWXvGnG62yX2h5 UuGzFpdtRfKEXhVbknTdD6pAgEoJaB1QojrmOMSyHx+XSBYpq8LBuKkdkoIoAAIDEDbZLyHK8aE H7rtFGQWGuEhRF3UZll3ujn52TclgO4SCcEu1ZX+cez5BbUDwm4DzZ2sQ8+DJtvI5NbjbC1O0XX MXAuD6/3tEIKtM+7muQ== X-Authority-Analysis: v=2.4 cv=Lo+fC3dc c=1 sm=1 tr=0 ts=697a1ed6 cx=c_pps a=A8yAwjBYovhlCeyetBcGtw==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=t7CeM3EgAAAA:8 a=P-IC7800AAAA:8 a=ag1SF4gXAAAA:8 a=AoXOhhOut3wUavBMMSwA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=FdTzh2GWekK77mhwV6Dw:22 a=d3PnA9EDa4IxuAV0gXij:22 a=Yupwre4RP9_Eg_Bd0iYG:22 X-Proofpoint-GUID: JlqvffWLyRRA2GAdinQyuBfE8jTzEjq- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-28_02,2026-01-28_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1015 spamscore=0 adultscore=0 malwarescore=0 bulkscore=0 impostorscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601280118 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0064b401.pphosted.com id 60SB1mAg3275623 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, 28 Jan 2026 14:36:13 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/230098 From: "Dragomir, Daniel" 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 Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- 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 b616759209..1ba180ff0e 100644 --- a/meta/lib/oeqa/selftest/cases/wic.py +++ b/meta/lib/oeqa/selftest/cases/wic.py @@ -12,6 +12,7 @@ import os import sys import unittest import hashlib +import filecmp from glob import glob from shutil import rmtree, copy @@ -1662,6 +1663,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."""