From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2340 invoked by alias); 29 Jun 2017 09:08:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 2285 invoked by uid 89); 29 Jun 2017 09:08:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*r:sk:static. X-HELO: mail-it0-f46.google.com Received: from mail-it0-f46.google.com (HELO mail-it0-f46.google.com) (209.85.214.46) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Jun 2017 09:08:37 +0000 Received: by mail-it0-f46.google.com with SMTP id k192so3541984ith.1 for ; Thu, 29 Jun 2017 02:08:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=nxJ2BgxddOhx0spld06gyBR+tj3kGubmKNABFl6I9Jo=; b=QpTF8NUOX8NxvyemqBN1oqeqeb9FgZTxxjeBFcgXM1VqAuFENt/nOXvUCz9oP6fXr7 Wh2qS+GpuYmC//EETpd/41uBXFwwPI7J3wyhhYfYOUbiKbW1EK7zY/U7trGQUIdL916D elW89CY764H644KCXAN67ATUuj40OgZS/qh7NnjVuqYgMYfiDQ/ZJqnI/RKfjV1efSMH voHLdZNu36s6icUTshD7qc4CGT2TpLJMNPEJmiyda9Xq5e8/TG2s6NL4SeC0IZSFwOGd ldRIrrEeze9Bp0ozubF6ic9EmE2xkxFNIIy2YLPZtWBeLul21k6nnZWpM7seKy4tPmBn z4oA== X-Gm-Message-State: AKS2vOx0qW6Uw44tMS2BUd7MVL/px6qU1Gj+xGvudpBhViwROfv5+tlR BJ0lfljB5+bfEsAa X-Received: by 10.36.7.202 with SMTP id f193mr990315itf.80.1498727315770; Thu, 29 Jun 2017 02:08:35 -0700 (PDT) Received: from E107787-LIN (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id b18sm304664itd.25.2017.06.29.02.08.34 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 29 Jun 2017 02:08:35 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 14/25] [RFC] GDBserver self test References: <1497256916-4958-1-git-send-email-yao.qi@linaro.org> <1497256916-4958-15-git-send-email-yao.qi@linaro.org> <4cfd0796-bfb0-c073-16c7-954328dcb419@redhat.com> Date: Thu, 29 Jun 2017 09:08:00 -0000 In-Reply-To: <4cfd0796-bfb0-c073-16c7-954328dcb419@redhat.com> (Pedro Alves's message of "Wed, 28 Jun 2017 18:08:55 +0100") Message-ID: <868tkbduuo.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00781.txt.bz2 Pedro Alves writes: > The name of the corresponding gdb command is "maint selftest", > i.e., no hyphen. If wonder if we should be consistent. > I chose "--self-test" because gcc uses "-fself-test". I am fine to use "--selftest" to align with GDB command "maint selftest". >>=20 >> gdb/gdbserver: >>=20 >> 2017-05-26 Yao Qi >>=20 >> * configure.ac: AC_DEFINE GDB_SELF_TEST if $development. >> * configure, config.in: Re-generated. >> * server.c: Include sefltest.h and selftest.c. >> (captured_main): Handle option --self-test. >> gdb: >>=20 >> 2017-05-26 Yao Qi >>=20 >> * selftest.c: Adjust it for GDBserver. >>=20 >> gdb/testsuite: >>=20 >> 2017-05-26 Yao Qi >>=20 >> * gdb.server/unittest.exp: New. > > I like the idea of running unit tests in gdbserver > (and we briefly discussed it when we introduced selftest-arch.c > IIRC). Yes, we discussed this _idea_ before, but we didn't know how to do the unit tests in GDBserver. I remembered that some one said GDBserver unit tests can be triggered by a special packet sent by GDB. When I wrote this patch, it was still an open question to me. I chose a new command line option to trigger the tests, post this patch, and see if people like this way. > > But I don't know whether you're proposing the patch as > is, or whether it's really just for comments on the idea. The latter. The whole patch series is about collecting comments on the flexible target description, and GDBserver unit tests are used to make sure my patches don't break target descriptions on GDBserver. It is of hacks, and I'll fix them in v3, definitely. > I say this because there are several hacks in the patch > that ideally we'd avoid. > >> +#include "../selftest.h" >> +#include "../selftest.c" > > E.g., we should really move these to common/ and void > the #ifdefery within them. > Yes, I'll move them to common/. >> +global server_spawn_id >> + >> +set gdbserver [find_gdbserver] >> +set gdbserver_command "$gdbserver --self-test" >> + >> +set server_spawn_id [remote_spawn target $gdbserver_command] >> + >> +gdb_expect { >> + -i $server_spawn_id >> + -re "Ran $decimal unit tests, 0 failed" { >> + pass "unit tests" >> + } >> + -re "Ran $decimal unit tests, $decimal failed" { >> + fail "unit tests" >> + } > > Shouldn't this have a "default" case that fails instead > of only handling one specific failure mode? OK, I'll fix it too. --=20 Yao (=E9=BD=90=E5=B0=A7)