support/testing: unbreak run-tests -l
authorArnout Vandecappelle <arnout@mind.be>
Mon, 10 Jul 2017 20:40:06 +0000 (22:40 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 10 Jul 2017 21:51:33 +0000 (23:51 +0200)
In commit b78b50465c20c1733753a8dd47945cf80c9155f8, the initialisation
of BRTest.builddir was moved to the __init__ function. However, it is
set based on BRTest.outputdir and that is only set when the -o argument
is given to run-tests. When called as "run-tests -l", there is no -o
argument so BRTest.outputdir remains unset.

To fix, keep BRTest.builddir at None when BRTest.outputdir is None.

While we're at it, drop the direct access to the class member. If a
subclass wishes to set outputdir to something else before calling
BRTest.__init__, they are free to do so.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reported-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
support/testing/infra/basetest.py

index 2a5c9ec939551390c47e6908502e416da9a98bbc..1a082bb4417bdfbe3b5b5b3fdd03c492e99fe4f4 100644 (file)
@@ -39,7 +39,7 @@ class BRTest(unittest.TestCase):
     def __init__(self, names):
         super(BRTest, self).__init__(names)
         self.testname = self.__class__.__name__
-        self.builddir = os.path.join(self.__class__.outputdir, self.testname)
+        self.builddir = self.outputdir and os.path.join(self.outputdir, self.testname)
         self.emulator = None
 
     def show_msg(self, msg):