From patchwork Tue Feb 3 14:03:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Varatharajan, Deepesh" X-Patchwork-Id: 80348 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 1535DE87834 for ; Tue, 3 Feb 2026 14:04:16 +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.17168.1770127450340620242 for ; Tue, 03 Feb 2026 06:04:10 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@windriver.com header.s=PPS06212021 header.b=sAA5WfHN; 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=6494b3a7c5=deepesh.varatharajan@windriver.com) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 613B02kg1683699 for ; Tue, 3 Feb 2026 06:04:10 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=cc:content-transfer-encoding:content-type:date:from :in-reply-to:message-id:mime-version:references:subject:to; s= PPS06212021; bh=cYNB4diwx57eepLfgn2UcB2sx2uiG1a8PCc6lfKGWCY=; b= sAA5WfHNA6kOqNiSbGwUL/P3aITNwVVpA6Z+2xGkOHEvOKNadxLKYjt/cxaNxTDk fANHqaZ82h4QshRVAWh4COm/VNXOL9tRXAh4v4vJFRmXOSPD275CvVXwRtDaZuZq Pdlw2oQJF4t3d0/yQRkTE6D2bXvyBYGlPkKCaqLhIVl9wDL7cba7hBSCMs30yBaa eOeYfoHkHpsCZy5RVSCSXQF7FmuFNXnd6oWlNjxSb4kh6AryB2eGBVmic4SUDJla H5d/EFYgS0lXP7rssOfLqBm5YAWvuh+TYToukWJLwGCdqKuOuoGwlL0259L09rrY ObC+/sulyQ6nf3JENfRogw== Received: from ch1pr05cu001.outbound.protection.outlook.com (mail-northcentralusazon11010013.outbound.protection.outlook.com [52.101.193.13]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4c1dw0u6e1-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Tue, 03 Feb 2026 06:04:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DSbFli7lOl4hmlGXPl60iKGTWuTn1iiX03UQm77aWwsrFXD6Ld99YWT/5HLl24Orw26BazY7NG+R4XAWYUCsIuoWss1rEeeSLfB9/pU3oSJ6wPKCxd2MWLHg5jI/D6KPZ3otqJxImKILi+fu/Zcp2gw4FkhumUgocI8JfT8cY7T9AI4sBzZSuy9blIzw8SMjvTuBeUVZEjePdVeC1BkYLoooia33zY6UXTRuqsRcPwHuhloeYp+VtWjePAy+9WG6KVrnZin+UgAKS9qaPzBivwkFHXZ1Pc6NjSfC3Zs2KmNT8Yb9f5bsgNV1YAPBec+QumftLrtmwZkmFnVqUCnjzw== 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=cYNB4diwx57eepLfgn2UcB2sx2uiG1a8PCc6lfKGWCY=; b=ZNQAGz16B2Fnj+1l21HWOcYjaaVEBVOpE+Q2Gxic1o5p968k+L/QCH3hihQAhiiVryBhskcwipeOmYxYRpa4+OjeK+ZKWl1vWYren6K5cLQBR9/xeOntVh20bTw8zaSZvoNSh/xHZaACCD6C1Sw15CrcLndmtNFZR8SEWc8umhHh8/kOWiKPfkdkXcoZwFI0R2IMTbB/jya59a41RbJ5Q6bRy9adeWl5/CPLlDkU5F1GP0+9arRu1Z7V+iukDYh8zIqADW5r/8Mfl3DfzP8/+or1SK1b8GjpBzXYHCoNOnRt/pg6XZNyMpuSaIGE/wfP1U68pZ5u08OIWPWHRErtgg== 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 SJ0PR11MB5648.namprd11.prod.outlook.com (2603:10b6:a03:302::11) by PH3PPF1618AF7BB.namprd11.prod.outlook.com (2603:10b6:518:1::d0a) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.16; Tue, 3 Feb 2026 14:04:04 +0000 Received: from SJ0PR11MB5648.namprd11.prod.outlook.com ([fe80::c784:dce5:4b7b:54f]) by SJ0PR11MB5648.namprd11.prod.outlook.com ([fe80::c784:dce5:4b7b:54f%3]) with mapi id 15.20.9564.010; Tue, 3 Feb 2026 14:04:04 +0000 From: Deepesh.Varatharajan@windriver.com To: openembedded-core@lists.openembedded.org Cc: Randy.MacLeod@windriver.com, Sundeep.Kokkonda@windriver.com, Deepesh.Varatharajan@windriver.com Subject: [RFC 3/4] oeqa/selftest/clang: Add selftest for Clang/LLVM/LLD Date: Tue, 3 Feb 2026 06:03:27 -0800 Message-ID: <20260203140337.1971735-4-Deepesh.Varatharajan@windriver.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20260203140337.1971735-1-Deepesh.Varatharajan@windriver.com> References: <20260203140337.1971735-1-Deepesh.Varatharajan@windriver.com> X-ClientProxiedBy: BY3PR04CA0014.namprd04.prod.outlook.com (2603:10b6:a03:217::19) To SJ0PR11MB5648.namprd11.prod.outlook.com (2603:10b6:a03:302::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR11MB5648:EE_|PH3PPF1618AF7BB:EE_ X-MS-Office365-Filtering-Correlation-Id: 509ac944-04e4-4531-b7f7-08de632d163e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ZeDfnEneH/LMkK0cTgRh0Hdoala1xkL?= =?utf-8?q?tHBMZTl2MiaVNOi4HTF7XP2e9eqZCItRYGT6UgBdDkdcNR2lHLWnQBwdMkEB58O2Z?= =?utf-8?q?9sMLi5xs31ioKr1qDW5FvgMlEBsA1ZlXTAoty9V4qQ8Y238Af+elcAdIzZie3t9p2?= =?utf-8?q?g5AeUWbAZ1HxDXiTRuwBIm39If/cpmJytg8uUka2VC5F8oEOyOT8Bqp+3goM9Z7el?= =?utf-8?q?pADxDcpnm99/+LtCpc9MbceiWDbnnbQdlcVtpLZD1zPPsy5bpzmjE2bjR8G1bzt1I?= =?utf-8?q?IaNx5jAvHKBF7kbEVJ64cO9aOUlEEU31Rt/fqlse4nJ/v6epfhk0XvxhAg8WZlzwH?= =?utf-8?q?YYeeSLcjXQ5LPZRoMINd6rBIzOIZfKoO84UrxxOSCB7kRMcCYIOLbDPZkvs9IVNUl?= =?utf-8?q?+x9acafMVbhutB7JneB8lhfjUioDv3IDm1pJjxiqafRY+uFlhuK113qKLR0gocJon?= =?utf-8?q?iKqsMpqNvMa1gHNEJUqicySfDT66Skg0yceozaRQ6GtcIhb7Ua/O2PaXxdDyibZ5Z?= =?utf-8?q?DJOJ6H2b38ztx9uqBxh3osb8SL2RFuK6bsDWymotMKA57PQ6xIjoncX1bdAmYGhTD?= =?utf-8?q?kjqbu7z9Ad11npVck/GUGnub0spVN7LraAsidtH4rebpvEMkMHOL2bSbivgmVs9VG?= =?utf-8?q?pdaJN5ZLSNxmGynTqsRs3q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g3qcWl5xZ+oBulwCkoFM=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR11MB5648.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(376014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?BZNLk1tOrqu564f1uJlg199GLWMD?= =?utf-8?q?aLT98xgyFvZNd1KMYPSchQAcT8qItpzQi7SAF8jai9Osa5V66S/pKfIxhQeKGzDGj?= =?utf-8?q?b72gl3nmmAzxYGBt1dZaypLkd9ybHiRJfkN2dolybXmqv//H5atutisbCqi+SM5Qn?= =?utf-8?q?3TacXI0IhvvSt5oFQTowkxw4WqO74INU8Y6yO9kefM+cdce0Sbin5K3pcXWasvfJK?= =?utf-8?q?sxCIfUMXA/qJTtj79ugiDf9o2aH6je6JkCHs5hY+hfFL/FW3CpqJosTsqsjTosi+y?= =?utf-8?q?3hpUmsL+eraWnzvNlS2IX0eq/smdPRBP4lepEZ/UkUN/a6EVnl5Lo/DObt5Fa6mWD?= =?utf-8?q?KnLVhUT2aNRY9WzL5/4miZz1b1yxORqPJgHNQykPFSuSQTMqCZ1ITdyZTSsxoBh24?= =?utf-8?q?wG+Ga/Bp6ynNGZiJlZC0jUMYGJSvdVEuEG/t14p0QajDMCQT0q1vrnUhnYt5TOql7?= =?utf-8?q?TMvEQXlBrfhXBJ09WLBNjLyk5CJt/1Std6MyGnk+CQz1QufUyhrUccY72Bt8r5RZK?= =?utf-8?q?sBmpTUgIrokLG/jJ9DEDEa7mKW7Mj4kTl/F0sNw3KbUSzDlqfdfOYB/wx4uDrWUKm?= =?utf-8?q?BQ3sPM/eUguFkUUFzqBID6SX4JPozfSQlq7iI39y3U4Evo74VHB5fq2ixrqFI+FMF?= =?utf-8?q?wTTv6LHbu/Cf+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bdSX9i2xZrRZh/0fciWJdaBp1Z1VsRbRgi80mcsSBJHdlBWlbbQEcV3?= =?utf-8?q?muZuI5HokE7aj33hxjUbIeFwv/r12ycFmJr2Y3OE/2GQPwuwMAPbdfoSNrYes9ISB?= =?utf-8?q?Y7KJphAUcwEu2gHQ+jl0vef97/Ri0Zgt0TjgiiROozkHoZedpeRQL2Z8sU77Bee0q?= =?utf-8?q?aXj5W8w1r?= X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 509ac944-04e4-4531-b7f7-08de632d163e X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5648.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Feb 2026 14:04:03.2211 (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: 9mFjOT3D6KyGl8x+i+uoBHn6Xb93I706rYe0YAEtiJj9SjldcuPYbT4cXa05lBL6ZW2j6A3cSz/iX8XlCtbcifhRFD8lTZpsTGvBM4Lgl8j5cjhz0irMJU5QsUIXACNh X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH3PPF1618AF7BB X-Proofpoint-GUID: 2GXFGW3J5Q69oZZc2GMTqTdbjk3IIorR X-Proofpoint-ORIG-GUID: 2GXFGW3J5Q69oZZc2GMTqTdbjk3IIorR X-Authority-Analysis: v=2.4 cv=Htd72kTS c=1 sm=1 tr=0 ts=69820059 cx=c_pps a=N2Bp1sGBA0q5hqNMPvyVyQ==:117 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=lCpzRmAYbLLaTzLvsPZ7Mbvzbb8=:19 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=t7CeM3EgAAAA:8 a=SQQGA60Wx8lJcxWaSqYA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAzMDExMiBTYWx0ZWRfX/j6uYdWqmese dmvjLxix42C9fGVd2/PFDZ5coKEkiGBMcw/PTdODivDxanflhlXpo6xr8wUmaMwdi54w4vSysZ3 tqTBCk5lipxDk1/dL1yW0B66FTUZYLEE7Dy0RIiLOoXq6wWB1Vw3AGUlTCoHvGTUCXb5tqD08TL BfrL9WM1ZGJAXW1HwE/rYKQBXg26Lqr5HUaDrjvKf7w40Rl8Aac4KTiIHzF31fMquiUXiVGgNz1 tW8jS6U/LW2NSPqQ2amQHSf4roXxK4k6611gXyTMOWn4wrL9oJMTo0H/wiYHrQEeAxRbReEoDJX TO1/EK1Ig6eHFrPzVc/lJxfn+a8XSD//wnhcBcRzv9HHw/VsA80NjY9yCPWxQXuTMqrcMJj9/Vx y+xdDnXfluYWb5KwGdjKGQFPs4qapOtJzwF+KGvex4j0lLGCanFKyMe5n5K677yoLdKc2OAmykE uhYXw+lpH4zKXE4SwYA== 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-02-03_04,2026-02-02_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 clxscore=1015 impostorscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 adultscore=0 lowpriorityscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2602030112 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0064b401.pphosted.com id 613B02kg1683699 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 ; Tue, 03 Feb 2026 14:04:16 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/230456 From: Deepesh Varatharajan Add selftests to validate LLVM, Clang, and LLD test suites using llvm-lit for both native and target builds. The tests cover: - Native llvm, clang, and lld using llvm-lit - Target-side execution under QEMU via NFS using llvm-lit - Architecture and OS-specific test filtering - Known failing test exclusions Signed-off-by: Deepesh Varatharajan --- meta/lib/oeqa/selftest/cases/clang.py | 301 ++++++++++++++++++++++++++ 1 file changed, 301 insertions(+) create mode 100644 meta/lib/oeqa/selftest/cases/clang.py diff --git a/meta/lib/oeqa/selftest/cases/clang.py b/meta/lib/oeqa/selftest/cases/clang.py new file mode 100644 index 0000000000..a13bb8eae2 --- /dev/null +++ b/meta/lib/oeqa/selftest/cases/clang.py @@ -0,0 +1,301 @@ +# +# Copyright (c) 2026 by Wind River Systems, Inc. +# +# SPDX-License-Identifier: MIT +# +import time +import contextlib +import subprocess +from oeqa.core.decorator import OETestTag +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import bitbake, get_bb_var, runqemu +from oeqa.utils.nfs import unfs_server + +class ClangFamilyBase(OESelftestTestCase): + + ALL_ARCHS = [ + "aarch64", "arm", "i386", "x86_64", "x86", + "mips", "riscv", "riscv64", "ppc", "ppc64", + "hexagon", "sparc", "sparcv9", "msp430", + "loongarch" + ] + + EXCLUDE_OS = [ + "Mac", "macho", "Darwin", "OSX", "wasm", + "Windows", "Win", "MinGW", "COFF", "zos", + "FreeBSD", "aix", "fuchsia", "ve" + ] + +class ClangFamilyNativeSelfTest(ClangFamilyBase): + + def test_clang_family_native(self): + recipes = ["llvm-native", "clang-native", "lld-native"] + host_arch = get_bb_var("HOST_ARCH") + + for recipe in recipes: + bitbake(recipe) + workdir = get_bb_var("WORKDIR", recipe) + build_dir = get_bb_var("B", recipe) + staging_dir_native = get_bb_var("STAGING_DIR_NATIVE") + test_dir = f"{build_dir}/test" + result_log = f"{workdir}/temp/{recipe}-results.log" + result_sum = f"{workdir}/temp/tests.sum" + lit_bin = f"{build_dir}/bin/llvm-lit" + arches = [a for a in self.ALL_ARCHS if a != host_arch] + filter_out = "|".join(arches + self.EXCLUDE_OS) + env = os.environ.copy() + env["LD_LIBRARY_PATH"] = f"{build_dir}/lib:{staging_dir_native}/usr/lib:{env.get('LD_LIBRARY_PATH', '')}" + + cmd = f"{lit_bin} --filter-out '{filter_out}' '{test_dir}' -o '{result_log}'" + + with open(result_sum, "w") as f: + try: + subprocess.run(cmd, shell=True, check=True, env=env, stdout=f) + except subprocess.CalledProcessError as e: + raise AssertionError( + f"{recipe} llvm-lit failed — see {result_log} for details" + ) + +class ClangFamilyTargetBase(ClangFamilyBase): + + DEFAULT_PACKAGES = [ + "bash", + "libgcc", + "libstdc++", + "llvm", + "python3", + "python3-core", + "python3-modules", + "nfs-utils", + "grep", + "sed", + "findutils", + "cpio", + "which", + ] + + def setUp(self): + super().setUp() + self.target_arch = get_bb_var("TARGET_ARCH") + self.tmpdir = get_bb_var("TMPDIR") + arches = [a for a in self.ALL_ARCHS if a != self.target_arch] + self.filter_out = "|".join(arches + self.EXCLUDE_OS) + + def build_core_image(self): + features = [ + 'IMAGE_FEATURES += "ssh-server-openssh"', + 'CORE_IMAGE_EXTRA_INSTALL += "{}"'.format(" ".join(self.DEFAULT_PACKAGES)) + ] + self.write_config("\n".join(features)) + bitbake("core-image-minimal") + + def start_qemu_nfs(self): + ctx = contextlib.ExitStack() + s = ctx.__enter__() + nfsport, mountport = s.enter_context(unfs_server(self.tmpdir, udp=False)) + qemu = s.enter_context( + runqemu("core-image-minimal", runqemuparams="nographic", qemuparams="-m 2048") + ) + + status, _ = qemu.run("uname") + if status != 0: + raise AssertionError("QEMU SSH check failed") + + status, _ = qemu.run(f"mkdir -p {self.tmpdir}") + if status != 0: + raise AssertionError("Failed to create TMPDIR on target") + + mountcmd = ( + f"mount -o noac,nfsvers=3,port={nfsport},mountport={mountport} " + f"\"{qemu.server_ip}:{self.tmpdir}\" \"{self.tmpdir}\"" + ) + status, output = qemu.run(mountcmd) + if status != 0: + raise AssertionError(f"NFS mount failed: {output}") + return ctx, qemu + + def run_llvm_lit(self, recipe, extra_filter=None, timeout=None): + build_dir = get_bb_var("B", recipe) + workdir = get_bb_var("WORKDIR", recipe) + lit_bin = f"{build_dir}/bin/llvm-lit" + test_dir = f"{build_dir}/test" + guest_result = f"/tmp/{recipe}-target-results.json" + host_result = f"{workdir}/{recipe}-target-results.log" + + filter_regex = self.filter_out + if extra_filter: + filter_regex += "|" + "|".join(extra_filter) + + cmd = ( + f"cd {build_dir}/bin && " + f"python3 ./llvm-lit --filter-out '{filter_regex}' ../test -o {guest_result}" + ) + + return cmd, guest_result, host_result + +@OETestTag("toolchain-system") +@OETestTag("toolchain-user") +@OETestTag("runqemu") +class LLVMSelfTestSystemEmulated(ClangFamilyTargetBase): + + LLVM_EXTRA_EXCLUDE = [ + "BugPoint/compile-custom\\.ll$", + "BugPoint/replace-funcs-with-null\\.ll$", + "CodeGen/AMDGPU/lds-run-twice-absolute-md\\.ll$", + "CodeGen/AMDGPU/lds-run-twice\\.ll$", + "CodeGen/Generic/fp128-math-libcalls\\.ll$", + "CodeGen/Thumb/2009-08-20-ISelBug\\.ll$", + "CodeGen/Thumb/2010-07-15-debugOrdering\\.ll$", + "CodeGen/Thumb/2014-06-10-thumb1-ldst-opt-bug\\.ll$", + "CodeGen/Thumb/PR17309\\.ll$", + "CodeGen/Thumb/dyn-stackalloc\\.ll$", + "CodeGen/Thumb/frame-access\\.ll$", + "CodeGen/Thumb/ldm-merge-call\\.ll$", + "CodeGen/Thumb/pop\\.ll$", + "CodeGen/Thumb/pr35836\\.ll$", + "CodeGen/Thumb/pr35836_2\\.ll$", + "CodeGen/Thumb/smul_fix\\.ll$", + "CodeGen/Thumb/stack-guard-xo\\.ll$", + "CodeGen/Thumb/stm-deprecated\\.ll$", + "CodeGen/Thumb/stm-merge\\.ll$", + "CodeGen/Thumb/thumb-ldm\\.ll$", + "CodeGen/Thumb/ucmp\\.ll$", + "CodeGen/Thumb/vargs\\.ll$", + "CodeGen/Thumb2/2009-08-21-PostRAKill4\\.ll$", + "CodeGen/Thumb2/2009-09-01-PostRAProlog\\.ll$", + "CodeGen/Thumb2/constant-islands\\.ll$", + "CodeGen/Thumb2/ldr-str-imm12\\.ll$", + "CodeGen/Thumb2/pacbti-m-varargs-1\\.ll$", + "CodeGen/Thumb2/pacbti-m-varargs-2\\.ll$", + "CodeGen/Thumb2/thumb2-ldm\\.ll$", + "Other/spirv-sim/.*", + "Transforms/LoopLoadElim/.*", + "tools/llvm-cgdata/merge-combined-funcmap-hashtree\\.test$", + "tools/llvm-cgdata/merge-funcmap-concat\\.test$", + "tools/llvm-cgdata/merge-funcmap-double\\.test$", + "tools/llvm-cgdata/merge-funcmap-single\\.test$", + "tools/llvm-cgdata/merge-hashtree-concat\\.test$", + "tools/llvm-cgdata/merge-hashtree-double\\.test$", + "tools/llvm-cgdata/merge-hashtree-single\\.test$", + "tools/llvm-locstats/locstats\\.ll$", + "tools/llvm-locstats/no_scope_bytes\\.ll$", + "tools/llvm-objcopy/ELF/basic-binary-copy\\.test$", + "tools/llvm-objcopy/ELF/binary-first-seg-offset-zero\\.test$", + "tools/llvm-objcopy/ELF/binary-no-paddr\\.test$", + "tools/llvm-objcopy/ELF/binary-paddr\\.test$", + "tools/llvm-objcopy/ELF/binary-segment-layout\\.test$", + "tools/llvm-objcopy/ELF/check-addr-offset-align-binary\\.test$", + "tools/llvm-objcopy/ELF/dump-section\\.test$", + "tools/llvm-objcopy/ELF/gap-fill\\.test$", + "tools/llvm-objcopy/ELF/pad-to\\.test$", + "tools/llvm-objcopy/ELF/parent-loop-check\\.test$", + "tools/llvm-objcopy/ELF/strip-all-gnu\\.test$", + "tools/llvm-objcopy/ELF/strip-sections-keep\\.test$", + "tools/llvm-objcopy/ELF/strip-sections-only-section\\.test$", + "tools/llvm-objcopy/ELF/strip-sections\\.test$", + "tools/llvm-objcopy/ELF/update-section\\.test$", + "tools/llvm-original-di-preservation/basic\\.test$", + "tools/opt-viewer/.*", + "tools/UpdateTestChecks/.*", + "tools/yaml2obj/ELF/custom-fill\\.yaml$", + "tools/yaml2obj/ELF/header-elfdatanone\\.yaml$", + "tools/yaml2obj/ELF/header-sh-fields\\.yaml$", + "tools/yaml2obj/GOFF/GOFF-header-end\\.yaml$", + "tools/yaml2obj/GOFF/GOFF-header-settings\\.yaml$", + ] + + def test_llvm(self): + bitbake("llvm") + self.build_core_image() + ctx, qemu = self.start_qemu_nfs() + with ctx: + cmd, guest_result, host_result = self.run_llvm_lit( + "llvm", extra_filter=self.LLVM_EXTRA_EXCLUDE + ) + status, output = qemu.run(cmd, timeout=3600) + if status != 0: + raise AssertionError(f"llvm-lit failed for LLVM: {output}") + status, _ = qemu.run(f"cp {guest_result} {host_result}") + if status != 0: + raise AssertionError("Failed to copy LLVM lit results back to host") + +@OETestTag("toolchain-system") +@OETestTag("toolchain-user") +@OETestTag("runqemu") +class ClangSelfTestSystemEmulated(ClangFamilyTargetBase): + + CLANG_EXTRA_EXCLUDE = [ + "APINotes/yaml-roundtrip-2\\.test$", + "APINotes/yaml-roundtrip\\.test$", + "Analysis/dead-stores\\.c$", + "Analysis/exploded-graph-rewriter/.*", + "Analysis/scan-build/cxx-name\\.test$", + "Analysis/scan-build/deduplication\\.test$", + "Analysis/scan-build/exclude_directories\\.test$", + "Analysis/scan-build/help\\.test$", + "Analysis/scan-build/html_output\\.test$", + "Analysis/scan-build/plist_html_output\\.test$", + "Analysis/scan-build/plist_output\\.test$", + "Analysis/scan-build/rebuild_index/rebuild_index\\.test$", + "Analysis/scan-build/silence-core-checkers\\.test$", + "Analysis/virtualcall-fixits\\.cpp$", + "ClangScanDeps/module.*", + "ClangScanDeps/multiple-commands\\.c$", + "ClangScanDeps/optimize-vfs-edgecases\\.m$", + "ClangScanDeps/optimize-vfs-pch\\.m$", + "ClangScanDeps/visible-modules\\.c$", + "ClangScanDeps/Wsystem-headers-in-module\\.c$", + "Format/docs_updated\\.test$", + "Interpreter/cxx20-modules\\.cppm$", + "Modules/double-quotes\\.m$", + "Modules/framework-public-includes-private\\.m$", + "Modules/implicit-module-header-maps\\.cpp$", + "Preprocessor/header-search-crash\\.c$", + "Preprocessor/headermap-rel\\.c$", + "Preprocessor/headermap-rel2\\.c$", + "Preprocessor/include-header-missing-in-framework-with-headermap\\.c$", + "Preprocessor/search-path-usage\\.m$", + ] + + def test_clang(self): + bitbake("clang") + self.build_core_image() + ctx, qemu = self.start_qemu_nfs() + with ctx: + cmd, guest_result, host_result = self.run_llvm_lit( + "clang", extra_filter=self.CLANG_EXTRA_EXCLUDE + ) + status, output = qemu.run(cmd, timeout=3600) + if status != 0: + raise AssertionError(f"llvm-lit failed for Clang: {output}") + status, _ = qemu.run(f"cp {guest_result} {host_result}") + if status != 0: + raise AssertionError("Failed to copy Clang lit results back to host") + +@OETestTag("toolchain-system") +@OETestTag("toolchain-user") +@OETestTag("runqemu") +class LLDSelfTestSystemEmulated(ClangFamilyTargetBase): + + LLD_EXTRA_EXCLUDE = [ + "ELF/fill-trap\\.s$", + "ELF/oformat-binary-ttext\\.s$", + "ELF/oformat-binary\\.s$", + "ELF/partition-synthetic-sections\\.s$", + "ELF/reproduce\\.s$", + ] + + def test_lld(self): + bitbake("lld") + self.build_core_image() + ctx, qemu = self.start_qemu_nfs() + with ctx: + cmd, guest_result, host_result = self.run_llvm_lit( + "lld", extra_filter=self.LLD_EXTRA_EXCLUDE + ) + status, output = qemu.run(cmd, timeout=3600) + if status != 0: + raise AssertionError(f"llvm-lit failed for LLD: {output}") + status, _ = qemu.run(f"cp {guest_result} {host_result}") + if status != 0: + raise AssertionError("Failed to copy LLD lit results back to host")