[tbot] [Discussion] Calling tbot from within the source directory

Claudius Heine ch at denx.de
Thu Nov 29 07:15:22 UTC 2018

Hi Harald,

Quoting Harald Seiler (2018-11-28 17:40:09)
> Hi Claudius,
> On Wed, 2018-11-28 at 15:40 +0100, Harald Seiler wrote:
> > Hello Claudius,
> > 
> > On Wed, 2018-11-28 at 15:22 +0100, Claudius Heine wrote:
> > > Hi,
> > 
> > [...]
> > > 
> > > That is a bit tiresome. A `-C` parameter like git(1) has, would solve
> > > it, but I think accessing the source code via the cwd in the testcases
> > > as a fallback would be nice.
> > > 
> > > I might just be my different understanding of things. I like to be in
> > > the directory of the stuff that should be tested, not where the
> > > testcases are located. It also makes sense for me if multiple source
> > > directories need to be "tested" on the same hw.
> > > 
> > > What do you think about this?
> > 
> > Hmm, I never thought about running tbot from outside the "tbot-config"
> > directory.  If you feel like this is needed for your workflow to be
> > ergonomic, adding a -C parameter is definitely a good idea.  In terms
> > of implementation, I'd suggest simply changing the working directory
> > very early on in main if the -C parameter is present.
> I pushed a commit[1] implementing -C onto the development branch.  Please
> try it out and tell me if it works as you need it to.  (Completions
> should work as well! :)

Thx a lot for the fast response. I wasn't expecting to have some code
that fast.

My only issue with this the `-C` solution is that it would be nice to be
able to use the current working directory to refer to the code you want
to test in the testcases. Otherwise you will have to put the path to the
code inside the testcase and that makes sharing most testcases pretty
much impossible.

Or do you have another solution, that I am not aware of for this?

Setting environment variables for that is also a bit stupid and using an
additional parameter is also overkill. Imagine that:

    tbot -C /path/to/tbot-privat -l labs/my-lab.py -b boards/my-board \
      -S "$(pwd)" my_test_case

With `-S` as taking the path the the sources. Not as bad as the first
example, but still a bit overcomplicated IMO.

Otherwise if `-C` would work as a `change tbot configuration directory`,
then you could use the current working directory in your testcases, so
you would not need an additional parameter or environment variable to
point the the source-tree if you want to avoid having the path to it
inside the testcases.

I hope I made myself understandable, but I basically I would like to
kill multiple birds with one stone:

 1. Make calling tbot from outside the tbot configuration directory
 2. Make it possible to use cwd inside testcases to point to the
 source-tree -> make it easier to reuse/share testcases because they
 would not need to contain the path to the source tree anymore.
 3. Do this without need of any tbot configuration files or environment
 variables or additional parameters.

But of course this would change how tbot is used. Instead of always
having the cwd inside the tbot configuration directory you would call
tbot from the source-tree. IMO it makes more sense to call tbot from the
source-tree than from the tbot configuration, since the primary work
should be done while in the source-tree. But to discuss that I started
this thread.


> [1]: https://github.com/Rahix/tbot/commit/a2afa7c641f87c9cf4de6616a6136ca16a4650d3

> -- 
> Harald
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-62  Fax: +49-8142-66989-80   Email: hws at denx.de

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-54 Fax: (+49)-8142-66989-80 Email: ch at denx.de

           PGP key: 6FF2 E59F 00C6 BC28 31D8 64C1 1173 CB19 9808 B153
                             Keyserver: hkp://pool.sks-keyservers.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: signature
URL: <http://lists.denx.de/pipermail/tbot/attachments/20181129/edd91314/attachment.sig>

More information about the tbot mailing list