> This is the dispatcher part of the device version support implementation.
>
> You will notice that the master image part is not done, since I could
> not get my board to work yet. In the current state of the code, master
> image devices will always return 'unknown' as their device versions.
This looks mostly fine, thanks! Just a couple of comments.
Not sure this is the right thing to do -- should we not parse the
-version of the qemu binary we actually use, which might not be the
packaged version?
> target_class = QEMUTarget
>
> === added file 'lava_dispatcher/tests/test_device_version.py'
> --- lava_dispatcher/tests/test_device_version.py 1970-01-01 00:00:00 +0000
> +++ lava_dispatcher/tests/test_device_version.py 2012-10-18 17:49:26 +0000
> @@ -0,0 +1,59 @@
> +# Copyright (C) 2012 Linaro Limited
> +#
> +# Author: Antonio Terceiro <email address hidden>
> +#
> +# This file is part of LAVA Dispatcher.
> +#
> +# LAVA Dispatcher is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# LAVA Dispatcher is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, see <http://www.gnu.org/licenses>.
> +
> +from unittest import TestCase
> +import re
> +from lava_dispatcher.tests.helper import LavaDispatcherTestCase, create_device_config
> +
> +from lava_dispatcher.device.target import Target
> +from lava_dispatcher.device.qemu import QEMUTarget
> +from lava_dispatcher.device.fastmodel import FastModelTarget
> +
> +def _create_fastmodel():
> + config = create_device_config('fastmodel01', { 'device_type': 'fastmodel', 'simulator_binary': '/path/to/fastmodel', 'license_server': 'foo.local' })
> + target = FastModelTarget(None, config)
> + return target
Could you call this _create_fastmodel_target() do you think?
Antonio Terceiro <email address hidden> writes:
> This is the dispatcher part of the device version support implementation.
>
> You will notice that the master image part is not done, since I could
> not get my board to work yet. In the current state of the code, master
> image devices will always return 'unknown' as their device versions.
This looks mostly fine, thanks! Just a couple of comments.
> === modified file 'lava_dispatche r/device/ qemu.py' --- /device/ qemu.py 2012-10-17 16:52:05 +0000 +++ /device/ qemu.py 2012-10-18 17:49:26 +0000 @@ -20,6 .device. target import ( spawn(qemu_ cmd, logfile=self.sio, timeout=1200) version( self): check_output( ["dpkg- query", "--showformat= ${Version} ", "--show", "qemu-system"]) CalledProcessEr ror:
> lava_dispatcher
> lava_dispatcher
> +20,7 @@
>
> import contextlib
> import logging
> +import subprocess
>
> from lava_dispatcher
> Target
> @@ -76,4 +77,10 @@
> proc = logging_
> return proc
>
> + def get_device_
> + try:
> + return subprocess.
> + except subprocess.
> + return "unknown"
Not sure this is the right thing to do -- should we not parse the
-version of the qemu binary we actually use, which might not be the
packaged version?
> target_class = QEMUTarget
>
> === added file 'lava_dispatche r/tests/ test_device_ version. py' /tests/ test_device_ version. py 1970-01-01 00:00:00 +0000 /tests/ test_device_ version. py 2012-10-18 17:49:26 +0000 www.gnu. org/licenses>. .tests. helper import LavaDispatcherT estCase, create_ device_ config .device. target import Target .device. qemu import QEMUTarget .device. fastmodel import FastModelTarget fastmodel( ): device_ config( 'fastmodel01' , { 'device_type': 'fastmodel', 'simulator_binary': '/path/ to/fastmodel' , 'license_server': 'foo.local' }) (None, config)
> --- lava_dispatcher
> +++ lava_dispatcher
> @@ -0,0 +1,59 @@
> +# Copyright (C) 2012 Linaro Limited
> +#
> +# Author: Antonio Terceiro <email address hidden>
> +#
> +# This file is part of LAVA Dispatcher.
> +#
> +# LAVA Dispatcher is free software; you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License as published by
> +# the Free Software Foundation; either version 2 of the License, or
> +# (at your option) any later version.
> +#
> +# LAVA Dispatcher is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, see <http://
> +
> +from unittest import TestCase
> +import re
> +from lava_dispatcher
> +
> +from lava_dispatcher
> +from lava_dispatcher
> +from lava_dispatcher
> +
> +def _create_
> + config = create_
> + target = FastModelTarget
> + return target
Could you call this _create_ fastmodel_ target( ) do you think?
> +class TestDeviceVersi on(LavaDispatch erTestCase) : type(target. get_device_ version( )) is str)
> +
> + def test_base(self):
> + target = Target(None, None)
> + assert(
It would be more Pythonic to write this as:
self.assertIsIn stance( target. get_device_ version( ), str)
> + def test_qemu(self): get_device_ version( ) re.search( '^[0-9. ]+', device_version)) self): Cortex_ A15x1_A7x1" _parse_ fastmodel_ version( banner) l('7.1. 36', version) wrong_format( self): _parse_ fastmodel_ version( 'random string') l('unknown' , version)
> + target = QEMUTarget(None, None)
> + device_version = target.
> + assert(
> +
> + def test_fastmodel(
> + banner = "\n".join([
> + "Fast Models [7.1.36 (May 17 2012)]",
> + "Copyright 2000-2012 ARM Limited.",
> + "All Rights Reserved.",
> + "Top component name: RTSM_VE_
> + ])
> + target = _create_fastmodel()
> + version = target.
> + self.assertEqua
> +
> + def test_fastmodel_
> + client = _create_fastmodel()
> + version = client.
> + self.assertEqua
> +
Thanks for writing tests for the new functionality!