From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by sourceware.org (Postfix) with ESMTPS id 28CF83858C2C for ; Wed, 16 Feb 2022 15:25:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 28CF83858C2C From: Hans-Peter Nilsson To: Mike Frysinger CC: In-Reply-To: (message from Mike Frysinger on Wed, 16 Feb 2022 02:09:44 -0500) Subject: Re: [PATCH 06/12] sim/testsuite: Support "requires: simoption <--name-of-option>" MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT References: <20220214225824.AC90A20439@pchp3.se.axis.com> <20220214230356.BA97820439@pchp3.se.axis.com> <20220216062451.703AD2040B@pchp3.se.axis.com> Message-ID: <20220216152553.55B5620414@pchp3.se.axis.com> Date: Wed, 16 Feb 2022 16:25:53 +0100 X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Feb 2022 15:25:57 -0000 > Date: Wed, 16 Feb 2022 02:09:44 -0500 > From: Mike Frysinger > On 16 Feb 2022 07:24, Hans-Peter Nilsson wrote: > > Date: Tue, 15 Feb 2022 23:49:47 -0500 From: Mike Frysinger > > > On 15 Feb 2022 00:03, Hans-Peter Nilsson via Gdb-patches wrote: > > > > Simulator features can be present or not, typically > > > > depending on different-valued configure options, like > > > > --enable-sim-hardware[=off|=on]. To avoid failures in > > > > test-suite-runs when testing such configurations, a new > > > > predicate is needed, as neither "target", "progos" nor > > > > "mach" fits cleanly. > > > > > > > > The immediate need was to check for presence of a simulator > > > > option, but rather than a specialized "requires-simoption:" > > > > predicate I thought I'd handle the general (parametrized) > > > > need, so here's a generic predicate machinery and a (first) > > > > predicate to use together with it; checking whether a > > > > particular option is supported, by looking at "run --help" > > > > output. This was inspired by the check_effective_target_ > > > > machinery in the gcc test-suite. > > > > > > i really don't want --help to be an API surface like this. it's the wrong > > > layer for the job. > > > > > > we have a sim_config_print function which dumps configuration information. > > > i'd be fine making that the surface to build off of. i don't think we > > > print hardware there atm, but should be trivial to introduce. > > > > > > only other missing piece is that it's not obvious how to access it from > > > the CLI. `run --version` doesn't include it. `run --do-command version` > > > does though :x. i'd be amenable to improving this interface, either by a > > > new option like --info-config or some other route. > > > > But, "run --version" is a check for the *option* to exist, > > which exactly meets the need. You describe a probe for a > > particular *configuration*, which is arguably useful, but > > not for checking whether a particular option is supported. > > i think you misunderstand. (Methinks it's the other way round.) > you're basically running: > run --help | grep -e--option > where --option is some functionality you care about. Right, the option *needs to be supported*. *How* it's implemented is secondary. > i'm saying --help is not an interface. it should be free to change and > reformat things as makes sense and not worry about > testsuites breaking. If that format happens, that'll be handled just like any other change, with the test-suite adjusted. It's not like the --help output format changes very often. The same argument can also be used for your proposed "run --do-command version", which has actually changed in the last 10 years, so I don't see this argument as for or against anything. > in the case of a multitarget binary, we probably wouldn't display all the > options in a single page, but have arch-specific sections. And sim_check_requires_simoption would then be altered to filter-in the subtarget-specific section for the subtarget being tested, no biggie. I can also imagine that it may happen without further action just by changing all "run" to "run $subtarget" or $run_subtarget everywhere in the test-suite if/when you go multitarget-binary. > i'm proposing: > run --do-command version | grep > where in this case you seem to care about hardware support being enabled. > so the test would look like: > # requires: simoption WITH_HW That would be fine (except for s/simoption/configoption/) if I was actually testing something that was *necessarily* linked to WITH_HW, and perhaps not even reflected in the presence of a run-time simulator option. Here, I'm testing the functionality of an option that just *happens* to be linked to --enable/--disable-sim-hardware! As you surely remember, it used to be a whole different module. To wit, my main point is that the test itself shouldn't have to care about the implementation or dependent config options; it should just mention the exact options that it uses, when that presence may depend on something unknown (perhaps something other than a configure-time option), just as the current version does. brgds, H-P