From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 39275 invoked by alias); 15 Nov 2019 19:54:51 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 39265 invoked by uid 89); 15 Nov 2019 19:54:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=retention, disclose X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 15 Nov 2019 19:54:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573847688; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bfwEc5vv5TkXhlQcCEyO1CawlWF7fO1heM9svAuEK/U=; b=AztRSw/WJcrgmfiX0iwpY84yxZtAbcyNCSXfZ+j5PMWXfdW7/UWJG/mx2uX/TQNDO9uUxS iA3Wi/CgJIQk11ZXslP6pyq54h6R0ctyuhrAjU2cCafrPPJ5Wez+ZjYvbRloDBwz6I3S/E txYBi38RftAGXnP/CVCN7d7mBFGIUxY= 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-184-TZBfL_LgNrmzWddEirh86g-1; Fri, 15 Nov 2019 14:54:46 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DAC8056C60; Fri, 15 Nov 2019 19:54:45 +0000 (UTC) Received: from redhat.com (ovpn-116-19.phx2.redhat.com [10.3.116.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BF78691BD; Fri, 15 Nov 2019 19:54:40 +0000 (UTC) Received: from fche by redhat.com with local (Exim 4.92) (envelope-from ) id 1iVhfz-0004xe-75; Fri, 15 Nov 2019 14:54:39 -0500 Date: Fri, 15 Nov 2019 19:54:00 -0000 From: "Frank Ch. Eigler" To: Mark Wielaard Cc: elfutils-devel@sourceware.org, amerey@redhat.com Subject: Re: patch 2/2 debuginfod server etc. Message-ID: <20191115195439.GC15272@redhat.com> References: <20191028190438.GC14349@redhat.com> <20191028190602.GD14349@redhat.com> <20191028190726.GE14349@redhat.com> <5356c862142d3221d91dc3f8767d6659639c61d9.camel@klomp.org> MIME-Version: 1.0 In-Reply-To: <5356c862142d3221d91dc3f8767d6659639c61d9.camel@klomp.org> User-Agent: Mutt/1.12.0 (2019-05-25) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: TZBfL_LgNrmzWddEirh86g-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-IsSubscribed: yes X-SW-Source: 2019-q4/txt/msg00149.txt.bz2 Hi - > And I don't like the pretty big testfiles, which aren't self-contained.=20 > You have to fetch them from a remote koji server. It would be much > better to have a (small) self-contained .spec file that can be used to > generate the rpms. Frank is already working on that. Well, one did not have to fetch them from anywhere, they were already there. But yes, working on a smaller synthetic set of RPMs. > > +debuginfod_build_id_find_LDADD =3D $(libdw) >=20 > You also use libelf functions, they'll be pulled in through libdw, but > I think it is better to be explicit > debuginfod_build_id_find_LDADD =3D $(libelf) $(libdw) OK. > > +set -x >=20 > Is this really necessary? > It makes the log files very verbose. > Or is that the intention? I've found it tricky to debug failing tests without this. > > +# find an unused port number > > +while true; do > > + PORT1=3D`expr '(' $RANDOM % 1000 ')' + 9000` > > + ss -atn | fgrep ":$PORT1" || break > > +done=20=20=20=20 >=20 > Which package does ss come from? iproute-5.2.0-1.fc30.x86_64 > Make sure it is listed as a BuildRequires. OK, because of %check in the RPM? > Also I am slightly worried about it not finding anything and looping > forever. Probably unlikely, but ss might misfunction?=20 There is no 100%-probable way of assigning a port number ahead of time. Would you like an iteration limit / abort for that unlikely situation? > What happens if ss isn't installed? The set -e should nuke the test run. > If we assume bash (which I believe we already do in some places) you > could use the bash builtin special /dev/tcp redirection to test whether > a localhost port is open with echo >/dev/tcp/localhost/$PORT OK, will try that. > > +mkdir F R > > +tempfiles F R >=20 > O, they are directories, then yeah, tempfiles isn't enough. > Maybe don't mark them as tempfiles then. OK. > > +env LD_LIBRARY_PATH=3D$ldpath DEBUGINFOD_URLS=3D ${abs_builddir}/../de= buginfod/debuginfod -vvvv -d $DB \ > > +-p $PORT1 -t0 -g0 R F & > > +PID1=3D$! > > +sleep 3 >=20 > Is there no better way to test the server has started? This one may not be needed. > > +export DEBUGINFOD_URLS=3Dhttp://localhost:$PORT1/=A0 # or without tra= iling / > > + > > +# We use -t0 and -g0 here to turn off time-based scanning & grooming. > > +# For testing purposes, we just sic SIGUSR1 / SIGUSR2 at the process. > > + > > +######################################################################= ## > > + > > +# Compile a simple program, strip its debuginfo and save the build-id. > > +# Also move the debuginfo into another directory so that elfutils > > +# cannot find it without debuginfod. > > +echo "int main() { return 0; }" > ${PWD}/prog.c > > +tempfiles prog.c > > +gcc -g -o prog ${PWD}/prog.c > > + ${abs_top_builddir}/src/strip -g -f prog.debug ${PWD}/prog > > +BUILDID=3D`env LD_LIBRARY_PATH=3D$ldpath ${abs_builddir}/../src/readel= f \ > > + -a prog | grep 'Build ID' | cut -d ' ' -f 7` > > + > > +mv prog F > > +mv prog.debug F > > +kill -USR1 $PID1 > > +sleep 3 # give enough time for scanning pass=20 >=20 > Hmm that hardcoded sleep 3 again :{ Well, here's the problem. We want to assert that the scan was successful. We can't just reject a 404 response because the scan may not have finished yet. So we'd have to race/loop/poll. But then we'd need a timeout (how long?). It turns out to be the same thing, just more complicated. > > +mv testfile-debuginfod-0.rpm R > > +mv testfile-debuginfod-1.rpm R > > +mv testfile-debuginfod-2.rpm R > > +kill -USR1 $PID1 > > +sleep 10 >=20 > Why 10? To give extra time for scanning RPMs. > > +kill -USR1 $PID1 # two hits of SIGUSR1 may be needed to resolve .debu= g->dwz->srefs > > +sleep 10 >=20 > And another :{ Yes, again, same reasons as above. You can either have a timeout-poll loop, or a time sleep and a single judgement poll. > > +# Trigger a cache clean and run the tests again. The clients should be= unable to > > +# find the target. > > +echo 0 > $DEBUGINFOD_CACHE_PATH/cache_clean_interval_s > > +echo 0 > $DEBUGINFOD_CACHE_PATH/max_unused_age_s > > + > > +testrun ${abs_builddir}/debuginfod_build_id_find -e F/prog 1 > > + > > +testrun ${abs_top_builddir}/debuginfod/debuginfod-find debuginfo $BUIL= DID2 && false || true >=20 > OK. But that means zero means never cache/always clean? > I would have expected 0 to mean "forever". I see the man page doesn't specifically disclose the interpretation of zero. A "no retention of prior results" purpose is useful, and is consistent with 0 as per the text. A "retain forever" setting would have to be a different value. - FChE