[PATCH xorg-gtest] xserver: if -config or -logfile is called with empty value, remove from args

Peter Hutterer peter.hutterer at who-t.net
Sun Oct 28 22:08:07 PDT 2012


On Fri, Oct 26, 2012 at 09:30:51AM -0700, Chase Douglas wrote:
> On Mon, Oct 22, 2012 at 7:02 PM, Peter Hutterer
> <peter.hutterer at who-t.net> wrote:
> > -logfile and -config are auto-filled for the default setup. A test that
> > needs no config file or the default log file must be able to unset those
> > defaults.
> >
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> >  src/xserver.cpp | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/xserver.cpp b/src/xserver.cpp
> > index 55efab1..29c0430 100644
> > --- a/src/xserver.cpp
> > +++ b/src/xserver.cpp
> > @@ -496,7 +496,11 @@ void xorg::testing::XServer::RemoveLogFile(bool force) {
> >  }
> >
> >  void xorg::testing::XServer::SetOption(const std::string &key, const std::string &value) {
> > -  d_->options[key] = value;
> > +  if (value.empty() &&
> > +      (key.compare("-logfile") == 0 || key.compare("-config") == 0)) {
> > +    d_->options.erase(key);
> > +  } else
> > +    d_->options[key] = value;
> >  }
> >
> >  const std::string& xorg::testing::XServer::GetLogFilePath() {
> 
> IIUC, this would require passing:
> 
> --logfile ""
> 
> That's a bit unwieldy, and it's a non-obvious way to cause no log
> file. Perhaps we should have a different set of options: --no-logfile
> and --no-config?

I've though of this again and rather than introducing new options that
don't exist it's better to add XServer::RemoveOption().

Cheers,
   Peter



More information about the xorg-devel mailing list