* [Buildroot] [PATCHv3] support/tests: allow properly indented config fragment
@ 2017-07-18 20:38 Yann E. MORIN
2017-07-18 21:47 ` Thomas Petazzoni
2017-07-19 12:00 ` Arnout Vandecappelle
0 siblings, 2 replies; 4+ messages in thread
From: Yann E. MORIN @ 2017-07-18 20:38 UTC (permalink / raw)
To: buildroot
Currently, defining a config fragment in the runtime test infra requires
that the fragment not to be indented. This is beark, and causes grievance
when looking at the code (e.g. to fix it).
Just strip out all leading spaces/tabs when writing the configuration
lines into the config file, allowing in-line indented config fragments,
like so:
class TestFoo(bla):
config = bla.config + \
"""
FOO=y
# BAR is not set
"""
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
---
Changes v2 -> v3:
- use and fix code snippet provided by Arnout, thanks! ;-)
- do it in our base test class, not on the builder class (Arnout)
Changes v1 -> v2:
- add example in commit log (Thomas)
---
support/testing/infra/basetest.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py
index 1a082bb441..07c180e232 100644
--- a/support/testing/infra/basetest.py
+++ b/support/testing/infra/basetest.py
@@ -41,6 +41,7 @@ class BRTest(unittest.TestCase):
self.testname = self.__class__.__name__
self.builddir = self.outputdir and os.path.join(self.outputdir, self.testname)
self.emulator = None
+ self.config = '\n'.join([line.lstrip() for line in self.config.splitlines()])
def show_msg(self, msg):
print "{} {:40s} {}".format(datetime.datetime.now().strftime("%H:%M:%S"),
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* [Buildroot] [PATCHv3] support/tests: allow properly indented config fragment
2017-07-18 20:38 [Buildroot] [PATCHv3] support/tests: allow properly indented config fragment Yann E. MORIN
@ 2017-07-18 21:47 ` Thomas Petazzoni
2017-07-19 12:00 ` Arnout Vandecappelle
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2017-07-18 21:47 UTC (permalink / raw)
To: buildroot
Hello,
On Tue, 18 Jul 2017 22:38:39 +0200, Yann E. MORIN wrote:
> Currently, defining a config fragment in the runtime test infra requires
> that the fragment not to be indented. This is beark, and causes grievance
> when looking at the code (e.g. to fix it).
>
> Just strip out all leading spaces/tabs when writing the configuration
> lines into the config file, allowing in-line indented config fragments,
> like so:
>
> class TestFoo(bla):
> config = bla.config + \
> """
> FOO=y
> # BAR is not set
> """
>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>
>
> ---
> Changes v2 -> v3:
> - use and fix code snippet provided by Arnout, thanks! ;-)
> - do it in our base test class, not on the builder class (Arnout)
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCHv3] support/tests: allow properly indented config fragment
2017-07-18 20:38 [Buildroot] [PATCHv3] support/tests: allow properly indented config fragment Yann E. MORIN
2017-07-18 21:47 ` Thomas Petazzoni
@ 2017-07-19 12:00 ` Arnout Vandecappelle
2017-07-19 12:13 ` Thomas Petazzoni
1 sibling, 1 reply; 4+ messages in thread
From: Arnout Vandecappelle @ 2017-07-19 12:00 UTC (permalink / raw)
To: buildroot
On 18-07-17 22:38, Yann E. MORIN wrote:
> Currently, defining a config fragment in the runtime test infra requires
> that the fragment not to be indented. This is beark, and causes grievance
> when looking at the code (e.g. to fix it).
>
> Just strip out all leading spaces/tabs when writing the configuration
> lines into the config file, allowing in-line indented config fragments,
> like so:
>
> class TestFoo(bla):
> config = bla.config + \
> """
> FOO=y
> # BAR is not set
> """
>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
>
> ---
> Changes v2 -> v3:
> - use and fix code snippet provided by Arnout, thanks! ;-)
> - do it in our base test class, not on the builder class (Arnout)
>
> Changes v1 -> v2:
> - add example in commit log (Thomas)
> ---
> support/testing/infra/basetest.py | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py
> index 1a082bb441..07c180e232 100644
> --- a/support/testing/infra/basetest.py
> +++ b/support/testing/infra/basetest.py
> @@ -41,6 +41,7 @@ class BRTest(unittest.TestCase):
> self.testname = self.__class__.__name__
> self.builddir = self.outputdir and os.path.join(self.outputdir, self.testname)
> self.emulator = None
> + self.config = '\n'.join([line.lstrip() for line in self.config.splitlines()])
It would also be nice to move the setting of jlevel to the constructor. But
heck, there's probably a lot that would be nice to improve in the testing infra :-)
Regards,
Arnout
>
> def show_msg(self, msg):
> print "{} {:40s} {}".format(datetime.datetime.now().strftime("%H:%M:%S"),
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 4+ messages in thread* [Buildroot] [PATCHv3] support/tests: allow properly indented config fragment
2017-07-19 12:00 ` Arnout Vandecappelle
@ 2017-07-19 12:13 ` Thomas Petazzoni
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2017-07-19 12:13 UTC (permalink / raw)
To: buildroot
Hello,
On Wed, 19 Jul 2017 14:00:40 +0200, Arnout Vandecappelle wrote:
> On 18-07-17 22:38, Yann E. MORIN wrote:
> > Currently, defining a config fragment in the runtime test infra requires
> > that the fragment not to be indented. This is beark, and causes grievance
> > when looking at the code (e.g. to fix it).
> >
> > Just strip out all leading spaces/tabs when writing the configuration
> > lines into the config file, allowing in-line indented config fragments,
> > like so:
> >
> > class TestFoo(bla):
> > config = bla.config + \
> > """
> > FOO=y
> > # BAR is not set
> > """
> >
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > Cc: Arnout Vandecappelle <arnout@mind.be>
>
> Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
I already applied yesterday evening:
https://git.buildroot.org/buildroot/commit/?id=cf3cd4388a652c9af27ef1c35622e2d0a55b99a9.
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-07-19 12:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-18 20:38 [Buildroot] [PATCHv3] support/tests: allow properly indented config fragment Yann E. MORIN
2017-07-18 21:47 ` Thomas Petazzoni
2017-07-19 12:00 ` Arnout Vandecappelle
2017-07-19 12:13 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox