From patchwork Mon Nov 15 13:49:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guillermo E. Martinez" X-Patchwork-Id: 47674 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 729D63858003 for ; Mon, 15 Nov 2021 13:51:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 729D63858003 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1636984271; bh=2k8zVXn+1O+V6wBQKlWH22dR3GXYnGRh0NMcUCdRvUs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=rKaJRwfFHpVCcRHu6Q279tke5ioUzQWrqt9CxvKGOhBat6lT+of+NMS3zwH2AU7Tn Z/TBB/hEAl6+iibE/OP/oEpueG+hw4sPzylVK7U6wn8otvaj+RviBz2FDWl5My5S33 +da0ilkFj78YZKilmcqB118juK8ht+0s5wLWy6Bo= X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id EA3AE3858D39 for ; Mon, 15 Nov 2021 13:50:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EA3AE3858D39 Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1AFDgkiL001121 for ; Mon, 15 Nov 2021 13:50:54 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3cbhtvj1vu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 15 Nov 2021 13:50:49 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 1AFDkBMm113956 for ; Mon, 15 Nov 2021 13:50:47 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2177.outbound.protection.outlook.com [104.47.57.177]) by userp3030.oracle.com with ESMTP id 3ca2fuj5um-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 15 Nov 2021 13:50:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GETti1XOhbiFwaR+fIMlnAv62ZGGLxadzEuHhCwALpGxVWPNJmP9K0Sb4JBJxrizHBIV4zlJN17j/9J7ppLf/aEMenh/nFGbg5BJiek+bGW7mlOCjPS6wdY3ha81XEAGVstj2aPNjq0LAxrz9HAvpRCuThIBCTq9M5YW3TPg10FBRC9NrydpHX933nti0Qw1WnBhKWjFb/Lak0ySVIfDCeAZ6FjioG4tveyJGnHdqZB5H02xs6+g9sPkK/2q3tuJKMfGiWLX1pMUTGy279YrkHaFLpZhLKY1a7UyEWc20nuhSZcVfuC+lA/CWtqyrjqifzWZBZzSy1SWFoRdmvnZdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=2k8zVXn+1O+V6wBQKlWH22dR3GXYnGRh0NMcUCdRvUs=; b=hO8wSVB+nSYudmN9TNquO4VG7m/P62x7Ed9kSQE01H84Euew3zpL9hHdRqzauYt9+5V0efigY+ukVKBtxeriz3M2TxgID6i6kSle5R8c7hjYEWl8ZxdERwQx6tvyrGtb7gqj437z9fK9mozJ327Ufci2z1rxz8WT48NJ9LK4FVZqotbaoKdQ1Dbvci8Jni0x8oWr2h894BeWGesfdokoE+8uXR/ORGZNfSzIxdDuNaZbsA10JtdM8PXqujxJKxiqSdm/V8FgpbMs2VdDpBREQ2BHEvuNpugKAwLihDsF/vIXXiEbTa0MthRlGPmTWOEm5yPneMMi/G6oWWrqUi37tQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from BL0PR10MB2852.namprd10.prod.outlook.com (2603:10b6:208:76::22) by BLAPR10MB4964.namprd10.prod.outlook.com (2603:10b6:208:30c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26; Mon, 15 Nov 2021 13:50:40 +0000 Received: from BL0PR10MB2852.namprd10.prod.outlook.com ([fe80::7126:e98e:9cff:8765]) by BL0PR10MB2852.namprd10.prod.outlook.com ([fe80::7126:e98e:9cff:8765%7]) with mapi id 15.20.4690.027; Mon, 15 Nov 2021 13:50:40 +0000 To: libabigail@sourceware.org Subject: [PATCH] Add regression tests for ctf reading Date: Mon, 15 Nov 2021 07:49:53 -0600 Message-Id: <20211115134953.3785647-1-guillermo.e.martinez@oracle.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <1859179.TfuLjZUhfy@sali> References: <1859179.TfuLjZUhfy@sali> X-ClientProxiedBy: SA0PR11CA0119.namprd11.prod.outlook.com (2603:10b6:806:d1::34) To BL0PR10MB2852.namprd10.prod.outlook.com (2603:10b6:208:76::22) MIME-Version: 1.0 Received: from localhost.localdomain (187.248.82.110) by SA0PR11CA0119.namprd11.prod.outlook.com (2603:10b6:806:d1::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.26 via Frontend Transport; Mon, 15 Nov 2021 13:50:39 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7a657288-142b-4694-a910-08d9a83ee904 X-MS-TrafficTypeDiagnostic: BLAPR10MB4964: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:935; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ut8iKUnqvj1bVGz8tgr6o3JmHGuzHKO9B9kLrIe3ezJ8WplziQkUs71LLgInyMemGk3s4A+gVQNVuFfOdbrI5G6qlkZ6Hx9X28cIDwWQFvESmNkQ6FB2Jq3j79A3rIS/SWvrCoRlOD3aswuOrE/X21PmBdofc/++Sp1vn6dYkL+xUq/Um6Knmmma93hK5gY/g1jhYbONedjpqhbexjQ1foY+ycd7Kq8uK/Zl7sz2dendUgx+5o7ohk25Bd2o2KYBqvty4YifrSgWqpp1S6oRA7cUFIncEUCmjLvnADJQtEX2J0EEm1kTuMGN0nxw0Sv03Cm1chj+7OY8pH9Z95Df8GGX1pKYbBQrhnYJonXtPRyIn5x6543Sk1nAoSGcfD1xr8rEQcf84DxgwURRenJRcPkVGyuSoqWPX+DS8p8voEQY/XXq5eui0sIgVszQ4HQBNkZLudH/bnLfEXni/96SjrI9yxoqFqjYyOH4nVyL5eDwznpLG0uuX/r/ioappUR2j8cDRiNoiljEH/qlAjIRoIUxoY6fffry1bbRgYwlwXBBHeziQd88lTNuP5uZnSVUNu2vSsUu63axle04g6GpOxilbJy8EklS1+o4hyOxnYyzT7YVPz/P6VDZlwbtDK+iHhvkiQeI40zFxJDIIGUGbsVWevsW+l9e04aiSRiDSNucI1M56dCtSPf1jmBo44W29oSZrHmcX259dIxelf1zOzny75tLfVYx5enzJSeohZ8tmRTHhHMRv7lc0v/CFDMnCr3W6M2f563KC5nKaA9UdXZGsjd07bcEzjhYh0x5wmc= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BL0PR10MB2852.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(2616005)(107886003)(508600001)(52116002)(66556008)(83380400001)(66476007)(8936002)(66946007)(6486002)(966005)(36756003)(956004)(1076003)(38350700002)(103116003)(6512007)(38100700002)(6506007)(5660300002)(26005)(30864003)(2906002)(4326008)(6666004)(19627235002)(316002)(86362001)(186003)(8676002)(6916009)(579004)(559001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: okrlucJvmlw6yh2LrX4qHQ4SHY6BW+oyhoAuO8bGtpwUp7sUSjpILysIzWQTI4QM9P8VzibtY7Y/8Xio9bSoVowibcGd8UDsgjkhqRmAxFRg+O3AgwDOEhEdX75LdP3zz6r0CA39noM7QH8ZZKvRO3wyNP/jhfiwH76NWo0s6qKPHz73ZKoJf0b5h5VKe9gQBuiqyd08plYEP8Y40HLbXU2nTld7q3ThoEicKXt1mX3yQ6tpXfnXESQxmZbFerKybXYVYOl9yldymzFrjHRQkWCURP6nYjEALtCC5OvXpFapXkFDFTtoUGa7f+uijMDN7AVVt6LeF7qEz3LmPybkxtcCH4a4gaNdweHDKcAPWAA5fcl3hlMnJfqqKAuUWGbVq6lU+gpAY+QhWDXBe5JLHSuFixZ3YKCZnftdoUsuiIqPkLNWd+T68IPm7apbY01ta5FjZqlsS2jGyTjC8afLyTaBGx5+qQokmUE831/Ozi7bmV20Y+3AjoY8KwmEvN6tCO4GOHpT8TPJrveXlJ63GAuvPUqCss5raA7lC1z8uKUDAeIjlJL39uPh5yjICcQnm9qFQWHxdiuKF7rhorI8V7RR8lZxYSG22OwKYj45yXM1wC4JCC6dQipZAkoEI+ogbg/3yhhwTLUWGI4f/xH6h4rsJDcl+XDdwBNd+SHLd1YhJe3o2Yqlibp8xMygeh05CSNIlEgCLZQbpYtl8HQRsD3ihxEiTQUzGtWFAkEVSKOWqvXdx/tzkWt30MzvbUHmuzH3/llBkF1mz6PjL3EdOhKkkqeD6B5IB5Dgior4juE/lTm6qnBYDL93bj5E57wWO0rhUldKTPm16E4wB9JxnGY7m0sCmVsmTwlVrHIcVrIlt+1CMKY33pjRMQZtR6d8yPhPRPkftZbxFf6PuaIt2yTaXVhvgbWliEy9tDp6TEJAQgDENJsd4NNLt43JGThShFOoiYshxrKm++pexpYwdYH+BRsDVAnsyKw+E2UiMNEgz9VtSiN1g4f+rJeJ8cURL9+W2ms99y0n/dgTGjWmaFCI1kHNPycHORoVtH/H0ook/j32DdhSNvVmjVjxPO5beihPyFv0k8C/k3VBwKywMEXdp9Dy4+xR269iSj52zGLk3Kf9pAxgN7QegkW/RiwROd4WLEjwpRstLH+s/bdTilsEcImiSaqo1FMgADLGZaN5GUUrCmuGjWTbKLd+wiFAKRJdS4LJdh0mET3jatHQOv6zDriI/m8SDnyxTpEC79MYF7R/RiXu7xuzmvyfp6xVoeiIUh3Fmc6SNsEtW9HbIfJ5CYqpmwHM5tTI7S6Lweph0U5QbETAQ9a05B2Mqb2C4fQoIVc9u8xSTVg/L83DIaecwaBKRGW5PTxD7uMx8nxP6LPHWI36I4d6FiolbWqJVs+lEU8Ug+37NaBlWMQ1FtqCYkuKpsqu0IIDhej/iVBpeBp19rvF3FTR13TU+oqJejfRCq6LcUorbR3TEAhq4Hv16cmQU6z4mrDl4F2JWtJZYCshlM+kBicXZbk4NcPK7uR3lddTkWLoC33lrB+FNuhNplOa4K2SI77vJM1rd6mhMKKHZ88cjrIEEFys7qxOAtyGHCTTMvX5avPE3vrhnXwlT8yjNzTQUxIxjC1WJ8+IMkbTmxsqo6PoSVr0ia9bqczeDR0OwQtUSAm0qtynZg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a657288-142b-4694-a910-08d9a83ee904 X-MS-Exchange-CrossTenant-AuthSource: BL0PR10MB2852.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Nov 2021 13:50:40.6078 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6hmvyA/dK/8DU+cg/72EOSDH+VrljQ2NJehKJMM81B0KXuBWdnwq8RdUyDY4Ic+o/ZzJuCpqgXQ2UsnMH46MmNcXM2301syrr3US0QBHF5Q= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR10MB4964 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10168 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2111150074 X-Proofpoint-GUID: 6Qd52WHN1nIbUEH9R-zcQ5S3vH3L0hAA X-Proofpoint-ORIG-GUID: 6Qd52WHN1nIbUEH9R-zcQ5S3vH3L0hAA X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Guillermo E. Martinez via Libabigail" From: "Guillermo E. Martinez" Reply-To: "Guillermo E. Martinez" Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" This patch includes a new regression tests for CTF. Comments will be appreciated. Thanks in advanced!, Guillermo This patch implements some regression tests for ctf reading. Since the code share a lot of functionalities already used in the readi-dwarf test, a library was built and test common harness were moved to a common location. So input files for test-read-{dwarf,ctf}.cc now are located in: tests/data/test-read-common directory, ABIs description are stored in the same location but in a separate file, one for each binary debugging information: (e.g, test4-ctf.so.abi and test4-dwarf.so.abi) * tests/test-read-ctf.cc: New ctf reading regression test. * tests/test-read-common.cc: New library to be used with test-read-{ctf,dwarf}.cc. * tests/test-read-common.h: Likewise. * tests/test-annotate.cc (in_out_specs): Adjust path for input files. * tests/Makefile.am: Build new tests/test-read-ctf.cc file. Add libtestreadcommon.a test library and use it for test-read-{ctf,dwarf}. * tests/test-read-dwarf.cc: Adapt test to use libtestreadcommon.a in test-read-common.{cc,h}. * tests/data/test-annotate/test3.so.abi: Adjust ELF input path file location to ./tests/data/test-read-common. * tests/data/test-annotate/test4.so.abi: Likewise. * tests/data/test-read-common/PR26261: Move test harness to test-read-common directory. * tests/data/test-read-common/PR27700: Likewise. * tests/data/test-read-common/test-PR26568-*: Likewise. * tests/data/test-read-common/test3*: Likewise. * tests/data/test-read-common/test4*: Likewise. * tests/data/test-read-ctf/test-alias.c: New testcase. * tests/data/test-read-ctf/test-ambiguous-struct-A.c: Likewise. * tests/data/test-read-ctf/test-ambiguous-struct-B.c: Likewise. * tests/data/test-read-ctf/test-conflicting-type-syms-a.c: Likewise. * tests/data/test-read-ctf/test-conflicting-type-syms-b.c: Likewise. * tests/data/test-read-ctf/test-enum-ctf.c: Likewise. * tests/data/test-read-ctf/test-enum-many-ctf.c: Likewise. * tests/data/test-read-ctf/test-enum-symbol-ctf.c: Likewise. * tests/data/test-read-ctf/test-struct-iteration-ctf.c: Likewise. * tests/data/test-read-ctf/test0.c: Likewise. * tests/data/test-read-ctf/test1.c: Likewise. * tests/data/test-read-ctf/test2.c: Likewise. * tests/data/test-read-ctf/test-alias.o.abi: Testcase expected result. * tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-alias.o.abi: Likewise. * tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-enum-ctf.o.abi: Likewise. * tests/data/test-read-ctf/test-enum-many-ctf.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-enum-symbol-ctf.o.hash.abi: Likewise. * tests/data/test-read-ctf/test-struct-iteration-ctf.o.abi: Likewise. * tests/data/test-read-ctf/test0: Likewise. * tests/data/test-read-ctf/test0.abi: Likewise. * tests/data/test-read-ctf/test0.hash.abi: Likewise. * tests/data/test-read-ctf/test1.so: Likewise. * tests/data/test-read-ctf/test1.so.abi: Likewise. * tests/data/test-read-ctf/test1.so.hash.abi: Likewise. * tests/data/test-read-ctf/test2.so: Likewise. * tests/data/test-read-ctf/test2.so.abi: Likewise. * tests/data/test-read-ctf/test2.so.hash.abi: Likewise. --- tests/Makefile.am | 24 +- tests/data/test-annotate/test3.so.abi | 8 +- tests/data/test-annotate/test4.so.abi | 12 +- .../data/test-read-common/PR26261/PR26261-exe | Bin 0 -> 19000 bytes .../PR26261/PR26261-exe-ctf.abi | 58 +++ .../PR26261/PR26261-exe-dwarf.abi} | 52 ++- .../test-read-common/PR26261/PR26261-exe.abi | 58 +++ .../PR26261/PR26261-exe_ctf.abi | 58 +++ .../PR26261/PR26261-main.c | 0 .../PR26261/PR26261-obja.c | 0 .../PR26261/PR26261-obja.h | 0 .../PR26261/PR26261-objb.c | 0 .../PR26261/PR26261-objb.h | 0 .../PR27700/include-dir/priv.h | 0 .../PR27700/include-dir/pub.h | 0 .../PR27700/pub-incdir/inc.h | 0 .../PR27700/test-PR27700-ctf.abi | 22 ++ .../PR27700/test-PR27700-dwarf.abi} | 8 +- .../PR27700/test-PR27700.c | 2 + .../test-read-common/test-PR26568-1-ctf.o.abi | 56 +++ .../test-PR26568-1-dwarf.o.abi} | 20 +- .../test-PR26568-1.c | 0 .../test-read-common/test-PR26568-2-ctf.o.abi | 39 ++ .../test-PR26568-2-dwarf.o.abi} | 18 +- .../test-PR26568-2.c | 2 + .../test3-alias-1-dwarf.so.hash.abi | 14 + .../test3-alias-1.suppr | 0 .../test3-alias-2-dwarf.so.hash.abi | 16 + .../test3-alias-2.suppr | 0 .../test3-alias-3-dwarf.so.hash.abi | 14 + .../test3-alias-3.suppr | 0 .../test3-alias-4-dwarf.so.hash.abi | 11 + .../test3-alias-4.suppr | 0 tests/data/test-read-common/test3-ctf.so.abi | 10 + .../test-read-common/test3-ctf.so.hash.abi | 10 + .../test3-dwarf.so.abi} | 8 +- .../test3-dwarf.so.hash.abi} | 8 +- .../test3.c | 1 + tests/data/test-read-common/test3.so | Bin 0 -> 16424 bytes tests/data/test-read-common/test4-ctf.so.abi | 14 + .../test-read-common/test4-ctf.so.hash.abi | 14 + .../test4-dwarf.so.abi} | 12 +- .../test4-dwarf.so.hash.abi} | 12 +- tests/data/test-read-common/test4.c | 11 + tests/data/test-read-common/test4.so | Bin 0 -> 16672 bytes tests/data/test-read-ctf/test-alias.c | 16 + tests/data/test-read-ctf/test-alias.o.abi | 19 + .../test-read-ctf/test-ambiguous-struct-A.c | 8 + .../test-ambiguous-struct-A.o.hash.abi | 36 ++ .../test-read-ctf/test-ambiguous-struct-B.c | 5 + .../test-ambiguous-struct-B.o.hash.abi | 23 ++ .../test-conflicting-type-syms-a.c | 5 + .../test-conflicting-type-syms-a.o.hash.abi | 14 + .../test-conflicting-type-syms-b.c | 5 + .../test-conflicting-type-syms-b.o.hash.abi | 13 + tests/data/test-read-ctf/test-enum-ctf.c | 8 + tests/data/test-read-ctf/test-enum-ctf.o.abi | 24 ++ tests/data/test-read-ctf/test-enum-many-ctf.c | 10 + .../test-enum-many-ctf.o.hash.abi | 69 ++++ .../data/test-read-ctf/test-enum-symbol-ctf.c | 1 + .../test-enum-symbol-ctf.o.hash.abi | 16 + .../test-read-ctf/test-struct-iteration-ctf.c | 28 ++ .../test-struct-iteration-ctf.o.abi | 96 +++++ tests/data/test-read-ctf/test0 | Bin 0 -> 2600 bytes tests/data/test-read-ctf/test0.abi | 64 +++ tests/data/test-read-ctf/test0.c | 32 ++ tests/data/test-read-ctf/test0.hash.abi | 64 +++ tests/data/test-read-ctf/test1.c | 25 ++ tests/data/test-read-ctf/test1.so | Bin 0 -> 15592 bytes tests/data/test-read-ctf/test1.so.abi | 23 ++ tests/data/test-read-ctf/test1.so.hash.abi | 23 ++ tests/data/test-read-ctf/test2.c | 19 + tests/data/test-read-ctf/test2.so | Bin 0 -> 15616 bytes tests/data/test-read-ctf/test2.so.abi | 25 ++ tests/data/test-read-ctf/test2.so.hash.abi | 25 ++ tests/data/test-read-dwarf/PR26261/Makefile | 21 - .../data/test-read-dwarf/PR26261/PR26261-exe | Bin 10976 -> 0 bytes .../test-read-dwarf/PR27700/test-PR27700.o | Bin 3248 -> 0 bytes tests/data/test-read-dwarf/test-PR26568-1.o | Bin 2864 -> 0 bytes tests/data/test-read-dwarf/test-PR26568-2.o | Bin 2824 -> 0 bytes .../test-read-dwarf/test3-alias-1.so.hash.abi | 14 - .../test-read-dwarf/test3-alias-2.so.hash.abi | 18 - .../test-read-dwarf/test3-alias-3.so.hash.abi | 14 - .../test-read-dwarf/test3-alias-4.so.hash.abi | 8 - tests/data/test-read-dwarf/test3.so | Bin 8851 -> 0 bytes tests/data/test-read-dwarf/test4.c | 14 - tests/data/test-read-dwarf/test4.so | Bin 3364 -> 0 bytes tests/test-annotate.cc | 4 +- tests/test-read-common.cc | 184 +++++++++ tests/test-read-common.h | 148 +++++++ tests/test-read-ctf.cc | 328 ++++++++++++++++ tests/test-read-dwarf.cc | 363 +++++++----------- 92 files changed, 1996 insertions(+), 408 deletions(-) create mode 100755 tests/data/test-read-common/PR26261/PR26261-exe create mode 100644 tests/data/test-read-common/PR26261/PR26261-exe-ctf.abi rename tests/data/{test-read-dwarf/PR26261/PR26261-exe.abi => test-read-common/PR26261/PR26261-exe-dwarf.abi} (53%) create mode 100644 tests/data/test-read-common/PR26261/PR26261-exe.abi create mode 100644 tests/data/test-read-common/PR26261/PR26261-exe_ctf.abi rename tests/data/{test-read-dwarf => test-read-common}/PR26261/PR26261-main.c (100%) rename tests/data/{test-read-dwarf => test-read-common}/PR26261/PR26261-obja.c (100%) rename tests/data/{test-read-dwarf => test-read-common}/PR26261/PR26261-obja.h (100%) rename tests/data/{test-read-dwarf => test-read-common}/PR26261/PR26261-objb.c (100%) rename tests/data/{test-read-dwarf => test-read-common}/PR26261/PR26261-objb.h (100%) rename tests/data/{test-read-dwarf => test-read-common}/PR27700/include-dir/priv.h (100%) rename tests/data/{test-read-dwarf => test-read-common}/PR27700/include-dir/pub.h (100%) rename tests/data/{test-read-dwarf => test-read-common}/PR27700/pub-incdir/inc.h (100%) create mode 100644 tests/data/test-read-common/PR27700/test-PR27700-ctf.abi rename tests/data/{test-read-dwarf/PR27700/test-PR27700.abi => test-read-common/PR27700/test-PR27700-dwarf.abi} (60%) rename tests/data/{test-read-dwarf => test-read-common}/PR27700/test-PR27700.c (55%) create mode 100644 tests/data/test-read-common/test-PR26568-1-ctf.o.abi rename tests/data/{test-read-dwarf/test-PR26568-1.o.abi => test-read-common/test-PR26568-1-dwarf.o.abi} (54%) rename tests/data/{test-read-dwarf => test-read-common}/test-PR26568-1.c (100%) create mode 100644 tests/data/test-read-common/test-PR26568-2-ctf.o.abi rename tests/data/{test-read-dwarf/test-PR26568-2.o.abi => test-read-common/test-PR26568-2-dwarf.o.abi} (59%) rename tests/data/{test-read-dwarf => test-read-common}/test-PR26568-2.c (68%) create mode 100644 tests/data/test-read-common/test3-alias-1-dwarf.so.hash.abi rename tests/data/{test-read-dwarf => test-read-common}/test3-alias-1.suppr (100%) create mode 100644 tests/data/test-read-common/test3-alias-2-dwarf.so.hash.abi rename tests/data/{test-read-dwarf => test-read-common}/test3-alias-2.suppr (100%) create mode 100644 tests/data/test-read-common/test3-alias-3-dwarf.so.hash.abi rename tests/data/{test-read-dwarf => test-read-common}/test3-alias-3.suppr (100%) create mode 100644 tests/data/test-read-common/test3-alias-4-dwarf.so.hash.abi rename tests/data/{test-read-dwarf => test-read-common}/test3-alias-4.suppr (100%) create mode 100644 tests/data/test-read-common/test3-ctf.so.abi create mode 100644 tests/data/test-read-common/test3-ctf.so.hash.abi rename tests/data/{test-read-dwarf/test3.so.abi => test-read-common/test3-dwarf.so.abi} (50%) rename tests/data/{test-read-dwarf/test3.so.hash.abi => test-read-common/test3-dwarf.so.hash.abi} (50%) rename tests/data/{test-read-dwarf => test-read-common}/test3.c (71%) create mode 100755 tests/data/test-read-common/test3.so create mode 100644 tests/data/test-read-common/test4-ctf.so.abi create mode 100644 tests/data/test-read-common/test4-ctf.so.hash.abi rename tests/data/{test-read-dwarf/test4.so.abi => test-read-common/test4-dwarf.so.abi} (51%) rename tests/data/{test-read-dwarf/test4.so.hash.abi => test-read-common/test4-dwarf.so.hash.abi} (51%) create mode 100644 tests/data/test-read-common/test4.c create mode 100755 tests/data/test-read-common/test4.so create mode 100644 tests/data/test-read-ctf/test-alias.c create mode 100644 tests/data/test-read-ctf/test-alias.o.abi create mode 100644 tests/data/test-read-ctf/test-ambiguous-struct-A.c create mode 100644 tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi create mode 100644 tests/data/test-read-ctf/test-ambiguous-struct-B.c create mode 100644 tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi create mode 100644 tests/data/test-read-ctf/test-conflicting-type-syms-a.c create mode 100644 tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi create mode 100644 tests/data/test-read-ctf/test-conflicting-type-syms-b.c create mode 100644 tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi create mode 100644 tests/data/test-read-ctf/test-enum-ctf.c create mode 100644 tests/data/test-read-ctf/test-enum-ctf.o.abi create mode 100644 tests/data/test-read-ctf/test-enum-many-ctf.c create mode 100644 tests/data/test-read-ctf/test-enum-many-ctf.o.hash.abi create mode 100644 tests/data/test-read-ctf/test-enum-symbol-ctf.c create mode 100644 tests/data/test-read-ctf/test-enum-symbol-ctf.o.hash.abi create mode 100644 tests/data/test-read-ctf/test-struct-iteration-ctf.c create mode 100644 tests/data/test-read-ctf/test-struct-iteration-ctf.o.abi create mode 100644 tests/data/test-read-ctf/test0 create mode 100644 tests/data/test-read-ctf/test0.abi create mode 100644 tests/data/test-read-ctf/test0.c create mode 100644 tests/data/test-read-ctf/test0.hash.abi create mode 100644 tests/data/test-read-ctf/test1.c create mode 100755 tests/data/test-read-ctf/test1.so create mode 100644 tests/data/test-read-ctf/test1.so.abi create mode 100644 tests/data/test-read-ctf/test1.so.hash.abi create mode 100644 tests/data/test-read-ctf/test2.c create mode 100755 tests/data/test-read-ctf/test2.so create mode 100644 tests/data/test-read-ctf/test2.so.abi create mode 100644 tests/data/test-read-ctf/test2.so.hash.abi delete mode 100644 tests/data/test-read-dwarf/PR26261/Makefile delete mode 100755 tests/data/test-read-dwarf/PR26261/PR26261-exe delete mode 100644 tests/data/test-read-dwarf/PR27700/test-PR27700.o delete mode 100644 tests/data/test-read-dwarf/test-PR26568-1.o delete mode 100644 tests/data/test-read-dwarf/test-PR26568-2.o delete mode 100644 tests/data/test-read-dwarf/test3-alias-1.so.hash.abi delete mode 100644 tests/data/test-read-dwarf/test3-alias-2.so.hash.abi delete mode 100644 tests/data/test-read-dwarf/test3-alias-3.so.hash.abi delete mode 100644 tests/data/test-read-dwarf/test3-alias-4.so.hash.abi delete mode 100755 tests/data/test-read-dwarf/test3.so delete mode 100644 tests/data/test-read-dwarf/test4.c delete mode 100755 tests/data/test-read-dwarf/test4.so create mode 100644 tests/test-read-common.cc create mode 100644 tests/test-read-common.h create mode 100644 tests/test-read-ctf.cc diff --git a/tests/Makefile.am b/tests/Makefile.am index e3855aea..17e2d4b4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -25,6 +25,10 @@ runtestdifffilter \ runtestreaddwarf \ runtestcanonicalizetypes.sh +if CTF_READER +TESTS += runtestreadctf +endif + # rather cheap tests TESTS+= \ runtestabicompat \ @@ -72,7 +76,7 @@ runtestcanonicalizetypes.output.final.txt noinst_PROGRAMS= $(TESTS) testirwalker testdiff2 printdifftree noinst_SCRIPTS = mockfedabipkgdiff -noinst_LTLIBRARIES = libtestutils.la libcatch.la +noinst_LTLIBRARIES = libtestutils.la libtestreadcommon.la libcatch.la libtestutils_la_SOURCES= \ test-utils.h \ @@ -82,15 +86,31 @@ libtestutils_la_CXXFLAGS= \ -DABIGAIL_SRC_DIR=\"${abs_top_srcdir}\" \ -DABIGAIL_BUILD_DIR=\"${abs_top_builddir}\" +libtestreadcommon_la_SOURCES= \ +test-read-common.h \ +test-read-common.cc + +libtestreadcommon_la_CXXFLAGS= \ +-DABIGAIL_SRC_DIR=\"${abs_top_srcdir}\" \ +-DABIGAIL_BUILD_DIR=\"${abs_top_builddir}\" + libcatch_la_SOURCES = lib/catch.cc lib/catch.hpp runtestreadwrite_SOURCES=test-read-write.cc runtestreadwrite_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la runtestreaddwarf_SOURCES=test-read-dwarf.cc -runtestreaddwarf_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la +runtestreaddwarf_LDADD=libtestreadcommon.la libtestutils.la \ + $(top_builddir)/src/libabigail.la runtestreaddwarf_LDFLAGS=-pthread +if CTF_READER +runtestreadctf_SOURCES=test-read-ctf.cc +runtestreadctf_LDADD=libtestreadcommon.la libtestutils.la \ + $(top_builddir)/src/libabigail.la +runtestreadctf_LDFLAGS=-pthread +endif + runtestannotate_SOURCES=test-annotate.cc runtestannotate_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la diff --git a/tests/data/test-annotate/test3.so.abi b/tests/data/test-annotate/test3.so.abi index b0928150..691eed12 100644 --- a/tests/data/test-annotate/test3.so.abi +++ b/tests/data/test-annotate/test3.so.abi @@ -7,18 +7,14 @@ - - - - - + - + diff --git a/tests/data/test-annotate/test4.so.abi b/tests/data/test-annotate/test4.so.abi index bc77a28f..b3a28b0a 100644 --- a/tests/data/test-annotate/test4.so.abi +++ b/tests/data/test-annotate/test4.so.abi @@ -1,4 +1,4 @@ - + @@ -6,7 +6,7 @@ - + @@ -22,13 +22,13 @@ - + - + - + - + diff --git a/tests/data/test-read-common/PR26261/PR26261-exe b/tests/data/test-read-common/PR26261/PR26261-exe new file mode 100755 index 0000000000000000000000000000000000000000..8464c22a23a9fd2c652e05fb5d43a6563a80f129 GIT binary patch literal 19000 zcmeHPdu$xV8K2$r+2`0kU*aT936wQwT zy%4vJpiN3Sxq(EgsQOS9wH1omKgu61tpKS>6A_?QWk5nm6@nt578EeyAqxoC-#0to zJ=P9HeV|I+k#@fKH{X0SJ3G6#dw28?ZqhYPaM8tjL6i|OCCjaan2SkL@z#kJVT$vF zAsWGHz+p-WK^J2@$A*B}pB)h{(epoj_5p5C>XUn<@IYNSDS1qPOT{uUMQ5cGd zOOsuYP(=&XKZfHf4u-5(Y0n^I6vLE&;oT}QhP8H-8#C&vo9kUWhBL};RzbF-FvxC5 z*$pW>hKH0sL(V7VgpT8?AIEhQ6wxLDVaU1)Ntepd%TAK;27@SqW*r=qln@Nr?poMU zoM&1%?b}s*r_0L`)jx)uo~}%Kc_FJ50sv~ zIbM1(zW1fsp&bJ!j@+`u6!8;Bg#;(=Tx^Q+vio8FPW!nVg*dh|UV0f$Bk>dcbE{0K zPW8{lOE|u@N7Byukj#>QNM<3KjqlwvE1WQqe;|wU^lRFI$JvoF&k;H7l&+7?1>&VY z#*e;wOQGT-8OS81+&+$_6$cg?JWYiqJO4W(}X~lk)pweRQ{{9!@r4utb#1!A( zKTUWR_|(qnsVy&{$1|nB5HAJZ@5%h}V6zHhfzrFN z9kJ4fJLCI1SAl)q;6GScu$F%t6 z&lO*#x%1VV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x#%k3&#vU%6lC zb}jfkJ)Qki9(&%euTb`q3G(ttZ~Y}y z3$cbz440gzyYw{n>9wvwugAHE6o#_*=Ksg^gbRi4H){)%wa^oyRDV`2{Ijb6^gLlX p4xSG@FKK=9q)6I7c9jGoC9~T-g3krmL~WW8fjhKLIfir|kd$ literal 0 HcmV?d00001 diff --git a/tests/data/test-read-common/PR26261/PR26261-exe-ctf.abi b/tests/data/test-read-common/PR26261/PR26261-exe-ctf.abi new file mode 100644 index 00000000..0f534f32 --- /dev/null +++ b/tests/data/test-read-common/PR26261/PR26261-exe-ctf.abi @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/PR26261/PR26261-exe.abi b/tests/data/test-read-common/PR26261/PR26261-exe-dwarf.abi similarity index 53% rename from tests/data/test-read-dwarf/PR26261/PR26261-exe.abi rename to tests/data/test-read-common/PR26261/PR26261-exe-dwarf.abi index b3d2dfd7..a7840334 100644 --- a/tests/data/test-read-dwarf/PR26261/PR26261-exe.abi +++ b/tests/data/test-read-common/PR26261/PR26261-exe-dwarf.abi @@ -1,12 +1,10 @@ - + - - @@ -16,18 +14,18 @@ - + - - - - + + + + - - - + + + @@ -36,44 +34,44 @@ - + - - - + + + - + - + - + - - + + - + - - + + - + - + - - + + diff --git a/tests/data/test-read-common/PR26261/PR26261-exe.abi b/tests/data/test-read-common/PR26261/PR26261-exe.abi new file mode 100644 index 00000000..9a146364 --- /dev/null +++ b/tests/data/test-read-common/PR26261/PR26261-exe.abi @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-common/PR26261/PR26261-exe_ctf.abi b/tests/data/test-read-common/PR26261/PR26261-exe_ctf.abi new file mode 100644 index 00000000..0f534f32 --- /dev/null +++ b/tests/data/test-read-common/PR26261/PR26261-exe_ctf.abi @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/PR26261/PR26261-main.c b/tests/data/test-read-common/PR26261/PR26261-main.c similarity index 100% rename from tests/data/test-read-dwarf/PR26261/PR26261-main.c rename to tests/data/test-read-common/PR26261/PR26261-main.c diff --git a/tests/data/test-read-dwarf/PR26261/PR26261-obja.c b/tests/data/test-read-common/PR26261/PR26261-obja.c similarity index 100% rename from tests/data/test-read-dwarf/PR26261/PR26261-obja.c rename to tests/data/test-read-common/PR26261/PR26261-obja.c diff --git a/tests/data/test-read-dwarf/PR26261/PR26261-obja.h b/tests/data/test-read-common/PR26261/PR26261-obja.h similarity index 100% rename from tests/data/test-read-dwarf/PR26261/PR26261-obja.h rename to tests/data/test-read-common/PR26261/PR26261-obja.h diff --git a/tests/data/test-read-dwarf/PR26261/PR26261-objb.c b/tests/data/test-read-common/PR26261/PR26261-objb.c similarity index 100% rename from tests/data/test-read-dwarf/PR26261/PR26261-objb.c rename to tests/data/test-read-common/PR26261/PR26261-objb.c diff --git a/tests/data/test-read-dwarf/PR26261/PR26261-objb.h b/tests/data/test-read-common/PR26261/PR26261-objb.h similarity index 100% rename from tests/data/test-read-dwarf/PR26261/PR26261-objb.h rename to tests/data/test-read-common/PR26261/PR26261-objb.h diff --git a/tests/data/test-read-dwarf/PR27700/include-dir/priv.h b/tests/data/test-read-common/PR27700/include-dir/priv.h similarity index 100% rename from tests/data/test-read-dwarf/PR27700/include-dir/priv.h rename to tests/data/test-read-common/PR27700/include-dir/priv.h diff --git a/tests/data/test-read-dwarf/PR27700/include-dir/pub.h b/tests/data/test-read-common/PR27700/include-dir/pub.h similarity index 100% rename from tests/data/test-read-dwarf/PR27700/include-dir/pub.h rename to tests/data/test-read-common/PR27700/include-dir/pub.h diff --git a/tests/data/test-read-dwarf/PR27700/pub-incdir/inc.h b/tests/data/test-read-common/PR27700/pub-incdir/inc.h similarity index 100% rename from tests/data/test-read-dwarf/PR27700/pub-incdir/inc.h rename to tests/data/test-read-common/PR27700/pub-incdir/inc.h diff --git a/tests/data/test-read-common/PR27700/test-PR27700-ctf.abi b/tests/data/test-read-common/PR27700/test-PR27700-ctf.abi new file mode 100644 index 00000000..2210a10f --- /dev/null +++ b/tests/data/test-read-common/PR27700/test-PR27700-ctf.abi @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/PR27700/test-PR27700.abi b/tests/data/test-read-common/PR27700/test-PR27700-dwarf.abi similarity index 60% rename from tests/data/test-read-dwarf/PR27700/test-PR27700.abi rename to tests/data/test-read-common/PR27700/test-PR27700-dwarf.abi index 4f861fb8..51367d7b 100644 --- a/tests/data/test-read-dwarf/PR27700/test-PR27700.abi +++ b/tests/data/test-read-common/PR27700/test-PR27700-dwarf.abi @@ -1,15 +1,15 @@ - + - + - - + + diff --git a/tests/data/test-read-dwarf/PR27700/test-PR27700.c b/tests/data/test-read-common/PR27700/test-PR27700.c similarity index 55% rename from tests/data/test-read-dwarf/PR27700/test-PR27700.c rename to tests/data/test-read-common/PR27700/test-PR27700.c index b44a3226..a16a0bb7 100644 --- a/tests/data/test-read-dwarf/PR27700/test-PR27700.c +++ b/tests/data/test-read-common/PR27700/test-PR27700.c @@ -1,5 +1,7 @@ #include "include-dir/priv.h" +/* gcc -I. -gctf -gdwarf -c -o test-PR27700.o test-PR27700.c */ + void foo(enum foo* c __attribute__((unused))) { diff --git a/tests/data/test-read-common/test-PR26568-1-ctf.o.abi b/tests/data/test-read-common/test-PR26568-1-ctf.o.abi new file mode 100644 index 00000000..f74e9b6d --- /dev/null +++ b/tests/data/test-read-common/test-PR26568-1-ctf.o.abi @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test-PR26568-1.o.abi b/tests/data/test-read-common/test-PR26568-1-dwarf.o.abi similarity index 54% rename from tests/data/test-read-dwarf/test-PR26568-1.o.abi rename to tests/data/test-read-common/test-PR26568-1-dwarf.o.abi index 3663eb4a..54c499bb 100644 --- a/tests/data/test-read-dwarf/test-PR26568-1.o.abi +++ b/tests/data/test-read-common/test-PR26568-1-dwarf.o.abi @@ -1,16 +1,16 @@ - + - + - + - + @@ -18,19 +18,19 @@ - + - + - + - + - - + + diff --git a/tests/data/test-read-dwarf/test-PR26568-1.c b/tests/data/test-read-common/test-PR26568-1.c similarity index 100% rename from tests/data/test-read-dwarf/test-PR26568-1.c rename to tests/data/test-read-common/test-PR26568-1.c diff --git a/tests/data/test-read-common/test-PR26568-2-ctf.o.abi b/tests/data/test-read-common/test-PR26568-2-ctf.o.abi new file mode 100644 index 00000000..d39d20c2 --- /dev/null +++ b/tests/data/test-read-common/test-PR26568-2-ctf.o.abi @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test-PR26568-2.o.abi b/tests/data/test-read-common/test-PR26568-2-dwarf.o.abi similarity index 59% rename from tests/data/test-read-dwarf/test-PR26568-2.o.abi rename to tests/data/test-read-common/test-PR26568-2-dwarf.o.abi index 9129da2c..413435ae 100644 --- a/tests/data/test-read-dwarf/test-PR26568-2.o.abi +++ b/tests/data/test-read-common/test-PR26568-2-dwarf.o.abi @@ -1,11 +1,11 @@ - + - + - + @@ -13,19 +13,19 @@ - + - + - + - + - - + + diff --git a/tests/data/test-read-dwarf/test-PR26568-2.c b/tests/data/test-read-common/test-PR26568-2.c similarity index 68% rename from tests/data/test-read-dwarf/test-PR26568-2.c rename to tests/data/test-read-common/test-PR26568-2.c index 656e8eea..dc3804f3 100644 --- a/tests/data/test-read-dwarf/test-PR26568-2.c +++ b/tests/data/test-read-common/test-PR26568-2.c @@ -1,3 +1,5 @@ +/* gcc -gctf -gdwarf -c -o test-PR26568-2.o test-PR26568-2.c */ + union A { struct { int x; diff --git a/tests/data/test-read-common/test3-alias-1-dwarf.so.hash.abi b/tests/data/test-read-common/test3-alias-1-dwarf.so.hash.abi new file mode 100644 index 00000000..b18c75b8 --- /dev/null +++ b/tests/data/test-read-common/test3-alias-1-dwarf.so.hash.abi @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test3-alias-1.suppr b/tests/data/test-read-common/test3-alias-1.suppr similarity index 100% rename from tests/data/test-read-dwarf/test3-alias-1.suppr rename to tests/data/test-read-common/test3-alias-1.suppr diff --git a/tests/data/test-read-common/test3-alias-2-dwarf.so.hash.abi b/tests/data/test-read-common/test3-alias-2-dwarf.so.hash.abi new file mode 100644 index 00000000..eacc7040 --- /dev/null +++ b/tests/data/test-read-common/test3-alias-2-dwarf.so.hash.abi @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test3-alias-2.suppr b/tests/data/test-read-common/test3-alias-2.suppr similarity index 100% rename from tests/data/test-read-dwarf/test3-alias-2.suppr rename to tests/data/test-read-common/test3-alias-2.suppr diff --git a/tests/data/test-read-common/test3-alias-3-dwarf.so.hash.abi b/tests/data/test-read-common/test3-alias-3-dwarf.so.hash.abi new file mode 100644 index 00000000..0c4fbb84 --- /dev/null +++ b/tests/data/test-read-common/test3-alias-3-dwarf.so.hash.abi @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test3-alias-3.suppr b/tests/data/test-read-common/test3-alias-3.suppr similarity index 100% rename from tests/data/test-read-dwarf/test3-alias-3.suppr rename to tests/data/test-read-common/test3-alias-3.suppr diff --git a/tests/data/test-read-common/test3-alias-4-dwarf.so.hash.abi b/tests/data/test-read-common/test3-alias-4-dwarf.so.hash.abi new file mode 100644 index 00000000..a3ac2abd --- /dev/null +++ b/tests/data/test-read-common/test3-alias-4-dwarf.so.hash.abi @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test3-alias-4.suppr b/tests/data/test-read-common/test3-alias-4.suppr similarity index 100% rename from tests/data/test-read-dwarf/test3-alias-4.suppr rename to tests/data/test-read-common/test3-alias-4.suppr diff --git a/tests/data/test-read-common/test3-ctf.so.abi b/tests/data/test-read-common/test3-ctf.so.abi new file mode 100644 index 00000000..0153f4f2 --- /dev/null +++ b/tests/data/test-read-common/test3-ctf.so.abi @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/data/test-read-common/test3-ctf.so.hash.abi b/tests/data/test-read-common/test3-ctf.so.hash.abi new file mode 100644 index 00000000..0153f4f2 --- /dev/null +++ b/tests/data/test-read-common/test3-ctf.so.hash.abi @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test3.so.abi b/tests/data/test-read-common/test3-dwarf.so.abi similarity index 50% rename from tests/data/test-read-dwarf/test3.so.abi rename to tests/data/test-read-common/test3-dwarf.so.abi index bb691101..97f8b6cf 100644 --- a/tests/data/test-read-dwarf/test3.so.abi +++ b/tests/data/test-read-common/test3-dwarf.so.abi @@ -1,17 +1,15 @@ - + - - - - + + diff --git a/tests/data/test-read-dwarf/test3.so.hash.abi b/tests/data/test-read-common/test3-dwarf.so.hash.abi similarity index 50% rename from tests/data/test-read-dwarf/test3.so.hash.abi rename to tests/data/test-read-common/test3-dwarf.so.hash.abi index 52207884..d332c803 100644 --- a/tests/data/test-read-dwarf/test3.so.hash.abi +++ b/tests/data/test-read-common/test3-dwarf.so.hash.abi @@ -1,17 +1,15 @@ - + - - - - + + diff --git a/tests/data/test-read-dwarf/test3.c b/tests/data/test-read-common/test3.c similarity index 71% rename from tests/data/test-read-dwarf/test3.c rename to tests/data/test-read-common/test3.c index 2808db4b..f7860ee8 100644 --- a/tests/data/test-read-dwarf/test3.c +++ b/tests/data/test-read-common/test3.c @@ -1,4 +1,5 @@ // Test file for creating multiple alias for a symbol +// gcc -shared -gctf -g -mtune=generic -march=x86-64 -fPIC -Wl,-soname=test3.so.1 -o test3.so test3.c void __foo(void); void foo(void) __attribute__((weak, alias("__foo"))); diff --git a/tests/data/test-read-common/test3.so b/tests/data/test-read-common/test3.so new file mode 100755 index 0000000000000000000000000000000000000000..beddf426c93d3f3b77afd1ec3235581d7cea7e03 GIT binary patch literal 16424 zcmeHOUu+yl8J|7di4!+IJ0ajCP;V-yI90r7J5Ay?YIC+@`%>9yYiuC|(Q5B*eLlFm zwf5GD9f62QsIa0yUU=b;)CUR?eP|I<)u$@0ArVp^TqHz5LRhFp7OjNK-%wDG-?ua0 zdA+?$B9QX5W6gf^{rP<}^X=^HoOkA{BjcknO%t3N#FJu!6C$Y;Ysc7vWCNlZ*Zo5G zZ5uaKA1Pf^N~WSsnou20R8)MJ7F8pdvYy1gOP#<-x__`9I=G!Rk&V-WBRgcC(~x>Mm+P5m%URvyObSM-xjiGfus8FHF5YRRekmPx2oF7 zRI#D~6>USNdqHJx2Z~}VGWUn#z!+*D*%F3i#CJ`K*ac9M5l`5q@;6#?&z0ki%RgTH z(fYfs5Y&S&^ z=88_qEPIygnWivLO--0t+qHA~vS+(f6T=0kWKUV?f-QBmHD+ePGH3E7tB^krLvzM) zn;D36o*y?Na3m{@>} z5!}m z6oDuLQ3Rq0L=lK05Je!0Koo%}0{?piQWxKAPF-<|$V|*ROlA%1Y|u&zhI34l76g z09EC{+qlL%lPJA`(#+NA)Y3b^wxzB#{f4khBezqRk%?YuxC`U;BvL-42PUmV+y)*KaqZmflFc{-+Zu zZ6);<)vP=pMxDDQcn#KT(5#`(HR0{`>%2S-(GAp~`$jh_zx1pAYy80vsQUOTOBC<0Lgq6kD0xGxdV_B9-*Z_xA&PG7H7lAyhy zv!G|*uT(C8Qu>%ALOVYxw1qZp-ve8lui`@=VLyp{>(7;n|BbP=ZM3!Hsd&q|<_qG) z-s6uP?(#p!68JLKvCXsx|gIO8ZeM%_;qM$%;#gwkX=6 zsDf2DzVkj|-Wbj8xTfrB?=&UGk=tAA)_JFI-dU%%07^y>Y+{e6ANdbhnWXS?~LUGl8LK|wpRWsqfz!aJ?Q zHH<*eBsAYx+Xd!RWbrU^Eo98!Y`$$vSf_nYXzkj8)?F4bY z*2i0pw>;MJ={+P)cATfNH;&wd(S&dILesQ=x9%W9cLy1T&KR{|3^|5!Tz2R|Qa5R0 zTa2r3*rtug8UQ%!lJ8e? zo==pypyMT)*e&#=lu&(?hLJT)COjYbLR`LxO#XR(V)Tn6>QJW8ojkG z=+H&pv|QI(G%=yMi(GS1`jr?icPhTP5yo((~tEVU!n(o|OjmTuEoSlq<~}vsQUl7}>=V%p~<(VUXsm z?UwUSX%k~Y=h_8}0K)KNZp;-tBjIVE96Tym(g)9 zk{BnFTzMbnAQKI-tb7j-l~DiN*&dTIc-(YaNF1dX4F$zLoqAK}E(Z zu{eMNt<@OM>p7;klp)neIxrjzY>dQQ6L@TtAQmU(ltr^K2kB%@bed33)`d(1)2P~R4 zCFQm%`zcC6ysmIeL$8^zdtrs}y$ZmT+shR)&y?Qx!TNcDKoc>KFaG_+=RL#r z%rpHCu<-z%*HhgFgh*^BxecD>KZJtD4%g4?7Cslt=U=(sjN@@(155p9Jf9a_O+bjG z``3*N#+`nXS*<-d0MZL4YyxUN{wCzPjv;; zG8mF6^QwyRk5nbHz<8!_Ld@l$seV*)F9d}(Y~QLOBgj*#LE(0V>sqaYKd*qN$XOtT z@$W$wmXZ0g!qfa5Okvv(pbX2%eqG_834&|bZULC^%Difw?2|SAdf8ieS z&xoJImZoE$`C8s>)?N`#?Sr`AjFFQ E0)zhFKmY&$ literal 0 HcmV?d00001 diff --git a/tests/data/test-read-common/test4-ctf.so.abi b/tests/data/test-read-common/test4-ctf.so.abi new file mode 100644 index 00000000..59d222dc --- /dev/null +++ b/tests/data/test-read-common/test4-ctf.so.abi @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/data/test-read-common/test4-ctf.so.hash.abi b/tests/data/test-read-common/test4-ctf.so.hash.abi new file mode 100644 index 00000000..de249080 --- /dev/null +++ b/tests/data/test-read-common/test4-ctf.so.hash.abi @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/test4.so.abi b/tests/data/test-read-common/test4-dwarf.so.abi similarity index 51% rename from tests/data/test-read-dwarf/test4.so.abi rename to tests/data/test-read-common/test4-dwarf.so.abi index 451e90b6..5c8383f6 100644 --- a/tests/data/test-read-dwarf/test4.so.abi +++ b/tests/data/test-read-common/test4-dwarf.so.abi @@ -1,11 +1,11 @@ - + - + @@ -13,10 +13,10 @@ - - - - + + + + diff --git a/tests/data/test-read-dwarf/test4.so.hash.abi b/tests/data/test-read-common/test4-dwarf.so.hash.abi similarity index 51% rename from tests/data/test-read-dwarf/test4.so.hash.abi rename to tests/data/test-read-common/test4-dwarf.so.hash.abi index 52652bf7..9fffaeb0 100644 --- a/tests/data/test-read-dwarf/test4.so.hash.abi +++ b/tests/data/test-read-common/test4-dwarf.so.hash.abi @@ -1,11 +1,11 @@ - + - + @@ -13,10 +13,10 @@ - - - - + + + + diff --git a/tests/data/test-read-common/test4.c b/tests/data/test-read-common/test4.c new file mode 100644 index 00000000..5fa5348b --- /dev/null +++ b/tests/data/test-read-common/test4.c @@ -0,0 +1,11 @@ +// gcc -shared -gctf -g -mtune=generic -march=x86-64 -fPIC -Wl,-soname=test4.so.1 -o test4.so test4.c + +char * +cpy (char * restrict s1, const char * restrict s2, unsigned int n) +{ + char *t1 = s1; + const char *t2 = s2; + while(n-- > 0) + *t1++ = *t2++; + return s1; +} diff --git a/tests/data/test-read-common/test4.so b/tests/data/test-read-common/test4.so new file mode 100755 index 0000000000000000000000000000000000000000..2d665a8e1b0407e398ef824f61c8ac6ce8ec29ff GIT binary patch literal 16672 zcmeHOeQX>@6`wtO?Mp84*$GMWL6dcql%%Tn&TitQ4NcB*?3`OWO@l49K(y@L?R~)A zp4r<=Y>SGD0E%U$b%l_s0)js()C#E-kfPE*P}-nGNc@o^0RP?HO3Osv2cJQ&~|`@;oi+O z9^1O?x=A`9oy1wE2*Em36s7LxKbDOk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V(5uTlA%1aR7gW*Wfx0?roaTx^i-w7 zbe!B_OoQNN!C|GUIl!5A4n8hYE!f#I$!03$Sf@!V7Ho@TcyJQY42QfN*)jh!+YTjQ zuh&Nh36kTg2Z@Fhjy5D3HMqY02dwc3M(b4KJ9+fYcxh(4K)^LB;b|R9d|n1(eR6bj z3#~_cK*P2Xp4P?0XL$7T%`@`35znvT8kX?1ZY7TIM#W^67=b8G zXv;d;zY7i=J5)cdXXrdIo%^NdCLHy@1z3E3!qd6Tg%}utG=5*c5uW(>!R5uXgp7>~ zPUBo!>(4{@SHa=MZ%Rm<#8aFfPdcvSFoxQ%C4@(7g2%eNbO{u+$?&?1@b}g&LLfZx zpM#lXZ|KYYLR;-~`c(F26a2%nLH>66@e57xGZJ_~G^2j^ + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-ambiguous-struct-A.c b/tests/data/test-read-ctf/test-ambiguous-struct-A.c new file mode 100644 index 00000000..67047c44 --- /dev/null +++ b/tests/data/test-read-ctf/test-ambiguous-struct-A.c @@ -0,0 +1,8 @@ +struct A; +struct B { struct A *a; }; +struct A { struct B b; long foo; long bar; struct B b2; }; + +typedef struct A a_array[50]; +a_array *foo __attribute__((__used__)); + +static struct A a __attribute ((__used__)); diff --git a/tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi b/tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi new file mode 100644 index 00000000..f0da1381 --- /dev/null +++ b/tests/data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-ambiguous-struct-B.c b/tests/data/test-read-ctf/test-ambiguous-struct-B.c new file mode 100644 index 00000000..95a93469 --- /dev/null +++ b/tests/data/test-read-ctf/test-ambiguous-struct-B.c @@ -0,0 +1,5 @@ +struct A; +struct B { struct A *a; }; +struct A { struct B b; int foo; struct B b2; }; + +static struct A a __attribute__((__used__)); diff --git a/tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi b/tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi new file mode 100644 index 00000000..da969de3 --- /dev/null +++ b/tests/data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-conflicting-type-syms-a.c b/tests/data/test-read-ctf/test-conflicting-type-syms-a.c new file mode 100644 index 00000000..65414877 --- /dev/null +++ b/tests/data/test-read-ctf/test-conflicting-type-syms-a.c @@ -0,0 +1,5 @@ +typedef long a_t; +typedef long b_t; + +a_t *a; +b_t ignore2; diff --git a/tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi b/tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi new file mode 100644 index 00000000..cbe6b8cc --- /dev/null +++ b/tests/data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-conflicting-type-syms-b.c b/tests/data/test-read-ctf/test-conflicting-type-syms-b.c new file mode 100644 index 00000000..e458021e --- /dev/null +++ b/tests/data/test-read-ctf/test-conflicting-type-syms-b.c @@ -0,0 +1,5 @@ +typedef long a_t; +typedef long b_t; + +a_t b; +b_t ignore1; diff --git a/tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi b/tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi new file mode 100644 index 00000000..65921b6e --- /dev/null +++ b/tests/data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-enum-ctf.c b/tests/data/test-read-ctf/test-enum-ctf.c new file mode 100644 index 00000000..aa60d727 --- /dev/null +++ b/tests/data/test-read-ctf/test-enum-ctf.c @@ -0,0 +1,8 @@ +/* Looked up item by item. */ +enum e { ENUMSAMPLE_1 = 0, ENUMSAMPLE_2 = 1 }; + +/* Looked up via both sorts of iterator in turn. */ +enum ie { IENUMSAMPLE_1 = -10, IENUMSAMPLE_2, IENUMSAMPLE_3 }; + +enum e foo; +enum ie bar; diff --git a/tests/data/test-read-ctf/test-enum-ctf.o.abi b/tests/data/test-read-ctf/test-enum-ctf.o.abi new file mode 100644 index 00000000..e9104d87 --- /dev/null +++ b/tests/data/test-read-ctf/test-enum-ctf.o.abi @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-enum-many-ctf.c b/tests/data/test-read-ctf/test-enum-many-ctf.c new file mode 100644 index 00000000..f2297d72 --- /dev/null +++ b/tests/data/test-read-ctf/test-enum-many-ctf.c @@ -0,0 +1,10 @@ +/* Looked up item by item. */ +enum e { ENUMSAMPLE_1 = 0, ENUMSAMPLE_2 = 1 }; + +/* Looked up via both sorts of iterator in turn. */ +enum ie { IE_0 = -10, IE_1, IE_2, IE_3, IE_4, IE_5, IE_6, IE_7, IE_8, IE_9, IE_A, IE_B, IE_C, IE_D, IE_E, IE_F, + IE_10, IE_11, IE_12, IE_13, IE_14, IE_15, IE_16, IE_17, IE_18, IE_19, IE_1A, IE_1B, IE_1C, IE_1D, IE_1E, IE_1F, + IE_20, IE_21, IE_22, IE_23, IE_24, IE_25, IE_26, IE_27, IE_28, IE_29, IE_2A, IE_2B, IE_2C, IE_2D, IE_2E, IE_2F}; + +enum e foo; +enum ie bar; diff --git a/tests/data/test-read-ctf/test-enum-many-ctf.o.hash.abi b/tests/data/test-read-ctf/test-enum-many-ctf.o.hash.abi new file mode 100644 index 00000000..d69f290b --- /dev/null +++ b/tests/data/test-read-ctf/test-enum-many-ctf.o.hash.abi @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-enum-symbol-ctf.c b/tests/data/test-read-ctf/test-enum-symbol-ctf.c new file mode 100644 index 00000000..f7f99c67 --- /dev/null +++ b/tests/data/test-read-ctf/test-enum-symbol-ctf.c @@ -0,0 +1 @@ +enum {red1, green1, blue1} primary1; diff --git a/tests/data/test-read-ctf/test-enum-symbol-ctf.o.hash.abi b/tests/data/test-read-ctf/test-enum-symbol-ctf.o.hash.abi new file mode 100644 index 00000000..9bcf2d20 --- /dev/null +++ b/tests/data/test-read-ctf/test-enum-symbol-ctf.o.hash.abi @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test-struct-iteration-ctf.c b/tests/data/test-read-ctf/test-struct-iteration-ctf.c new file mode 100644 index 00000000..7df67ada --- /dev/null +++ b/tests/data/test-read-ctf/test-struct-iteration-ctf.c @@ -0,0 +1,28 @@ +#include + +struct foo_t +{ + int foo; + size_t bar; + const char *baz; + struct foo_t *self; + union + { + double should_not_appear; + char *nor_should_this; + } named; + struct + { + long unnamed_sub_member; + union + { + double one_more_level; + long yes_really_one_more; + }; + }; + struct {}; /* Empty ones */ + union {}; + int after_the_end; +}; + +struct foo_t used; diff --git a/tests/data/test-read-ctf/test-struct-iteration-ctf.o.abi b/tests/data/test-read-ctf/test-struct-iteration-ctf.o.abi new file mode 100644 index 00000000..cfc0b785 --- /dev/null +++ b/tests/data/test-read-ctf/test-struct-iteration-ctf.o.abi @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test0 b/tests/data/test-read-ctf/test0 new file mode 100644 index 0000000000000000000000000000000000000000..b30b8133cccb2663283de474de1e26493ad897d8 GIT binary patch literal 2600 zcmbtWzi%8x6n<-)O9=5{ClC;!*dQbvf%ooQAczn;V$Pvm-L17d zj(kW6Xpo{5&>&G#rlbR;6p>Q!7tqi^Lq!8r>EQcj-uTw5Lqg(7-_CpA`!zfF=I%Z@ zf9b+Z5QvvR-js>uS&@5}SJ&_Swtna1N9%XbKe{V7AJYDw{+kbNoxgsW zo3Y_|{OT2~&jT+4U0@yf6ky~FXnq{}5#R*y1n?Bl1m=OKfm6V3;4|PpkO4me-vVC& zKLJ0h%{<1kCSzHXF|5Tr)@LqzupayB`!|k4?*bfv)s7N>UKiKa z&V@@C-@SS^?5srXs2#4fS2`UaTuS$M(;^$DBNGqKx&)mGc?>3!@L2~B$ax9W<{VIX zFDSuBmnGO=2u>eAa`a0$d4CCtouAd_!sjz<^NqI=0FJ&l=!Ec&iT7V{ep1tfedpxQ zzo+?T?X({DaK;wJUyI2s@;icjsNqYxp0T`}a8h1tS$@`j7m@d8a!&b6Bq5$(g}!J{ z(b5Mz)@E*rn4dsH2>uaN7eWD>suAB8v1)}-`?l*ynPu8f1B(3|3mZZ`{G$w( zSbInRe*8_HmfzO>8(U@asOSF!-{%E7 literal 0 HcmV?d00001 diff --git a/tests/data/test-read-ctf/test0.abi b/tests/data/test-read-ctf/test0.abi new file mode 100644 index 00000000..b5ee8d78 --- /dev/null +++ b/tests/data/test-read-ctf/test0.abi @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test0.c b/tests/data/test-read-ctf/test0.c new file mode 100644 index 00000000..eb702312 --- /dev/null +++ b/tests/data/test-read-ctf/test0.c @@ -0,0 +1,32 @@ + +#include + +char* test_pointer = NULL; +int test_array[10] = {0}; +volatile short test_volatile = 1; +float test_float = 0.0; + +struct { + unsigned int status0 : 1; + unsigned int status1 : 1; +} status; + + +struct S +{ + int m0; +}; + +const struct S test_const; +long* restrict test_restrict; + +int +foo_1(struct S* s) +{ + return s->m0; +} + +int main() +{ + +} diff --git a/tests/data/test-read-ctf/test0.hash.abi b/tests/data/test-read-ctf/test0.hash.abi new file mode 100644 index 00000000..26706b60 --- /dev/null +++ b/tests/data/test-read-ctf/test0.hash.abi @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test1.c b/tests/data/test-read-ctf/test1.c new file mode 100644 index 00000000..3a5bac49 --- /dev/null +++ b/tests/data/test-read-ctf/test1.c @@ -0,0 +1,25 @@ +enum opaque_enum; +struct opaque_struct; + +typedef enum opaque_enum opaque_enum; +typedef struct opaque_struct opaque_struct; + +void +fn(opaque_struct *, opaque_enum *e); + +enum opaque_enum +{ + e0, + e1 +}; + +struct opaque_struct +{ + opaque_enum m0; +}; + +void +fn(opaque_struct * s, opaque_enum *e) +{ + s->m0 = *e; +} diff --git a/tests/data/test-read-ctf/test1.so b/tests/data/test-read-ctf/test1.so new file mode 100755 index 0000000000000000000000000000000000000000..df5ef8d38fa53081007cab96424e3d60b512751f GIT binary patch literal 15592 zcmeHOZEPGz8J@euiD?_#r38Y5+HI9eNtEoJT~Y#-nsXdGmtU{|dmTJ7DfeTVMD z-0h`yMMY@we0FMPI-N=>!VdMY+N6}q8NtB^sUf`MY7qDRYE>vi~%VcI*C7LDnU%Su(eA^i~)|m_wct2NgTJ^1zFaO6tWL*#p@>C zhQYK;Lrv^*#x7^MJGW!3{l4Wg&}$*@iz2{(ZQT zFb~Fi)$Qv1osnce6+CaT)~I`}&~JvGr@S+BvtB7^28)$e7&PZ*C##KmFy|MlK_u%h z@ruj7w@|73)ygx0TBxgPrBHNR4fjEHdgjc@NpIX8caI@vO8=#Ck3i@rQDlF$M=S4< ztQU-&!X^0fz)fL&bZR3!0^ci!(2 z$k+21pIuksU7EbS_v>2v^X}U3QdfR_!?<` z8?=1;bJn}v9B>x641E60ZudE0f%ip7rJgybQp+Q${dephyn+vmV*4Rnul%9g)!#OU zMy7}MJu-az(}T~c6Qd6ue&B%qOe^-Ma9xKUzgdFRwx0z48Di>hwG%@lUrbN#+4Teh zh=K*10hT>jP@HFEBImEV>El=t?cnoX>Kd8^wHdDhU}tK2cP*`utUH1utv45&v4 zJB1_IXK-&1Y%XH#HvBIc0qb$i@Ue+k1MTreSl6d)^zk8B)65fo=4$#0BmcXhdvT4w z{}$pt_GCQnCq6wn`7!6<>9g~PoUw5?>t>zt?D*IiF6Usdyc9GmwV)pQ)k8@K30m5} zQ@zRaH}WgWqr8{k_}h zXSd-$0{(q{{HtO!Y=!NG1-Ga+x9xjj%`3{r{g(2)Qo~!UHVS^#D}{|_%k$gIs@SM4 zRf8}nx!L|2vYEf)`OT)k;$a{+SJXn&uLWMIU8}9YBu07A47aF;K`R_Xg*} zKRz|*%}tz~nSw(J{EjCUa1f#2`G$9Kh9MU}w(!Sa?Ud(E1NvbL$cs0AeFO9|E_ngY z;7X(4L@p1UfE>^eA0h)Bma6qS*!;or&15qg+`^Ml-pXV zg?<4zY(}`u(qg^smi<;)xuuml)FK=o(e}1h}M6gCE9#It}Lb-)jOSyP*co*}+w6d6C+{!c(IZQ^s-n-|Rd@Bw2_B(dV~eGqYb$Jh}krkSLBF6JZPzq*{V3ZqIp|nCn2gNVY#(S8V2AIY!gq12i-^Y5#ff zB|iJ_pc5$)e0$z?# I@1C^(7v)NDpa1{> literal 0 HcmV?d00001 diff --git a/tests/data/test-read-ctf/test1.so.abi b/tests/data/test-read-ctf/test1.so.abi new file mode 100644 index 00000000..dfcbfe3f --- /dev/null +++ b/tests/data/test-read-ctf/test1.so.abi @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test1.so.hash.abi b/tests/data/test-read-ctf/test1.so.hash.abi new file mode 100644 index 00000000..c9346476 --- /dev/null +++ b/tests/data/test-read-ctf/test1.so.hash.abi @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test2.c b/tests/data/test-read-ctf/test2.c new file mode 100644 index 00000000..b04490a8 --- /dev/null +++ b/tests/data/test-read-ctf/test2.c @@ -0,0 +1,19 @@ +struct S0 +{ + void* m0; +}; + +typedef const void* POINTER; + +struct S1 +{ + POINTER m0; +}; + +void foo(struct S0* a __attribute__((unused))) +{ +} + +void bar(struct S1* a __attribute__((unused))) +{ +} diff --git a/tests/data/test-read-ctf/test2.so b/tests/data/test-read-ctf/test2.so new file mode 100755 index 0000000000000000000000000000000000000000..d9c07517527553d99951c2129da2f2ae6c1bce03 GIT binary patch literal 15616 zcmeHOZD<_F8J;^^u@WaIxrtL(F3H9uV4HaFq{OLPLwu5a@;Q-YN0y->HJiP=mF~iw zR_v}^Db%#oZLu(J{ilEW0r^!7{SiVS7z)LSi`_yBO8@i&N+g9X z%0IjkW#gst+23_vZ8tRD|0q&j>lE8tzR>koj$JIRme140 z^g`D)R(-v+8r@5EFDUy8*;mNEQa*cTMMSqs@xu0>OY5KGr8hGd|8P}TYf&BF|4g;p zeO7UnJxk^1S2vXxUnoESk3;3mQu!s$tZTlHa&A|_%jCUGmSxJhETTS{^ZZFtU84+^ zbh;k@Nv3|U=Z=p!ea~}UTgcG!+!X?3ZVy$qM1T7;I6cI_#{A;-<@Y~{Vk`Maz-im--bgV?XOoE#q&&J}qNkEB{T&1@`t{Q@u&`gHK|g z?FB8%J>{&>n^k$AE0=F-`%Ov|p{Cd$yhF?FJ+4Ki;JwjYE@=bWaY?BKZPJwm@$^Ml zw&$Gorw_qW22S+ntCS;c|4_^Ayt=;s6~R9CbUy4CJ~BM~4Quz2@soS3{sFsS7p#H8 zKz~17)^2Zp)(aXfZzgh^d(su8WbXfF@lKpl%lVR}{n`hx@mV|Mh_e1CDg9kqkNJoC zzD7(&Y!_BhX@K{z)b|R^CuJ4l31YZ@%xCCNOaGqserxD|N=&ErZ`7|}%6f9*_ZDhc zqn+ycHJP)72A&gmKSNB0{?`TL0sU{Kew#>--*xFgPn`u%MgK;G>j6Hnz9IFu3Q>ec z(T|B_`Ke3cpQR34>s_UE2kATQyWh2ef4}xm@5kT2f&Vem@9L0ORD&pt=BB3Xs#x2$ z??f%9${Y7X+TUOEo$01uahpyp@`KQE=jKJ#Z_PHn$gA0f&K|s(zu~w+;4U~c!Gi@c z6}TMIO-f5897m!bS4LfMoUy7C;r?M3w#J6b-;no zCdfk$U*I4^F?np^-Iq7>Ln#Xl#=639#pHFFWIl<(Z%2N^K1>(I^s&z)baCM~-lXK@ z!4c+AZ7!?yd>=^gIez=|6HR3=zv;*6O4o}wKACcOdy~)YTo30@lpGSmj$a3nulp@8 zUs{HobfpRP%J6!>u%?-9|IdLmcL7ZsbaKU*Ng5ebs16N<8+*j~yMKEKP_L z1#zNZv3;;hYPL9tq_d@MeE?EXXfm>8`gzgTbLm?MWaC2Y&q=(VZ)zUCpcsa zyr#ypO^5*F-=bY`;^@Oe0CB)3d|xd}5-h1epIGdnbkQNVZ2AjHU%$Eq)&{f>;Oe`r)7S8;UTj13-6g5UIUr-*0cz<)>Go^2d>Yw?c&u~UR68Pny8n-no%_^&>hOD^>6djp2*wTav&1Ch zEgc7n>fjF<)J??~v;h?DMLc9sUI!%eV;ur|kd29w62&aplJWTc2F3aiRiyi`)*Ea1 z3rl-y%HL*^B_00*GID;5U%^t|pubRJ`;LA?@nd3mj$wSUF2^~-v_E9fpHXa2A|C6k z12!qCz)wkQGW5S91J51g$9e|mEuYeWqu+?b_KVpLE@OzmiHRV@i~X1e*gdg literal 0 HcmV?d00001 diff --git a/tests/data/test-read-ctf/test2.so.abi b/tests/data/test-read-ctf/test2.so.abi new file mode 100644 index 00000000..40e6aab5 --- /dev/null +++ b/tests/data/test-read-ctf/test2.so.abi @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-ctf/test2.so.hash.abi b/tests/data/test-read-ctf/test2.so.hash.abi new file mode 100644 index 00000000..4148da48 --- /dev/null +++ b/tests/data/test-read-ctf/test2.so.hash.abi @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/data/test-read-dwarf/PR26261/Makefile b/tests/data/test-read-dwarf/PR26261/Makefile deleted file mode 100644 index f66fa38a..00000000 --- a/tests/data/test-read-dwarf/PR26261/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -SRCS = PR26261-obja.c PR26261-objb.c PR26261-main.c -EXE = PR26261-exe -OBJS = $(SRCS:.c=.o) -CFLAGS = -Wall -g - -all: $(EXE) - -%.o: %.c - $(CC) $(CFLAGS) -c $< - -$(EXE): $(OBJS) - gcc -fPIC $(OBJS) -o $@ - -cleanobjs: - rm -rf $(OBJS) - -cleanexe: - rm $(EXE) - -clean: cleanobjs - rm -rf *~ diff --git a/tests/data/test-read-dwarf/PR26261/PR26261-exe b/tests/data/test-read-dwarf/PR26261/PR26261-exe deleted file mode 100755 index 564a4247643942bbfd91c0e75653dffe80ce5851..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10976 zcmeHNeQX@X6`$Sp$2pGAmk+=pK#q_IL*ujKd|*Id-w#hi*!Q;T0ZRFysgclE0Z|D%68-)_NpEL@pVm zN3ll2k_7CP2*WE>98m>Xk4VyMR(j1!kKu$0j3LjD=0;bKve%=VpolgJhz+uzfh0?9 z%LzA0xJgbWG|OPOq=aC|dY^%wQc)5g4I*lItMYfgyqr<!7FI))6es7iaCy3p##Sg_Q;oe6qqR|6LDEeTk5Ai`^tnZSe80Rk zb~~3hTjfxBBENXjo&ZmMaJ$vg z24Ia%g{|U=d-R>hj*tTi?Cj2GXlQz}amild9U+S4k4_now~D{9j=p`XrA=5bO%P7C@i|Zb4W++#-GlW}Aqw-hL-XWU5y;Nxs&imz?;WH0S!3%yR|f(2s!|9G zw?7jNBf8>=>4}}Ez5bkZf4R`=)jt3t(fXBg8Kj&K9?yvBvJ35^iMQrZfAt zpSAWSriw2XU!9(K-cuSoZ5Ho)!73KUk0&M(H#J>YToCnl}p z@sl}3W9?5&5Izcg-}Z@pnG+*p#dGoP zUBy4fd%E{8w?a{*cz+AQZQa+MSotUG=m!Svn3KQ#0Dc~P*S(5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H&O`3ZO0> z#Vq$P;jd6hJHJm;&X4{Ek}uDd>QQr3>=n^a`=Vg_e$!t@<C diff --git a/tests/data/test-read-dwarf/test3-alias-1.so.hash.abi b/tests/data/test-read-dwarf/test3-alias-1.so.hash.abi deleted file mode 100644 index 0e8b2815..00000000 --- a/tests/data/test-read-dwarf/test3-alias-1.so.hash.abi +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/tests/data/test-read-dwarf/test3-alias-2.so.hash.abi b/tests/data/test-read-dwarf/test3-alias-2.so.hash.abi deleted file mode 100644 index a18e47e2..00000000 --- a/tests/data/test-read-dwarf/test3-alias-2.so.hash.abi +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/tests/data/test-read-dwarf/test3-alias-3.so.hash.abi b/tests/data/test-read-dwarf/test3-alias-3.so.hash.abi deleted file mode 100644 index 8ae39bb1..00000000 --- a/tests/data/test-read-dwarf/test3-alias-3.so.hash.abi +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/tests/data/test-read-dwarf/test3-alias-4.so.hash.abi b/tests/data/test-read-dwarf/test3-alias-4.so.hash.abi deleted file mode 100644 index 4d3a5b01..00000000 --- a/tests/data/test-read-dwarf/test3-alias-4.so.hash.abi +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/tests/data/test-read-dwarf/test3.so b/tests/data/test-read-dwarf/test3.so deleted file mode 100755 index 4c426fc3c202d2f2dd027ffd8825ccfea36b2a09..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8851 zcmeHMeQX>@6`#Aa<8$qt9j6VB(~?z48YjZ*k0i!QWMb!H`x5N5xHbh*YqfW~XJ30C zW_K^PO8`p_At|z`5E4P+kAj3i2%#V$l=2~5j4C7$GKET^e??TKc8G-2isFi@=Dpc@ z=iRxz773|;c}}};<~Q$S_RZd#nSEax7#<9VLX1j;eVp;u4j1VY9nHImgRwr=!)oBJ zu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{r%N6px=&TH$1QL^-bZs9j1|N9VE5uFfu{b<{MJgzmU_ z+sBTukAgDS->%o>GnQ;C4uI>HD0f%r2>=YZf&{~O0tiLruF$txXjkY^YAjKI$+}Z@hxa1b*Zj>h_^Nip6=oksRiXdHcEX*10|E0PacW6HAC%fK zS!x*$!(k-^E>Pm{>jR}NJ#CrORv~4=$;nXKa!xUC_D-64)5@fvsavV3-r1h+w(jFf z+a$0*dM;kF+&)#vneFydMPSRckLmVPcDr3DS}9WlrG<8*U_6;=hx3=7%uMQ;Y&#yb z>~=ha@oJl8>PDL}qg!clW@D;7mvi(aP{(rV6xH$t$5bctMKxK>WR13r!FX#*x2KqD z%;iDSrHJlqeR?QqfiK=B*nQ;_`?1v;QCO9rK;%T(bWfzi==?q!Ld0_AxogTd?`jg&98K={-jLW+Mw?D$@G%fSfDS8XX_qdAP+uTCjT0M{u zEB70YB#b*nX?}74iFk*E_X}M9j_^3wzvUnLKczWdK987}L;W`-{omsJl`o7H@+iq`Mqj_2MEgVVfW4wZ%QNV-ppP%CT%k!U~t-!Afe))fq13c)tY`_)yp`iVh3ix*b zKM=tGE5L*Dt1M+Xwo`t8<@sD`pwF*fI1*)i@M$`D=ZSYZu;1tS>`EU%;pL;-XyP^4-U!{qcQTXKLPDa NGxzm*6T@y2`@a>G9{B(O diff --git a/tests/data/test-read-dwarf/test4.c b/tests/data/test-read-dwarf/test4.c deleted file mode 100644 index 7f0abaa1..00000000 --- a/tests/data/test-read-dwarf/test4.c +++ /dev/null @@ -1,14 +0,0 @@ -// Test file for restrict (needs to be compiled by a GCC that actually emits -// DW_TAG_restrict_type. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59051 -// -// gcc -gdwarf-3 -std=c99 -shared -nostartfiles -o test4.so test4.c - -char * -cpy (char * restrict s1, const char * restrict s2, unsigned int n) -{ - char *t1 = s1; - const char *t2 = s2; - while(n-- > 0) - *t1++ = *t2++; - return s1; -} diff --git a/tests/data/test-read-dwarf/test4.so b/tests/data/test-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dS|MR+tvr8a0zw$iFAOANO(MCBL zCQ_i?5f0A>Fj6^xER6sbq}~($;kfL_+|@Sze+d7dm?&h}|D87ecSWKpez1l8KSW~~ zBmN0-ftU&FQXdHaFM}ZJ?8h*TdG9es@)z+VO$%ch zu^xPQ|M2-af>^8f*E`UF?V>Llefa$iLkmU0*>W8SniZTepYLW|X`J6?{P2B@>>O?ih~$P$idV@(APyA}$qbnk=nNtL`bOaQgF^-c zTH!Q93GbhES#5HmwI)2=`VnY#kEJ@@>K=Q#4Ni5b6~FNd)GxkvW%BauH0YP|b5oOf ceQsvv)$BF>+T>I|t9#d7zU0!yHh9zh3+b%7 diff --git a/tests/test-annotate.cc b/tests/test-annotate.cc index d6504dd4..828746c9 100644 --- a/tests/test-annotate.cc +++ b/tests/test-annotate.cc @@ -40,12 +40,12 @@ InOutSpec in_out_specs[] = "output/test-annotate/test2.so.abi" }, { - "data/test-read-dwarf/test3.so", + "data/test-read-common/test3.so", "data/test-annotate/test3.so.abi", "output/test-annotate/test3.so.abi" }, { - "data/test-read-dwarf/test4.so", + "data/test-read-common/test4.so", "data/test-annotate/test4.so.abi", "output/test-annotate/test4.so.abi" }, diff --git a/tests/test-read-common.cc b/tests/test-read-common.cc new file mode 100644 index 00000000..431a660e --- /dev/null +++ b/tests/test-read-common.cc @@ -0,0 +1,184 @@ +// -*- Mode: C++ -*- +// + +#include +#include +#include "test-read-common.h" + +using std::ofstream; +using std::cerr; +using std::dynamic_pointer_cast; + +using abigail::tools_utils::emit_prefix; +using abigail::tests::get_build_dir; +using abigail::xml_writer::write_context_sptr; +using abigail::xml_writer::create_write_context; +using abigail::xml_writer::write_corpus; + +namespace abigail +{ +namespace tests +{ +namespace read_common +{ + +test_task::test_task(const InOutSpec &s, + string& a_out_abi_base, + string& a_in_elf_base, + string& a_in_abi_base) + : is_ok(true), + spec(s), + out_abi_base(a_out_abi_base), + in_elf_base(a_in_elf_base), + in_abi_base(a_in_abi_base) + {} + +bool +test_task::serialize_corpus(const string& out_abi_path, + corpus_sptr corp) +{ + ofstream of(out_abi_path.c_str(), std::ios_base::trunc); + if (!of.is_open()) + { + error_message = string("failed to read ") + out_abi_path + "\n"; + return false; + } + + write_context_sptr write_ctxt + = create_write_context(corp->get_environment(), of); + set_type_id_style(*write_ctxt, spec.type_id_style); + is_ok = write_corpus(*write_ctxt, corp, /*indent=*/0); + of.close(); + + return true; +} + +bool +test_task::run_abidw(const string& extargs) +{ + string abidw = string(get_build_dir()) + "/tools/abidw"; + string drop_private_types; + if (!in_public_headers_path.empty()) + drop_private_types += "--headers-dir " + in_public_headers_path + + " --drop-private-types"; + string cmd = abidw + " " + drop_private_types + " --abidiff " + extargs + + in_elf_path; + if (system(cmd.c_str())) + { + error_message = string("ABIs differ:\n") + + in_elf_path + + "\nand:\n" + + out_abi_path + + "\n"; + + return false; + } + + return true; +} + +bool +test_task::run_diff() +{ + set_in_abi_path(); + string cmd = "diff -u " + in_abi_path + " " + out_abi_path; + if (system(cmd.c_str())) + { + error_message = string("ABIs differ:\n") + + in_abi_path + + "\nand:\n" + + out_abi_path + + "\n"; + + return false; + } + + return true; +} + +void +display_usage(const string& prog_name, ostream& out) +{ + emit_prefix(prog_name, out) + << "usage: " << prog_name << " [options]\n" + << " where options can be: \n" + << " --help|-h display this message\n" + << " --no-parallel execute testsuite is a sigle thread\n" + ; +} + +bool +parse_command_line(int argc, char* argv[], options& opts) +{ + for (int i = 1; i < argc; ++i) + { + if (!strcmp(argv[i], "--no-parallel")) + opts.parallel = false; + else if (!strcmp(argv[i], "--help") + || !strcmp(argv[i], "--h")) + return false; + else + { + if (strlen(argv[i]) >= 2 && argv[i][0] == '-' && argv[i][1] == '-') + opts.wrong_option = argv[i]; + return false; + } + } + + return true; +} + +bool +run_tests(const size_t num_tests, const InOutSpec* specs, + const options& opts, create_new_test new_test) +{ + size_t num_workers = (opts.parallel + ? std::min(abigail::workers::get_number_of_threads(), + num_tests) + : 1); + abigail::workers::queue task_queue(num_workers); + bool is_ok = true; + + string out_abi_base = string(get_build_dir()) + "/tests/"; + string in_elf_base = string(abigail::tests::get_src_dir()) + "/tests/"; + string in_abi_base = in_elf_base; + + for (const InOutSpec *s = specs; s->in_elf_path; ++s) + { + test_task_sptr t(new_test(s, out_abi_base, + in_elf_base, + in_abi_base)); + ABG_ASSERT(task_queue.schedule_task(t)); + } + + /// Wait for all worker threads to finish their job, and wind down. + task_queue.wait_for_workers_to_complete(); + + // Now walk the results and print whatever error messages need to be + // printed. + + const vector& completed_tasks = + task_queue.get_completed_tasks(); + + ABG_ASSERT(completed_tasks.size() == num_tests); + + for (vector::const_iterator ti = + completed_tasks.begin(); + ti != completed_tasks.end(); + ++ti) + { + test_task_sptr t = dynamic_pointer_cast(*ti); + if (!t->is_ok) + { + is_ok = false; + if (!t->error_message.empty()) + cerr << t->error_message << '\n'; + } + } + + return !is_ok; +} + +}//end namespace read_common +}//end namespace tests +}//end namespace abigail diff --git a/tests/test-read-common.h b/tests/test-read-common.h new file mode 100644 index 00000000..784f41f5 --- /dev/null +++ b/tests/test-read-common.h @@ -0,0 +1,148 @@ +#ifndef __TEST_READ_COMMON_H__ +#define __TEST_READ_COMMON_H__ + +#include +#include "abg-ir.h" +#include "abg-corpus.h" +#include "abg-workers.h" +#include "abg-writer.h" +#include "test-utils.h" +#include "abg-tools-utils.h" + +using std::string; + +using abigail::xml_writer::type_id_style_kind; +using abigail::ir::corpus_sptr; + +namespace abigail +{ +namespace tests +{ +namespace read_common +{ + +/// This is an aggregate that specifies where a test shall get its +/// input from, and where it shall write its ouput to. +struct InOutSpec +{ + const char* in_elf_path; + const char* in_suppr_spec_path; + const char* in_public_headers_path; + type_id_style_kind type_id_style; + const char* in_abi_path; + const char* out_abi_path; +};// end struct InOutSpec + +/// The task that peforms the tests. +struct test_task : public abigail::workers::task +{ + bool is_ok; + InOutSpec spec; + string error_message; + string out_abi_base; + string in_elf_base; + string in_abi_base; + + string in_elf_path; + string in_abi_path; + string in_suppr_spec_path; + string in_public_headers_path; + string out_abi_path; + + void + set_in_elf_path() + { + in_elf_path = in_elf_base + spec.in_elf_path; + } + + void + set_in_suppr_spec_path() + { + if (spec.in_suppr_spec_path) + in_suppr_spec_path = in_elf_base + spec.in_suppr_spec_path; + else + in_suppr_spec_path.clear(); + } + + void + set_in_public_headers_path() + { + if (spec.in_public_headers_path) + in_public_headers_path = spec.in_public_headers_path; + if (!in_public_headers_path.empty()) + in_public_headers_path = in_elf_base + spec.in_public_headers_path; + } + + bool + set_out_abi_path() + { + out_abi_path = out_abi_base + spec.out_abi_path; + if (!abigail::tools_utils::ensure_parent_dir_created(out_abi_path)) + { + error_message = + string("Could not create parent directory for ") + out_abi_path; + return false; + } + return true; + } + + void + set_in_abi_path() + { + in_abi_path = in_abi_base + spec.in_abi_path; + } + + test_task(const InOutSpec &s, + string& a_out_abi_base, + string& a_in_elf_base, + string& a_in_abi_base); + bool + serialize_corpus(const string& out_abi_path, + corpus_sptr corp); + bool + run_abidw(const string& extargs = ""); + + bool + run_diff(); + + virtual + ~test_task() + {} + +}; // end struct test_task + +typedef shared_ptr test_task_sptr; + +struct options +{ + string wrong_option; + bool parallel; + + options() + : parallel(true) + {} + + ~options() + { + } +}; + +void +display_usage(const string& prog_name, ostream& out); + +bool +parse_command_line(int argc, char* argv[], options& opts); + +typedef test_task* (*create_new_test)(const InOutSpec* s, + string& a_out_abi_base, + string& a_in_elf_base, + string& a_in_abi_base); +bool +run_tests(const size_t num_test, const InOutSpec* specs, + const options& opts, create_new_test new_test); + +}//end namespace read_common +}//end namespace tests +}//end namespace abigail + +#endif //__TEST_READ_COMMON_H__ diff --git a/tests/test-read-ctf.cc b/tests/test-read-ctf.cc new file mode 100644 index 00000000..bfa8c87b --- /dev/null +++ b/tests/test-read-ctf.cc @@ -0,0 +1,328 @@ +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// -*- Mode: C++ -*- +// +// Copyright (C) 2021 Oracle, Inc. +// +// Author: Guillermo E. Martinez + +/// @file read ELF binaries containing CTF, save them in XML corpus +/// files and diff the corpus files against reference XML corpus +/// files. + +#include +#include +#include +#include +#include +#include +#include "abg-ctf-reader.h" +#include "test-read-common.h" + +using std::string; +using std::cerr; + +using abigail::tests::read_common::InOutSpec; +using abigail::tests::read_common::test_task; +using abigail::tests::read_common::display_usage; +using abigail::tests::read_common::options; + +using abigail::ctf_reader::read_context_sptr; +using abigail::ctf_reader::create_read_context; +using abigail::xml_writer::SEQUENCE_TYPE_ID_STYLE; +using abigail::xml_writer::HASH_TYPE_ID_STYLE; +using abigail::tools_utils::emit_prefix; + +static InOutSpec in_out_specs[] = +{ + { + "data/test-read-ctf/test0", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test0.abi", + "output/test-read-ctf/test0.abi" + }, + { + "data/test-read-ctf/test0", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-ctf/test0.hash.abi", + "output/test-read-ctf/test0.hash.abi" + }, + { + "data/test-read-ctf/test1.so", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test1.so.abi", + "output/test-read-ctf/test1.so.abi" + }, + { + "data/test-read-ctf/test1.so", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-ctf/test1.so.hash.abi", + "output/test-read-ctf/test1.so.hash.abi" + }, + { + "data/test-read-ctf/test2.so", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test2.so.abi", + "output/test-read-ctf/test2.so.abi" + }, + { + "data/test-read-ctf/test2.so", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-ctf/test2.so.hash.abi", + "output/test-read-ctf/test2.so.hash.abi" + }, + { + "data/test-read-common/test3.so", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-common/test3-ctf.so.abi", + "output/test-read-common/test3-ctf.so.abi" + }, + { + "data/test-read-common/test3.so", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-common/test3-ctf.so.hash.abi", + "output/test-read-common/test3-ctf.so.hash.abi" + }, + { + "data/test-read-ctf/test-enum-many-ctf.o", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-ctf/test-enum-many-ctf.o.hash.abi", + "output/test-read-ctf/test-enum-many-ctf.o.hash.abi" + }, + { + "data/test-read-ctf/test-ambiguous-struct-A.o", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-ctf/test-ambiguous-struct-A.o.hash.abi", + "output/test-read-ctf/test-ambiguous-struct-A.o.hash.abi" + }, + { + "data/test-read-ctf/test-ambiguous-struct-B.o", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-ctf/test-ambiguous-struct-B.o.hash.abi", + "output/test-read-ctf/test-ambiguous-struct-B.o.hash.abi" + }, + { + "data/test-read-ctf/test-conflicting-type-syms-a.o", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi", + "output/test-read-ctf/test-conflicting-type-syms-a.o.hash.abi" + }, + { + "data/test-read-ctf/test-conflicting-type-syms-b.o", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi", + "output/test-read-ctf/test-conflicting-type-syms-b.o.hash.abi" + }, + { + "data/test-read-ctf/test-alias.o", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-ctf/test-alias.o.abi", + "output/test-read-ctf/test-alias.o.abi", + }, + { + "data/test-read-common/test4.so", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-common/test4-ctf.so.abi", + "output/test-read-common/test4-ctf.so.abi" + }, + { + "data/test-read-common/test4.so", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-common/test4-ctf.so.hash.abi", + "output/test-read-common/test4-ctf.so.hash.abi" + }, + { + "data/test-read-ctf/test-enum-ctf.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test-enum-ctf.o.abi", + "output/test-read-ctf/test-enum-ctf.o.abi" + }, + { + "data/test-read-ctf/test-enum-symbol-ctf.o", + "", + "", + HASH_TYPE_ID_STYLE, + "data/test-read-ctf/test-enum-symbol-ctf.o.hash.abi", + "output/test-read-ctf/test-enum-symbol-ctf.o.hash.abi" + }, + { + "data/test-read-ctf/test-struct-iteration-ctf.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-ctf/test-struct-iteration-ctf.o.abi", + "output/test-read-ctf/test-struct-iteration-ctf.o.abi" + }, + { + "data/test-read-common/PR26261/PR26261-exe", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-common/PR26261/PR26261-exe-ctf.abi", + "output/test-read-common/PR26261/PR26261-exe-ctf.abi", + }, + { + "data/test-read-common/test-PR26568-1.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-common/test-PR26568-1-ctf.o.abi", + "output/test-read-common/test-PR26568-1-ctf.o.abi", + }, + { + "data/test-read-common/test-PR26568-2.o", + "", + "", + SEQUENCE_TYPE_ID_STYLE, + "data/test-read-common/test-PR26568-2-ctf.o.abi", + "output/test-read-common/test-PR26568-2-ctf.o.abi", + }, + { + "data/test-read-common/PR27700/test-PR27700.o", + "", + "data/test-read-common/PR27700/pub-incdir", + HASH_TYPE_ID_STYLE, + "data/test-read-common/PR27700/test-PR27700-ctf.abi", + "output/test-read-common/PR27700/test-PR27700-ctf.abi", + }, + // This should be the last entry. + {NULL, NULL, NULL, SEQUENCE_TYPE_ID_STYLE, NULL, NULL} +}; + +/// The task that peforms the tests. +struct test_task_ctf : public test_task +{ + test_task_ctf(const InOutSpec &s, + string& a_out_abi_base, + string& a_in_elf_base, + string& a_in_abi_base); + virtual void + perform(); + + virtual + ~test_task_ctf() + {} +}; + +test_task_ctf::test_task_ctf(const InOutSpec &s, + string& a_out_abi_base, + string& a_in_elf_base, + string& a_in_abi_base) + : test_task(s, a_out_abi_base, a_in_elf_base, a_in_abi_base) + {} + +/// The actual test. +/// +/// This reads the corpus into memory, saves it to disk, loads it +/// again and compares the new in-memory representation against the +void +test_task_ctf::perform() +{ + abigail::ir::environment_sptr env; + + set_in_elf_path(); + set_in_suppr_spec_path(); + + env.reset(new abigail::ir::environment); + ABG_ASSERT(abigail::tools_utils::file_exists(in_elf_path)); + + read_context_sptr ctxt = create_read_context(in_elf_path, + env.get()); + ABG_ASSERT(ctxt); + + corpus_sptr corp = read_corpus(ctxt.get()); + // if there is no output and no input, assume that we do not care about the + // actual read result, just that it succeeded. + if (!spec.in_abi_path && !spec.out_abi_path) + { + // Phew! we made it here and we did not crash! yay! + return; + } + if (!corp) + { + error_message = string("failed to read ") + in_elf_path + "\n"; + is_ok = false; + return; + } + corp->set_path(spec.in_elf_path); + // Do not take architecture names in comparison so that these + // test input binaries can come from whatever arch the + // programmer likes. + corp->set_architecture_name(""); + + if (!(is_ok = set_out_abi_path())) + return; + + if (!(is_ok = serialize_corpus(out_abi_path, corp))) + return; + + if (!(is_ok = run_abidw("--ctf "))) + return; + + if (!(is_ok = run_diff())) + return; +} + +static test_task* +new_task(const InOutSpec* s, string& a_out_abi_base, + string& a_in_elf_base, string& a_in_abi_base) +{ + return new test_task_ctf(*s, a_in_abi_base, + a_in_elf_base, a_in_abi_base); +} + +int +main(int argc, char *argv[]) +{ + options opts; + if (!parse_command_line(argc, argv, opts)) + { + if (!opts.wrong_option.empty()) + emit_prefix(argv[0], cerr) + << "unrecognized option: " << opts.wrong_option << "\n"; + display_usage(argv[0], cerr); + return 1; + } + + /// Create a task queue. The max number of worker threads of the + /// queue is the number of the concurrent threads supported by the + /// processor of the machine this code runs on. But if + /// --no-parallel was provided then the number of worker threads + /// equals 1. + const size_t num_tests = sizeof(in_out_specs) / sizeof (InOutSpec) - 1; + + return run_tests(num_tests, in_out_specs, opts, new_task); +} diff --git a/tests/test-read-dwarf.cc b/tests/test-read-dwarf.cc index 509bc11a..f0e74d4a 100644 --- a/tests/test-read-dwarf.cc +++ b/tests/test-read-dwarf.cc @@ -15,45 +15,28 @@ #include #include #include -#include "abg-ir.h" +// #include "abg-ir.h" +#include "test-read-common.h" #include "abg-dwarf-reader.h" -#include "abg-workers.h" -#include "abg-writer.h" -#include "abg-tools-utils.h" -#include "test-utils.h" using std::vector; using std::string; -using std::ofstream; using std::cerr; -using std::dynamic_pointer_cast; -using abigail::tests::get_build_dir; + +using abigail::tests::read_common::InOutSpec; +using abigail::tests::read_common::test_task; +using abigail::tests::read_common::display_usage; +using abigail::tests::read_common::options; + using abigail::dwarf_reader::read_corpus_from_elf; using abigail::dwarf_reader::read_context; using abigail::dwarf_reader::read_context_sptr; using abigail::dwarf_reader::create_read_context; using abigail::xml_writer::SEQUENCE_TYPE_ID_STYLE; using abigail::xml_writer::HASH_TYPE_ID_STYLE; -using abigail::xml_writer::create_write_context; -using abigail::xml_writer::set_type_id_style; -using abigail::xml_writer::type_id_style_kind; -using abigail::xml_writer::write_context_sptr; -using abigail::xml_writer::write_corpus; - -/// This is an aggregate that specifies where a test shall get its -/// input from, and where it shall write its ouput to. -struct InOutSpec -{ - const char* in_elf_path; - const char* in_suppr_spec_path; - const char* in_public_headers_path; - type_id_style_kind type_id_style; - const char* in_abi_path; - const char* out_abi_path; -};// end struct InOutSpec - +using abigail::tools_utils::emit_prefix; -InOutSpec in_out_specs[] = +static InOutSpec in_out_specs[] = { { "data/test-read-dwarf/test0", @@ -104,56 +87,56 @@ InOutSpec in_out_specs[] = "output/test-read-dwarf/test2.so.hash.abi" }, { - "data/test-read-dwarf/test3.so", + "data/test-read-common/test3.so", "", "", SEQUENCE_TYPE_ID_STYLE, - "data/test-read-dwarf/test3.so.abi", - "output/test-read-dwarf/test3.so.abi" + "data/test-read-common/test3-dwarf.so.abi", + "output/test-read-common/test3-dwarf.so.abi" }, { - "data/test-read-dwarf/test3.so", + "data/test-read-common/test3.so", "", "", HASH_TYPE_ID_STYLE, - "data/test-read-dwarf/test3.so.hash.abi", - "output/test-read-dwarf/test3.so.hash.abi" + "data/test-read-common/test3-dwarf.so.hash.abi", + "output/test-read-common/test3-dwarf.so.hash.abi" }, // suppress all except the main symbol of a group of aliases { - "data/test-read-dwarf/test3.so", - "data/test-read-dwarf/test3-alias-1.suppr", + "data/test-read-common/test3.so", + "data/test-read-common/test3-alias-1.suppr", "", HASH_TYPE_ID_STYLE, - "data/test-read-dwarf/test3-alias-1.so.hash.abi", - "output/test-read-dwarf/test3-alias-1.so.hash.abi" + "data/test-read-common/test3-alias-1-dwarf.so.hash.abi", + "output/test-read-common/test3-alias-1-dwarf.so.hash.abi" }, // suppress the main symbol of a group of aliases { - "data/test-read-dwarf/test3.so", - "data/test-read-dwarf/test3-alias-2.suppr", + "data/test-read-common/test3.so", + "data/test-read-common/test3-alias-2.suppr", "", HASH_TYPE_ID_STYLE, - "data/test-read-dwarf/test3-alias-2.so.hash.abi", - "output/test-read-dwarf/test3-alias-2.so.hash.abi" + "data/test-read-common/test3-alias-2-dwarf.so.hash.abi", + "output/test-read-common/test3-alias-2-dwarf.so.hash.abi" }, // suppress all except one non main symbol of a group of aliases { - "data/test-read-dwarf/test3.so", - "data/test-read-dwarf/test3-alias-3.suppr", + "data/test-read-common/test3.so", + "data/test-read-common/test3-alias-3.suppr", "", HASH_TYPE_ID_STYLE, - "data/test-read-dwarf/test3-alias-3.so.hash.abi", - "output/test-read-dwarf/test3-alias-3.so.hash.abi" + "data/test-read-common/test3-alias-3-dwarf.so.hash.abi", + "output/test-read-common/test3-alias-3-dwarf.so.hash.abi" }, // suppress all symbols of a group of aliases { - "data/test-read-dwarf/test3.so", - "data/test-read-dwarf/test3-alias-4.suppr", + "data/test-read-common/test3.so", + "data/test-read-common/test3-alias-4.suppr", "", HASH_TYPE_ID_STYLE, - "data/test-read-dwarf/test3-alias-4.so.hash.abi", - "output/test-read-dwarf/test3-alias-4.so.hash.abi" + "data/test-read-common/test3-alias-4-dwarf.so.hash.abi", + "output/test-read-common/test3-alias-4-dwarf.so.hash.abi" }, // suppress the main symbols with alias (function+variable) in .o file { @@ -165,20 +148,20 @@ InOutSpec in_out_specs[] = "output/test-read-dwarf/test-suppressed-alias.o.abi", }, { - "data/test-read-dwarf/test4.so", + "data/test-read-common/test4.so", "", "", SEQUENCE_TYPE_ID_STYLE, - "data/test-read-dwarf/test4.so.abi", - "output/test-read-dwarf/test4.so.abi" + "data/test-read-common/test4-dwarf.so.abi", + "output/test-read-common/test4-dwarf.so.abi" }, { - "data/test-read-dwarf/test4.so", + "data/test-read-common/test4.so", "", "", HASH_TYPE_ID_STYLE, - "data/test-read-dwarf/test4.so.hash.abi", - "output/test-read-dwarf/test4.so.hash.abi" + "data/test-read-common/test4-dwarf.so.hash.abi", + "output/test-read-common/test4-dwarf.so.hash.abi" }, { "data/test-read-dwarf/test5.o", @@ -449,28 +432,28 @@ InOutSpec in_out_specs[] = NULL, }, { - "data/test-read-dwarf/PR26261/PR26261-exe", + "data/test-read-common/PR26261/PR26261-exe", "", "", SEQUENCE_TYPE_ID_STYLE, - "data/test-read-dwarf/PR26261/PR26261-exe.abi", - "output/test-read-dwarf/PR26261/PR26261-exe.abi", + "data/test-read-common/PR26261/PR26261-exe-dwarf.abi", + "output/test-read-common/PR26261/PR26261-exe-dwarf.abi", }, { - "data/test-read-dwarf/test-PR26568-1.o", + "data/test-read-common/test-PR26568-1.o", "", "", SEQUENCE_TYPE_ID_STYLE, - "data/test-read-dwarf/test-PR26568-1.o.abi", - "output/test-read-dwarf/test-PR26568-1.o.abi", + "data/test-read-common/test-PR26568-1-dwarf.o.abi", + "output/test-read-common/test-PR26568-1-dwarf.o.abi", }, { - "data/test-read-dwarf/test-PR26568-2.o", + "data/test-read-common/test-PR26568-2.o", "", "", SEQUENCE_TYPE_ID_STYLE, - "data/test-read-dwarf/test-PR26568-2.o.abi", - "output/test-read-dwarf/test-PR26568-2.o.abi", + "data/test-read-common/test-PR26568-2-dwarf.o.abi", + "output/test-read-common/test-PR26568-2-dwarf.o.abi", }, { "data/test-read-dwarf/test-libandroid.so", @@ -481,12 +464,12 @@ InOutSpec in_out_specs[] = "output/test-read-dwarf/test-libandroid.so.abi", }, { - "data/test-read-dwarf/PR27700/test-PR27700.o", + "data/test-read-common/PR27700/test-PR27700.o", "", - "data/test-read-dwarf/PR27700/pub-incdir", + "data/test-read-common/PR27700/pub-incdir", HASH_TYPE_ID_STYLE, - "data/test-read-dwarf/PR27700/test-PR27700.abi", - "output/test-read-dwarf/PR27700/test-PR27700.abi", + "data/test-read-common/PR27700/test-PR27700-dwarf.abi", + "output/test-read-common/PR27700/test-PR27700-dwarf.abi", }, { "data/test-read-dwarf/test-libaaudio.so", @@ -545,146 +528,107 @@ set_suppressions_from_headers(read_context& read_ctxt, const string& path) } /// The task that peforms the tests. -struct test_task : public abigail::workers::task +struct test_task_dwarf : public test_task { - bool is_ok; - InOutSpec spec; - string error_message; - string out_abi_base; - string in_elf_base; - string in_abi_base; + test_task_dwarf(const InOutSpec &s, + string& a_out_abi_base, + string& a_in_elf_base, + string& a_in_abi_base); + virtual void + perform(); - test_task(const InOutSpec &s, - string& a_out_abi_base, - string& a_in_elf_base, - string& a_in_abi_base) - : is_ok(true), - spec(s), - out_abi_base(a_out_abi_base), - in_elf_base(a_in_elf_base), - in_abi_base(a_in_abi_base) + virtual + ~test_task_dwarf() {} +}; - /// The actual test. - /// - /// This reads the corpus into memory, saves it to disk, loads it - /// again and compares the new in-memory representation against the - /// saved one. - virtual void - perform() - { - string in_elf_path, in_abi_path, in_suppr_spec_path, in_public_headers_path, - out_abi_path; - abigail::ir::environment_sptr env; +/// The task that peforms the tests. +test_task_dwarf::test_task_dwarf(const InOutSpec &s, + string& a_out_abi_base, + string& a_in_elf_base, + string& a_in_abi_base) + : test_task(s, a_out_abi_base, a_in_elf_base, a_in_abi_base) + {} - in_elf_path = in_elf_base + spec.in_elf_path; - if (spec.in_suppr_spec_path) - in_suppr_spec_path = in_elf_base + spec.in_suppr_spec_path; - else - in_suppr_spec_path.clear(); +void +test_task_dwarf::perform() +{ + abigail::ir::environment_sptr env; - if (spec.in_public_headers_path) - in_public_headers_path = spec.in_public_headers_path; - if (!in_public_headers_path.empty()) - in_public_headers_path = in_elf_base + spec.in_public_headers_path; + set_in_elf_path(); + set_in_suppr_spec_path(); + set_in_public_headers_path(); - env.reset(new abigail::ir::environment); - abigail::dwarf_reader::status status = + env.reset(new abigail::ir::environment); + abigail::dwarf_reader::status status = abigail::dwarf_reader::STATUS_UNKNOWN; - vector di_roots; - ABG_ASSERT(abigail::tools_utils::file_exists(in_elf_path)); - read_context_sptr ctxt = create_read_context(in_elf_path, - di_roots, - env.get()); - ABG_ASSERT(ctxt); - if (!in_suppr_spec_path.empty()) - set_suppressions(*ctxt, in_suppr_spec_path); - - if (!in_public_headers_path.empty()) - set_suppressions_from_headers(*ctxt, in_public_headers_path); + vector di_roots; + ABG_ASSERT(abigail::tools_utils::file_exists(in_elf_path)); + read_context_sptr ctxt = create_read_context(in_elf_path, + di_roots, + env.get()); + ABG_ASSERT(ctxt); + if (!in_suppr_spec_path.empty()) + set_suppressions(*ctxt, in_suppr_spec_path); + + if (!in_public_headers_path.empty()) + set_suppressions_from_headers(*ctxt, in_public_headers_path); + + abigail::corpus_sptr corp = read_corpus_from_elf(*ctxt, status); + // if there is no output and no input, assume that we do not care about the + // actual read result, just that it succeeded. + if (!spec.in_abi_path && !spec.out_abi_path) + { + // Phew! we made it here and we did not crash! yay! + return; + } + if (!corp) + { + error_message = string("failed to read ") + in_elf_path + "\n"; + is_ok = false; + return; + } + corp->set_path(spec.in_elf_path); + // Do not take architecture names in comparison so that these + // test input binaries can come from whatever arch the + // programmer likes. + corp->set_architecture_name(""); - abigail::corpus_sptr corp = read_corpus_from_elf(*ctxt, status); - // if there is no output and no input, assume that we do not care about the - // actual read result, just that it succeeded. - if (!spec.in_abi_path && !spec.out_abi_path) - { - // Phew! we made it here and we did not crash! yay! - return; - } - if (!corp) - { - error_message = string("failed to read ") + in_elf_path + "\n"; - is_ok = false; - return; - } - corp->set_path(spec.in_elf_path); - // Do not take architecture names in comparison so that these - // test input binaries can come from whatever arch the - // programmer likes. - corp->set_architecture_name(""); + if (!(is_ok = set_out_abi_path())) + return; - out_abi_path = out_abi_base + spec.out_abi_path; - if (!abigail::tools_utils::ensure_parent_dir_created(out_abi_path)) - { - error_message = - string("Could not create parent directory for ") + out_abi_path; - is_ok = false; - return; - } + if (!(is_ok = serialize_corpus(out_abi_path, corp))) + return; - ofstream of(out_abi_path.c_str(), std::ios_base::trunc); - if (!of.is_open()) - { - error_message = string("failed to read ") + out_abi_path + "\n"; - is_ok = false; - return; - } - write_context_sptr write_ctxt - = create_write_context(corp->get_environment(), of); - set_type_id_style(*write_ctxt, spec.type_id_style); - is_ok = write_corpus(*write_ctxt, corp, /*indent=*/0); - of.close(); + if (!(is_ok = run_abidw())) + return; - string abidw = string(get_build_dir()) + "/tools/abidw"; - string drop_private_types; - if (!in_public_headers_path.empty()) - drop_private_types += "--headers-dir " + in_public_headers_path + - " --drop-private-types"; - string cmd = abidw + " " + drop_private_types + " --abidiff " + in_elf_path; - if (system(cmd.c_str())) - { - error_message = string("ABIs differ:\n") - + in_elf_path - + "\nand:\n" - + out_abi_path - + "\n"; - is_ok = false; - } + if (!(is_ok = run_diff())) + return; +} - in_abi_path = in_abi_base + spec.in_abi_path; - cmd = "diff -u " + in_abi_path + " " + out_abi_path; - if (system(cmd.c_str())) - is_ok = false; - } -}; // end struct test_task -typedef shared_ptr test_task_sptr; +static test_task* +new_task(const InOutSpec* s, string& a_out_abi_base, + string& a_in_elf_base, string& a_in_abi_base) +{ + return new test_task_dwarf(*s, a_in_abi_base, + a_in_elf_base, a_in_abi_base); +} int main(int argc, char *argv[]) { bool no_parallel = false; - if (argc == 2) + options opts; + if (!parse_command_line(argc, argv, opts)) { - if (argv[1] == string("--no-parallel")) - no_parallel = true; - else - { - cerr << "unrecognized option\n"; - cerr << "usage: " << argv[0] << " [--no-parallel]\n" ; - return 1; - } + if (!opts.wrong_option.empty()) + emit_prefix(argv[0], cerr) + << "unrecognized option: " << opts.wrong_option << "\n"; + display_usage(argv[0], cerr); + return 1; } /// Create a task queue. The max number of worker threads of the @@ -693,49 +637,6 @@ main(int argc, char *argv[]) /// --no-parallel was provided then the number of worker threads /// equals 1. const size_t num_tests = sizeof(in_out_specs) / sizeof (InOutSpec) - 1; - size_t num_workers = (no_parallel - ? 1 - : std::min(abigail::workers::get_number_of_threads(), - num_tests)); - abigail::workers::queue task_queue(num_workers); - bool is_ok = true; - - string out_abi_base = string(get_build_dir()) + "/tests/"; - string in_elf_base = string(abigail::tests::get_src_dir()) + "/tests/"; - string in_abi_base = in_elf_base; - - for (InOutSpec *s = in_out_specs; s->in_elf_path; ++s) - { - test_task_sptr t(new test_task(*s, out_abi_base, - in_elf_base, - in_abi_base)); - ABG_ASSERT(task_queue.schedule_task(t)); - } - - /// Wait for all worker threads to finish their job, and wind down. - task_queue.wait_for_workers_to_complete(); - - // Now walk the results and print whatever error messages need to be - // printed. - - const vector& completed_tasks = - task_queue.get_completed_tasks(); - - ABG_ASSERT(completed_tasks.size() == num_tests); - - for (vector::const_iterator ti = - completed_tasks.begin(); - ti != completed_tasks.end(); - ++ti) - { - test_task_sptr t = dynamic_pointer_cast(*ti); - if (!t->is_ok) - { - is_ok = false; - if (!t->error_message.empty()) - cerr << t->error_message << '\n'; - } - } - return !is_ok; + return run_tests(num_tests, in_out_specs, opts, new_task); }