From patchwork Mon Jun 26 21:46:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Mezentsev X-Patchwork-Id: 113129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7773729vqr; Mon, 26 Jun 2023 14:46:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CTBmH1wADsdl9OZqve1kxxFF0zxbUTylUnEMIBaH5ju1jz+K95pyEL8PmjTGWrsA4H2tt X-Received: by 2002:a2e:380b:0:b0:2b4:7281:1992 with SMTP id f11-20020a2e380b000000b002b472811992mr14117769lja.46.1687816000466; Mon, 26 Jun 2023 14:46:40 -0700 (PDT) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id dy23-20020a05640231f700b0051bebdec7a1si2988642edb.127.2023.06.26.14.46.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jun 2023 14:46:40 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=MBVCod3c; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0C5033858C60 for ; Mon, 26 Jun 2023 21:46:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C5033858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1687815999; bh=tZHNpi9XjcU/RgHHoB8/86zbgVxTJ4kwBU2Um72+aXo=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=MBVCod3c2VpqzjZK0cAMGXf/T9DE7mJb3BwEK+tcgHD10cqAP1eBbFedd1BV4Urj2 fqT98lIIJ3Cg227xpZiPbZhu+akecTBPepYGOKGVluYiYWFGR3eS9JFuJatd7mHIn4 g/4vhpxP8md5VYB8/+eIGZq07+r/GowjjqoniGH0= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by sourceware.org (Postfix) with ESMTPS id BF7763858D1E for ; Mon, 26 Jun 2023 21:46:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BF7763858D1E Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35QKr7ta030338 for ; Mon, 26 Jun 2023 21:46:27 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3rds1u3mbu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 26 Jun 2023 21:46:27 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 35QK7r9R028275 for ; Mon, 26 Jun 2023 21:46:26 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2106.outbound.protection.outlook.com [104.47.70.106]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3rdpx3nxmh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 26 Jun 2023 21:46:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ONpsN/I77+Yr+qiwsm7DnekW8o834DJT6rEyFZKPzUYXzZl5sD0b1JUoxanDojpIrGh+c4CrXqCWRDOAJrmEDvDeB3iwwz6wozHYJj0/TNnkC56ggaXk8nfp7fDMMIDK/lM5vpUx8qImp72u13o/4IBuq3o6/D9ykhOZ0C/aai5Uio6gBDEQ9PIfYUqA8Lzm/yNPCdvcG8F5V+N7XX4rsOxtvXALT3dP3USHdpQaMebruznkOhmjVwJXKJfUCn0qoi3NxPDUpL7pbEai52buAqfCvzU1UKj5KQyx38FafBCtXNR68r1v8uh/tDhyOeirsPqrebbKwYP/+6WDqPnC+g== 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=tZHNpi9XjcU/RgHHoB8/86zbgVxTJ4kwBU2Um72+aXo=; b=IPOVjrgcYK4y02QjAZv9hDTghS+bg2GhQQEldkpudSoCaUrQjFPlOql/WE0GJeENjtzPuonMU611dYJyG8XZ29GIaEG/qZ2ACh4afZl0gC7xIoqoo53gY/Gz9rPpD/kTN/K+nzUbjptFrPjFSZuNQ1pxC+lhSn6ZooXnvdSejb8+L4mwOBJ9cw1RNGLGuthDtqk/BVjNtO4D56QnOvLR0sBNvmoMuW++QRYDDho/tbw8SelNIEfRadUJkFGygDbtXslKjNRuh1J73yRqUSJdu0LElLPrJw3CNEKbHDt18FHdtn/R6cbdd6kaG3VmTjyRXP9nalT3NxsmmjDZxUiaLA== 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 SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) by CH0PR10MB4875.namprd10.prod.outlook.com (2603:10b6:610:de::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Mon, 26 Jun 2023 21:46:24 +0000 Received: from SA2PR10MB4636.namprd10.prod.outlook.com ([fe80::e0a1:158b:3862:289a]) by SA2PR10MB4636.namprd10.prod.outlook.com ([fe80::e0a1:158b:3862:289a%5]) with mapi id 15.20.6500.036; Mon, 26 Jun 2023 21:46:24 +0000 To: binutils@sourceware.org Cc: Vladimir Mezentsev Subject: [PATCH] gprofng: Add new tests Date: Mon, 26 Jun 2023 14:46:19 -0700 Message-Id: <20230626214619.1808676-1-vladimir.mezentsev@oracle.com> X-Mailer: git-send-email 2.31.1 X-ClientProxiedBy: SA0PR11CA0097.namprd11.prod.outlook.com (2603:10b6:806:d1::12) To SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PR10MB4636:EE_|CH0PR10MB4875:EE_ X-MS-Office365-Filtering-Correlation-Id: 143f507a-d4d0-428e-2881-08db768ec973 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S1tIpEyY2QtEWoX7mzDasyzpX7XBj5PtRRUlvnuc3pPLiRv0kzvJf1pBCZaU0w/Qdq2zEiuTfFOGPYADJ5nSMiheJOjt7noc4Oh1YqwMcEhYCQ4gJrjLlBcE8yd2+1ssSRnJatxlDff5H8xSPwGQSxTtEb3qr3TyTAUIcQNSCH3e1YbXCFPl+fzcKG3JmV3wlEj8gYVF0oQa2Cae+MAKUdsl6cOaU5EtbVbVL+52cPe242Ceu5U93syXgoBQ5aPwpFdXAI/9AtCTP9oxFjdaSiRBunnVxs1PN/UrwHrPGMQWmngkDOzNzGlbNH8DqdH+lufR7NM9ombob8Iv7i9m5HqIFCZjVHLpK+jIhJ4p+jR49d+q1mSk8HAPfR9oZw6LTvz1bXvYCaQqPAdwMrMExG37ZbKzLMCYmDqGYgFco56OZfidbIkv7M2riWgA7eTiLft7BtuA/hEd+Bo0DtaVDPYWbVPCoXqqATibJidmFE9Z0Y2lPWO7L1T/3YtamzA5gd4eeR1KjHzPaggpfPXDWRSrflqhmU3eoDk6zB+XWSgBsuWPPPR2YEnd2dZmQ8d4STLO+0p+La7wOG8XKKwCyEAEvn8yNM0NqrVs6HzQC6I= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SA2PR10MB4636.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(346002)(136003)(366004)(376002)(396003)(451199021)(6512007)(36756003)(30864003)(5660300002)(6916009)(4326008)(86362001)(8936002)(8676002)(41300700001)(66946007)(66556008)(66476007)(38100700002)(316002)(107886003)(1076003)(9686003)(186003)(6506007)(2906002)(26005)(83380400001)(6666004)(478600001)(6486002)(2616005)(2004002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K3beLtJ+Vx/JMdTRWZfaitKaHcKLVkZv3DuZpjL0T74WoG/hekaNIKub7l4NVGL+fuoJurBNCkYzckOCt98FWFgE8xXdrJ3QVoGbG79dphnE8x/khah0gg08sKLHL/zn8e0rmBuhNgS1dQJYUL883Qzv0juVSpRGn0LhbMy8kJh3n8oUqDaev+DuGuEgFXeEtoDFuxkM2o0GXF1WxPHTLRsA4sFwRvB4yUGZhNkMdcFj6QeIOkeeX5OdNs3xsFmwq+WxXrjeGJRTf53QGty95wmD+v2DQD2ZtQUBSNcwCXM2mvL6u6CsEFaILBHM7+tpaeKpMkvbzh4dliGdGlw783qo2xPnnCQek5QL/G1Wc+/SI39sobFcVreBC3ULOhzwfZ3x7SkrETArtJ91mS7Ad2JnS5YKlp0alcSTy6YANU82Dv3Thi9tnlyOQiUIFu9CG0ekirKrRvWxNeS4w37VMh3z31AvVDGiCS9RwJQxwsMvUVV4g0txXI8tSfUvPV0wUOMF9WFX0TWxQkyYsstiGl5EH7PAHH292MX8inOK+H0x99s3IArc+XUjQNUh1Z1F7EzlmLMhQkZv5o+Ivq+2FzEWiEqWXJBESwO9odXqMFHNP49w5K40F57LceBjHmIgXuoteu1b9btuRRTMBM3PE0V2VryAD8LhRLtqD/QMQceE/fB3WXHyZSOeciL4ilJdrACAI56opffJOzdbayKsw7ZtPGywQxkMJaJZVt9nl76sIWx55SYZhh9+va9WBwiHsTy5rCxqt922kAzmRWXcUqSaOH+FiwC/ACoyDBl5YZPI73vh4n5MC/GngidhMmC3QHqmF4XW3696noOI5PXnDYcgy2oVWTMrz9wcofjpq5JlHjexEOf/K80A2P0tUWwAZ6tt60xRvdfBjsjphdwX5nhqeKy70tFDKJnfLDRektzg8ghp1kxXU34cunbbyuqHWjkuMO1wSk+vKrB1hi/7shaWD9VKu/OPnIZPL2Ou3bc7pvfaqLgvp4D5NOx6oxgzeSaKl/LwhBZ7T+UJE1Aw/pFKtOQxlCOYi2VU/do+fFf8Y0dNx2MRFQrvENGL3Kyz7Y3vkwX/5Ku+EilzSuOuexA9RlbRiP7099ZbUTcOJEg+4lKYttF2+GpHo0ln9b96/8NtDGHOKqSDt9i2mbtErjBx4f6cwOQxYHfK0Zh3iDZdxqEhCG4XNPAD+1tuVhlFyg2iCI1V0+1Lq5jDDAG1eHfCaL+nC+ZMtsVfi1HxlK4X+gIlNDYhLvAJiX9h/MeesyHO+cNR91h1+OOotkvelmFQoj6ocQSgTy7+xlzOe+k4KuAK60W7UB4HfMgY7PYO330AsA4da53LnhXQEYqfxV+/U4SAvKOvIetUrzR1s8jLgA3rw6i5lKiZwqaKuk4SQwO1cZF/ObGd32dlUd3iTzyEm6RBbDxR4iz/xu3CZHREoYcd8a+boV1dz7M3/ck6qkGZ33VABK5x4ViyaWo+Im+BHFsQDLwxVgx7P+fqCFA0p35HmkuvyoeC8fwu/sJDwMx9M6DL6SR9btyDEz8itOtHS4fkfWoGP3whGr3u77xDGG5djYvb6QxKOvv/SEvcqZv9b95whnVuQEfY0hamxg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 8uZbKNCA3Qpw7D0QVbWTg0fEP3VkdfwdawezDGPg0huvRmvdGSMisZ5PkV1ievn8UEE7yLtjRqgIoOycCxdF0VElYtXehzyVj2foi3QTL8zfV5H1gNv0KcX0haODM/7hS4B4/XORk3cdw95t420CHh49bv+dPvKAK/puRW2f0566ahBJQj8iByKMyJdokNbqy9oDcaMF1UglxfbpfK7h8FYM9Tnw0y86AiqkCe8ARp6oIvuS8iJ8H5I1onr46T5RrSzJmq7HLAqKFoqQr8BM3liBj6qc1w8hwg/Da/eFhTFsyN3iu3aGQiW8RTIqKijiX9qVrN028014jrxGrpBSKe/Axj/+DprfCuVOjMLt/TS1mFKs9qyFPofytAGKaslzliWeVzTsANDF7sIzvdhLbh2jlIgf9wAmcFxvAlZ7J4Mm49EPb4ZKLn+yBHAjPq/GcsGatLCb1cgv73um8tTnCL6T20sFVRAXecrpx2Ba8NHxOhVffNAg+T4EB/bCeEmigs20c+70DLpyMqjz616GE3Wu5c/tA1cvdmmIZvshoheFkiQQsOhLOfAJEFJ5a/yk62/HneMonbRPG9gkTMVYLEUFvLxRDUgpECJ8a6gQZuZBMHFm3DCscVhewLPRoJOgM9stZIvyJxONIFyX60ytyGN4+fXvbzilwMFND2hSN4aEcS5YMI+qZgOyz9pE1lo9laAj1IASS9mf6FHVgpAz23XDHZt7en5YueHnyeTnIKm5z7RxPQkf4YuQ7l3PblOZ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 143f507a-d4d0-428e-2881-08db768ec973 X-MS-Exchange-CrossTenant-AuthSource: SA2PR10MB4636.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 21:46:24.1709 (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: VDuzIOuFXLiMvoxgG1baS2vf5fvSebiLgR4mF7WF17nmxdKodfbVgrh2hsyBB5LolGrECeROAQIhzz0lNlvWKtdSNXvgTPXSs2NihuieVIo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4875 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-26_18,2023-06-26_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306260202 X-Proofpoint-GUID: lUZHFaUqhHkcNZJmNYgHpNeYhxOx5HMC X-Proofpoint-ORIG-GUID: lUZHFaUqhHkcNZJmNYgHpNeYhxOx5HMC X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Vladimir Mezentsev via Binutils From: Vladimir Mezentsev Reply-To: vladimir.mezentsev@oracle.com Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769803350144039070?= X-GMAIL-MSGID: =?utf-8?q?1769803350144039070?= From: Vladimir Mezentsev If there are no rejections, on Wednesday I will applay my fixes. It is tested on x86_64 and aarch64. gprofng/ChangeLog 2023-06-26 Vladimir Mezentsev * Makefile.am: Pass CLOCK_GETTIME_LINK to the testsuite * Makefile.in: Rebuild. * testsuite/gprofng.display/gp-archive.exp: New file. * testsuite/gprofng.display/gp-collect-app_F.exp: New file. * testsuite/gprofng.display/setpath_map.exp: New file. * testsuite/lib/smalltest.c: New file. --- gprofng/Makefile.am | 1 + gprofng/Makefile.in | 1 + .../testsuite/gprofng.display/gp-archive.exp | 70 +++++++++++++++++++ .../gprofng.display/gp-collect-app_F.exp | 62 ++++++++++++++++ .../testsuite/gprofng.display/setpath_map.exp | 65 +++++++++++++++++ gprofng/testsuite/lib/smalltest.c | 39 +++++++++++ 6 files changed, 238 insertions(+) create mode 100644 gprofng/testsuite/gprofng.display/gp-archive.exp create mode 100644 gprofng/testsuite/gprofng.display/gp-collect-app_F.exp create mode 100644 gprofng/testsuite/gprofng.display/setpath_map.exp create mode 100644 gprofng/testsuite/lib/smalltest.c diff --git a/gprofng/Makefile.am b/gprofng/Makefile.am index b0c960a0ae0..b1d976ab202 100644 --- a/gprofng/Makefile.am +++ b/gprofng/Makefile.am @@ -65,6 +65,7 @@ check-small check-extra check-install: site.exp development.exp if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \ JDK_INC="$(jdk_inc)" \ + CLOCK_GETTIME_LINK="$(CLOCK_GETTIME_LINK)" \ CHECK_TARGET=$@ \ PREFIX="$(prefix)" \ GPROFNG_BROKEN_JAVAC="$(GPROFNG_BROKEN_JAVAC)" \ diff --git a/gprofng/Makefile.in b/gprofng/Makefile.in index 582e0bb8716..06b563cb8ef 100644 --- a/gprofng/Makefile.in +++ b/gprofng/Makefile.in @@ -942,6 +942,7 @@ uninstall-am: @TCL_TRY_TRUE@ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ @TCL_TRY_TRUE@ $$runtest --tool $(DEJATOOL) --srcdir $${srcroot}/testsuite \ @TCL_TRY_TRUE@ JDK_INC="$(jdk_inc)" \ +@TCL_TRY_TRUE@ CLOCK_GETTIME_LINK="$(CLOCK_GETTIME_LINK)" \ @TCL_TRY_TRUE@ CHECK_TARGET=$@ \ @TCL_TRY_TRUE@ PREFIX="$(prefix)" \ @TCL_TRY_TRUE@ GPROFNG_BROKEN_JAVAC="$(GPROFNG_BROKEN_JAVAC)" \ diff --git a/gprofng/testsuite/gprofng.display/gp-archive.exp b/gprofng/testsuite/gprofng.display/gp-archive.exp new file mode 100644 index 00000000000..04871f91682 --- /dev/null +++ b/gprofng/testsuite/gprofng.display/gp-archive.exp @@ -0,0 +1,70 @@ +# Copyright (C) 2021-2023 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +# This script tests the -a option for "profng archive". + +global srcdir CC CLOCK_GETTIME_LINK +set gprofng $::env(GPROFNG) +set tdir "tmpdir/gp-archive" + +proc check_gp_archive { a_opt } { + global tdir gprofng + set cmd "$gprofng archive -a $a_opt $tdir/exp.er" + set output [run_native_host_cmd "$cmd"] + if { [lindex $output 0] != 0 } then { + set out [lindex $output 1] + send_log "'$cmd' failed\n" + fail $tdir + exit 1 + } + + run_native_host_cmd "mv $tdir/t.c $tdir/t.c.1" + set output [run_native_host_cmd "$gprofng display text -source main $tdir/exp.er"] + set out [lindex $output 1] + if { [string first "CORRECTSOURCE" [lindex $output 1]] < 0 } then { + set out [lindex $output 1] + send_log "CORRECTSOURCE is not found aafter '$cmd'\n" + fail $tdir + exit 1 + } +} + +run_native_host_cmd "mkdir -p $tdir" + +# Build test, create experiment: +set output [run_native_host_cmd "cd $tdir && \ + cat $srcdir/lib/smalltest.c | sed '1 i /* CORRECTSOURCE */' > t.c && \ + $CC -g t.c $CLOCK_GETTIME_LINK && \ + $gprofng collect app -p on -a off -O exp.er ./a.out"] + +if { [lindex $output 0] != 0 } then { + set out [lindex $output 1] + send_log "Experiment is not created in $tdir\n" + fail $tdir + exit 1 +} + + +check_gp_archive src + +run_native_host_cmd "rm -rf $tdir/exp.er/archives/*; mv $tdir/t.c.1 $tdir/t.c" +check_gp_archive usedsrc + +pass $dir diff --git a/gprofng/testsuite/gprofng.display/gp-collect-app_F.exp b/gprofng/testsuite/gprofng.display/gp-collect-app_F.exp new file mode 100644 index 00000000000..f4aa764642f --- /dev/null +++ b/gprofng/testsuite/gprofng.display/gp-collect-app_F.exp @@ -0,0 +1,62 @@ +# Copyright (C) 2021-2023 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + + +# gp-collect-app should follow descendants, which names match specified regular expressions +# +# This script tests the following cases: +# 1. collect -F off +# 2. collect -F on +# 3. collect -F = + +set gprofng $::env(GPROFNG) +set tdir "tmpdir/gp-collect-app_F" + +proc run_gp_collect_app { subExpCnt F_opt } { + global tdir gprofng + set output [run_native_host_cmd "cd $tdir && \ + $gprofng collect app -p on -a off -F '$F_opt' -O exp.er \ + sh -c 'mkdir t && touch t/x; rm -rf t' "] + if { [lindex $output 0] != 0 } then { + set out [lindex $output 1] + send_log "Experiment is not created in $tdir\n" + fail $tdir + exit 1 + } + + set output [run_native_host_cmd "find $tdir -name '*x1.er' | wc -l"] + set subExp [lindex $output 1] + if { $subExp != $subExpCnt } then { + set out [lindex $output 1] + send_log "Test failed for -F $F_opt. subExp=$subExp. Shold be $subExpCnt\n" + fail $tdir + exit 1 + } + return $output +} + +run_native_host_cmd "mkdir -p $tdir" + +run_gp_collect_app 0 "off" +run_gp_collect_app 3 "on" +run_gp_collect_app 1 "=mkd.r" +run_gp_collect_app 2 "=mkdir|touch" + +pass $dir + diff --git a/gprofng/testsuite/gprofng.display/setpath_map.exp b/gprofng/testsuite/gprofng.display/setpath_map.exp new file mode 100644 index 00000000000..698076d7c9e --- /dev/null +++ b/gprofng/testsuite/gprofng.display/setpath_map.exp @@ -0,0 +1,65 @@ +# Copyright (C) 2021-2023 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +# This script tests -setpath and -pathmap for "profng display text" + +global srcdir CC CLOCK_GETTIME_LINK +set gprofng $::env(GPROFNG) +set tdir "tmpdir/setpath_map" + +run_native_host_cmd "mkdir -p $tdir/src" + +# Build test, create experiment: +set output [run_native_host_cmd "cd $tdir && \ + cat $srcdir/lib/smalltest.c | sed '1 i /* CORRECTSOURCE */' > t.c && \ + $CC -g t.c $CLOCK_GETTIME_LINK && \ + $gprofng collect app -p on -a off -O exp.er ./a.out"] + +if { [lindex $output 0] != 0 } then { + set out [lindex $output 1] + send_log "Experiment is not created in $tdir\n" + fail $tdir + exit 1 +} + +# Copy the "good" file to $tdir/src. Mark old file as "wrong": +run_native_host_cmd "cp $tdir/t.c $tdir/src" +run_native_host_cmd "sed -i 's/CORRECTSOURCE/WRONGSOURCE/' $tdir/t.c" + +# Test -setpath: +set output [run_native_host_cmd "$gprofng display text -setpath $tdir/src -source main $tdir/exp.er"] +if { [string first "CORRECTSOURCE" [lindex $output 1]] < 0 } then { + set out [lindex $output 1] + send_log "CORRECTSOURCE is not found in $gprofng display text -setpath $tdir/src -source main $tdir/exp.er\n" + fail $tdir + exit 1 +} + +# Test -pathmap: +set output [run_native_host_cmd "$gprofng display text -pathmap $tdir $tdir/src -source main $tdir/exp.er"] +set out [lindex $output 1] +if { [string first "CORRECTSOURCE" [lindex $output 1]] < 0 } then { + set out [lindex $output 1] + send_log "CORRECTSOURCE is not found in $gprofng display text -pathmap $tdir $tdir/src -source main $tdir/exp.er\n" + fail $tdir + exit 1 +} + +pass $dir diff --git a/gprofng/testsuite/lib/smalltest.c b/gprofng/testsuite/lib/smalltest.c new file mode 100644 index 00000000000..49bd3957c45 --- /dev/null +++ b/gprofng/testsuite/lib/smalltest.c @@ -0,0 +1,39 @@ +#include +#include + +time_t +gethrtime (void) +{ + struct timespec tp; + time_t rc = 0; +#ifdef CLOCK_MONOTONIC_RAW + int r = clock_gettime (CLOCK_MONOTONIC_RAW, &tp); +#else + int r = clock_gettime (CLOCK_MONOTONIC, &tp); +#endif + + if (r == 0) + rc = ((time_t) tp.tv_sec) * 1e9 + (time_t) tp.tv_nsec; + return rc; +} + +volatile long x; /* temp variable for long calculation */ + +int +main (int argc, char **argv) +{ + long long count = 0; + time_t start = gethrtime (); + + do + { + x = 0; + for (int j = 0; j < 1000000; j++) + x = x + 1; + count++; + } + while (start + 2e9 > gethrtime ()); + printf("count=%lld x=%lld\n", count, x); + return 0; +} +