From 86d30d756a60d181a95cf07041920a367a0cd0ba Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 18 Jun 2015 15:14:16 +0100 Subject: meta: Add explict getVar param for (non) expansion Rather than just use d.getVar(X), use the more explict d.getVar(X, False) since at some point in the future, having the default of expansion would be nice. This is the first step towards that. This patch was mostly made using the command: sed -e 's:\(getVar([^,()]*\)\s*):\1, False):g' -i `grep -ril getVar *` (From OE-Core rev: ab7c1d239b122c8e549e8112c88fd46c9e2b061b) Signed-off-by: Richard Purdie --- meta/lib/oeqa/controllers/masterimage.py | 6 +++--- meta/lib/oeqa/runtime/skeletoninit.py | 4 ++-- meta/lib/oeqa/runtime/syslog.py | 4 ++-- meta/lib/oeqa/targetcontrol.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'meta/lib/oeqa') diff --git a/meta/lib/oeqa/controllers/masterimage.py b/meta/lib/oeqa/controllers/masterimage.py index 311f0cf68c..522f9ebd76 100644 --- a/meta/lib/oeqa/controllers/masterimage.py +++ b/meta/lib/oeqa/controllers/masterimage.py @@ -52,7 +52,7 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget): # test rootfs + kernel self.image_fstype = self.get_image_fstype(d) self.rootfs = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + '.' + self.image_fstype) - self.kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("KERNEL_IMAGETYPE") + '-' + d.getVar('MACHINE') + '.bin') + self.kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("KERNEL_IMAGETYPE", False) + '-' + d.getVar('MACHINE', False) + '.bin') if not os.path.isfile(self.rootfs): # we could've checked that IMAGE_FSTYPES contains tar.gz but the config for running testimage might not be # the same as the config with which the image was build, ie @@ -73,10 +73,10 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget): # e.g: TEST_POWERCONTROL_CMD = "/home/user/myscripts/powercontrol.py ${MACHINE} what-ever-other-args-the-script-wants" # the command should take as the last argument "off" and "on" and "cycle" (off, on) self.powercontrol_cmd = d.getVar("TEST_POWERCONTROL_CMD", True) or None - self.powercontrol_args = d.getVar("TEST_POWERCONTROL_EXTRA_ARGS") or "" + self.powercontrol_args = d.getVar("TEST_POWERCONTROL_EXTRA_ARGS", False) or "" self.serialcontrol_cmd = d.getVar("TEST_SERIALCONTROL_CMD", True) or None - self.serialcontrol_args = d.getVar("TEST_SERIALCONTROL_EXTRA_ARGS") or "" + self.serialcontrol_args = d.getVar("TEST_SERIALCONTROL_EXTRA_ARGS", False) or "" self.origenv = os.environ if self.powercontrol_cmd or self.serialcontrol_cmd: diff --git a/meta/lib/oeqa/runtime/skeletoninit.py b/meta/lib/oeqa/runtime/skeletoninit.py index 7c7f402e5d..cb0cb9b4cf 100644 --- a/meta/lib/oeqa/runtime/skeletoninit.py +++ b/meta/lib/oeqa/runtime/skeletoninit.py @@ -13,7 +13,7 @@ def setUpModule(): class SkeletonBasicTest(oeRuntimeTest): @skipUnlessPassed('test_ssh') - @unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager"), "Not appropiate for systemd image") + @unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", False), "Not appropiate for systemd image") def test_skeleton_availability(self): (status, output) = self.target.run('ls /etc/init.d/skeleton') self.assertEqual(status, 0, msg = "skeleton init script not found. Output:\n%s " % output) @@ -22,7 +22,7 @@ class SkeletonBasicTest(oeRuntimeTest): @testcase(284) @skipUnlessPassed('test_skeleton_availability') - @unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager"), "Not appropiate for systemd image") + @unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", False), "Not appropiate for systemd image") def test_skeleton_script(self): output1 = self.target.run("/etc/init.d/skeleton start")[1] (status, output2) = self.target.run(oeRuntimeTest.pscmd + ' | grep [s]keleton-test') diff --git a/meta/lib/oeqa/runtime/syslog.py b/meta/lib/oeqa/runtime/syslog.py index 7fa018e97f..5d0f548c99 100644 --- a/meta/lib/oeqa/runtime/syslog.py +++ b/meta/lib/oeqa/runtime/syslog.py @@ -29,7 +29,7 @@ class SyslogTestConfig(oeRuntimeTest): @skipUnlessPassed("test_syslog_running") def test_syslog_restart(self): - if "systemd" != oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager"): + if "systemd" != oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", False): (status,output) = self.target.run('/etc/init.d/syslog restart') else: (status,output) = self.target.run('systemctl restart syslog.service') @@ -37,7 +37,7 @@ class SyslogTestConfig(oeRuntimeTest): @testcase(202) @skipUnlessPassed("test_syslog_restart") @skipUnlessPassed("test_syslog_logger") - @unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager"), "Not appropiate for systemd image") + @unittest.skipIf("systemd" == oeRuntimeTest.tc.d.getVar("VIRTUAL-RUNTIME_init_manager", False), "Not appropiate for systemd image") def test_syslog_startup_config(self): self.target.run('echo "LOGFILE=/var/log/test" >> /etc/syslog-startup.conf') (status,output) = self.target.run('/etc/init.d/syslog restart') diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py index 9a681a3674..60b09b2cb2 100644 --- a/meta/lib/oeqa/targetcontrol.py +++ b/meta/lib/oeqa/targetcontrol.py @@ -121,7 +121,7 @@ class QemuTarget(BaseTarget): self.qemulog = os.path.join(self.testdir, "qemu_boot_log.%s" % self.datetime) self.origrootfs = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("IMAGE_LINK_NAME", True) + '.' + self.image_fstype) self.rootfs = os.path.join(self.testdir, d.getVar("IMAGE_LINK_NAME", True) + '-testimage.' + self.image_fstype) - self.kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("KERNEL_IMAGETYPE") + '-' + d.getVar('MACHINE') + '.bin') + self.kernel = os.path.join(d.getVar("DEPLOY_DIR_IMAGE", True), d.getVar("KERNEL_IMAGETYPE", False) + '-' + d.getVar('MACHINE', False) + '.bin') if d.getVar("DISTRO", True) == "poky-tiny": self.runner = QemuTinyRunner(machine=d.getVar("MACHINE", True), -- cgit v1.2.3-54-g00ecf