Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp20371pxb; Wed, 24 Feb 2021 16:58:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJyAiaiPwojGgAHYPJn+qXMWUkynDQqKNG+7idsiXESHtAHmxjpf6VzATuCQo65wmYl5oJnJ X-Received: by 2002:a05:6402:270d:: with SMTP id y13mr480038edd.149.1614214680773; Wed, 24 Feb 2021 16:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614214680; cv=none; d=google.com; s=arc-20160816; b=KuXfllmQEVh4jkv431U1FLgLEkfOFIAsQ9QLfoEQ/ykGJ1SB9celosaZuCfSkqa4jU D7qfNEdTNnYA4y4789uQeIJ0zuolkv25nxAzvw3nW2EJIMs+vRzBX3J3PubV98fr3vuk S90KxUt886miP2foQQ37cXJ/I3kYffZ05CdJt/1gcHVepdLEQvDeDZrz6wqShwQBsDId Cs4mGArj74UqcADHC1muoVjsr4FgMjHQgWgtbP2z/RqN8aEWPFcH/7UQAk/yAyQwWM35 /VGpd7w3+cqPsRx0b5eGyBsZjv9gzWkMExo4XexMDvav2uVo61iOa+Bsb8dYz81tKTPK tG4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cClZ4arkqcsGEilDhwa9v6Cj8IXTZ3mm/jsLqqThEsQ=; b=Be5SSHxaMaJ7sREw9HX+mySdJgkw4nZck9PuD8+7shExZbLgCI/K2gjckzW5OGzq33 MoodKITKltjHNrNPfaW5MxqqF+7EINiCxJYFJ+/Axr1T6/ynepXIiNU/nxoXvXacDTse FwxMkRSpxlugnxQYHZRf110QK7nY4RrRpUn0HD96VMH21efaX6A+44jR1+ejgFhvmWL4 edHLOcp9BA0UPF+uV94nRvnwMUdBSoYDzJi2/649Ptww3/aM0ZKldp7rlYIlQaWeVHI0 sEtpsF32OQ+GT6DgZaqR98HAlEawYQETw4tyOXi2PoqwKGNIMSAevtoonhEXdIs7dm56 7oYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="LV/clOdr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u20si2197400edv.129.2021.02.24.16.57.23; Wed, 24 Feb 2021 16:58:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="LV/clOdr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238429AbhBXPTJ (ORCPT + 99 others); Wed, 24 Feb 2021 10:19:09 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:36844 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237767AbhBXOkK (ORCPT ); Wed, 24 Feb 2021 09:40:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614177519; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cClZ4arkqcsGEilDhwa9v6Cj8IXTZ3mm/jsLqqThEsQ=; b=LV/clOdrvJkevlIjFeyD56sH3i5eMozSBILkIfhC3/yUPuXVmX/JMLqRpqBMd3AuvJcd+T yI3qtHQgxDcPYHCzxvfLB6ym2ALviEj59g8wrq43D/jKllfpm2lgcrDL09VCasXx1XhhxN kYSt2IBNcIcK3pPFC8I6MtXrQ+7iG3Y= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-399-5df787PPMneRfs8pTt_H6A-1; Wed, 24 Feb 2021 09:37:00 -0500 X-MC-Unique: 5df787PPMneRfs8pTt_H6A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 604898C249F; Wed, 24 Feb 2021 13:43:48 +0000 (UTC) Received: from krava (unknown [10.40.193.200]) by smtp.corp.redhat.com (Postfix) with SMTP id B059C19C46; Wed, 24 Feb 2021 13:43:45 +0000 (UTC) Date: Wed, 24 Feb 2021 14:43:44 +0100 From: Jiri Olsa To: Nicholas Fraser Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Namhyung Kim , Ian Rogers , linux-kernel@vger.kernel.org, Ulrich Czekalla , Huw Davies Subject: Re: [PATCH 2/2] perf buildid-cache: Add test for PE executable Message-ID: References: <295f5380-93a1-78fa-884b-afd4319b96d7@codeweavers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <295f5380-93a1-78fa-884b-afd4319b96d7@codeweavers.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 19, 2021 at 11:10:34AM -0500, Nicholas Fraser wrote: SNIP > +if ! which wine > /dev/null; then > + echo "WARNING: wine not found. PE binaries will not be run." > + run_pe=0 > +fi > + > ex_md5=$(mktemp /tmp/perf.ex.MD5.XXX) > ex_sha1=$(mktemp /tmp/perf.ex.SHA1.XXX) > +ex_pe=$(dirname $0)/../pe-file.exe > > echo 'int main(void) { return 0; }' | cc -Wl,--build-id=sha1 -o ${ex_sha1} -x c - > echo 'int main(void) { return 0; }' | cc -Wl,--build-id=md5 -o ${ex_md5} -x c - > > -echo "test binaries: ${ex_sha1} ${ex_md5}" > +echo "test binaries: ${ex_sha1} ${ex_md5} ${ex_pe}" > > check() > { > - id=`readelf -n ${1} 2>/dev/null | grep 'Build ID' | awk '{print $3}'` > - > + case $1 in > + *.exe) > + # the build id must be rearranged into a GUID > + id=`objcopy -O binary --only-section=.buildid $1 /dev/stdout | \ > + cut -c 33-48 | hexdump -ve '/1 "%02x"' | \ > + sed 's@^\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)\(.*\)0a$@\4\3\2\1\6\5\8\7\9@'` > + ;; wow ;-) could this have some more info on what's going on in here? what's the .buildid PE section format? > + *) > + id=`readelf -n ${1} 2>/dev/null | grep 'Build ID' | awk '{print $3}'` > + ;; > + esac > echo "build id: ${id}" > > link=${build_id_dir}/.build-id/${id:0:2}/${id:2} > @@ -50,7 +73,7 @@ check() > exit 1 > fi > > - ${perf} buildid-cache -l | grep $id > + ${perf} buildid-cache -l | grep ${id} > if [ $? -ne 0 ]; then > echo "failed: ${id} is not reported by \"perf buildid-cache -l\"" > exit 1 > @@ -81,7 +104,7 @@ test_record() > build_id_dir=$(mktemp -d /tmp/perf.debug.XXX) > perf="perf --buildid-dir ${build_id_dir}" > > - ${perf} record --buildid-all -o ${data} ${1} > + ${perf} record --buildid-all -o ${data} ${2} ${1} it could be better just pass $@ and make sure test_record args are passed in a way that record would accept them test_record wine ${ex_pe} > if [ $? -ne 0 ]; then > echo "failed: record ${1}" > exit 1 > @@ -96,12 +119,22 @@ test_record() > # add binaries manual via perf buildid-cache -a > test_add ${ex_sha1} > test_add ${ex_md5} > +if [ $add_pe -eq 1 ]; then ${add_pe} > + test_add ${ex_pe} > +fi > > # add binaries via perf record post processing > test_record ${ex_sha1} > test_record ${ex_md5} > +if [ $run_pe -eq 1 ]; then ${run_pe} > + test_record ${ex_pe} wine I'm getting lot of wine's output, we should redirect that every other run I'm getting some small window popup saying it's updating wine and stuck forever.. could this be prevented? > +fi > > # cleanup > rm ${ex_sha1} ${ex_md5} > > +if [ $add_pe -eq 0 ] || [ $run_pe -eq 0 ]; then > + echo "WARNING: some PE tests were skipped. See previous warnings." > +fi there's already a warning for this at the beginning, I dont think we need another one thanks, jirka > + > exit ${err} > -- > 2.30.1 >