Merge lp:~liuyq0307/lava-dispatcher/fix-1195536 into lp:lava-dispatcher

Proposed by Yongqin Liu
Status: Merged
Merged at revision: 633
Proposed branch: lp:~liuyq0307/lava-dispatcher/fix-1195536
Merge into: lp:lava-dispatcher
Diff against target: 185 lines (+53/-38)
5 files modified
lava_dispatcher/config.py (+2/-2)
lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x1-a7x1.conf (+13/-7)
lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x4-a7x4.conf (+12/-6)
lava_dispatcher/device/fastmodel.py (+22/-19)
lava_dispatcher/device/target.py (+4/-4)
To merge this branch: bzr merge lp:~liuyq0307/lava-dispatcher/fix-1195536
Reviewer Review Type Date Requested Status
Tyler Baker Approve
Review via email: mp+171954@code.launchpad.net

Description of the change

1. fix the bug in _find_and_copy function,
     we should use the root to genertate the src path
2. rename the file variable to file_name,
     since file is a keyword of python

To post a comment you must log in.
Revision history for this message
Yongqin Liu (liuyq0307) wrote :

One thing I am not sure is that if I should change the usage of _copy_needed_files_from_partition method in deploy_android method of lava_dispatcher/device/fastmodel.py file.

it is called as such in the deploy_linaro method:
self._copy_needed_files_from_directory(odir)
self._copy_needed_files_from_partition(self.config.boot_part, 'rtsm')
self._copy_needed_files_from_partition(self.config.root_part, 'boot')

but called like this in the deploy_android method:
self._copy_needed_files_from_partition(self.config.boot_part, '')

if we add following line to the deploy_android method, I guess it will work too.
self._copy_needed_files_from_partition(self.config.boot_part, 'rtsm')

but do we really need to specify the second parameter?

Revision history for this message
Tyler Baker (tyler-baker) wrote :

Thanks for fixing these issue I introduced :)

However the issue still persists:

http://www.nwdrone.com/scheduler/job/1331

review: Approve
633. By Yongqin Liu

remove the directory of axf file path specified for simulator_axf_files
based on the thought like this:
we do not have much files in the boot partition,
and there will be no files with the same base name under different directory

634. By Yongqin Liu

change for copy necessary uImage and uInitrd files

635. By Yongqin Liu

fix the error about parameter of _copy_first_find_from_list

636. By Yongqin Liu

fix some other bugs

Revision history for this message
Tyler Baker (tyler-baker) wrote :

Still in the process of testing these changes again.

One small issue I've encountered:

- simulator_kernel = schema.StringOption(default=None)
- simulator_initrd = schema.StringOption(default=None)
+ simulator_kernel_files = schema.ListOption(default=None)
+ simulator_initrd_files = schema.ListOption(default=None)

review: Needs Fixing
Revision history for this message
Tyler Baker (tyler-baker) wrote :

With the changes mentioned above, I confirmed this fix is now working properly.

Revision history for this message
Tyler Baker (tyler-baker) wrote :

We should also update the device-types for the following:

rtsm_foundation-armv8

rtsm_ve-armv8

637. By Yongqin Liu

fix the bug of definition of simulator_kernel_files and simulator_initrd_files

Revision history for this message
Yongqin Liu (liuyq0307) wrote :

Hi, Tyler

I updated the definition of simulator_initrd_files and simulator_kernel_files according to your comments.
Please check that.

> We should also update the device-types for the following:
>
> rtsm_foundation-armv8
>
> rtsm_ve-armv8
For the above comments, sorry, I am not very clear about what to do.
Why should we update these two device types.

They don't need to specify the simulator_initrd_files and simulator_kernel_files now.

638. By Yongqin Liu

fix bug of use of simulator_kernel and simulator_initrd

Revision history for this message
Tyler Baker (tyler-baker) wrote :

> Hi, Tyler
>
> I updated the definition of simulator_initrd_files and simulator_kernel_files
> according to your comments.
> Please check that.
>
> > We should also update the device-types for the following:
> >
> > rtsm_foundation-armv8
> >
> > rtsm_ve-armv8
> For the above comments, sorry, I am not very clear about what to do.
> Why should we update these two device types.
>
> They don't need to specify the simulator_initrd_files and
> simulator_kernel_files now.

At this point they do not. However in the future they will need to ;) We can do this work now or later, I just thought it might be nice to have them updated now.

Revision history for this message
Tyler Baker (tyler-baker) :
review: Approve
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

File is not a keyword in python.

It is okay to use, it might be confusing sometimes though

Thanks
ZK
2 lip 2013 17:08, "Tyler Baker" <email address hidden> napisał(a):

> Review: Approve
>
>
> --
>
> https://code.launchpad.net/~liuyq0307/lava-dispatcher/fix-1195536/+merge/171954
> You are subscribed to branch lp:lava-dispatcher.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lava_dispatcher/config.py'
2--- lava_dispatcher/config.py 2013-06-20 15:37:54 +0000
3+++ lava_dispatcher/config.py 2013-07-01 10:49:37 +0000
4@@ -85,8 +85,8 @@
5 simulator_version_command = schema.StringOption()
6 simulator_command = schema.StringOption()
7 simulator_axf_files = schema.ListOption()
8- simulator_kernel = schema.StringOption(default=None)
9- simulator_initrd = schema.StringOption(default=None)
10+ simulator_kernel_files = schema.ListOption(default=None)
11+ simulator_initrd_files = schema.ListOption(default=None)
12 simulator_dtb = schema.StringOption(default=None)
13 simulator_uefi = schema.StringOption(default=None)
14 simulator_boot_wrapper = schema.StringOption(default=None)
15
16=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x1-a7x1.conf'
17--- lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x1-a7x1.conf 2013-06-19 16:22:43 +0000
18+++ lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x1-a7x1.conf 2013-07-01 10:49:37 +0000
19@@ -45,17 +45,23 @@
20 sendline 2
21
22 simulator_axf_files =
23- img.axf
24- linux-system-ISW.axf
25- rtsm/linux-system-semi.axf
26-
27-simulator_kernel = vmlinuz.*
28-simulator_initrd = initrd.*
29+ img.axf
30+ linux-system-ISW.axf
31+ linux-system-semi.axf
32+
33+simulator_kernel_files =
34+ uImage
35+ vmlinuz.*
36+
37+simulator_initrd_files =
38+ uInitrd
39+ initrd.*
40+
41 simulator_dtb = rtsm_ve-ca15x1-ca7x1.dtb
42 simulator_uefi = uefi_rtsm_ve-ca15.bin
43
44 license_file = 8224@localhost
45-sim_bin = /opt/arm/RTSM_A15-A7x14_VE/Linux64_RTSM_VE_Cortex-A15x4-A7x4/RTSM_VE_Cortex-A15x4-A7x4
46+sim_bin = /opt/arm/RTSM_A15-A7x14_VE/Linux64_RTSM_VE_Cortex-A15x1-A7x1/RTSM_VE_Cortex-A15x1-A7x1
47 android_adb_port = 6555
48
49 simulator_version_command = %(sim_bin)s --version | grep "Fast Models" | sed 's/Fast Models \[//' | sed 's/\]//'
50
51=== modified file 'lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x4-a7x4.conf'
52--- lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x4-a7x4.conf 2013-06-19 16:22:43 +0000
53+++ lava_dispatcher/default-config/lava-dispatcher/device-types/rtsm_ve-a15x4-a7x4.conf 2013-07-01 10:49:37 +0000
54@@ -45,12 +45,18 @@
55 sendline 2
56
57 simulator_axf_files =
58- img.axf
59- linux-system-ISW.axf
60- rtsm/linux-system-semi.axf
61-
62-simulator_kernel = vmlinuz.*
63-simulator_initrd = initrd.*
64+ img.axf
65+ linux-system-ISW.axf
66+ linux-system-semi.axf
67+
68+simulator_kernel_files =
69+ uImage
70+ vmlinuz.*
71+
72+simulator_initrd_files =
73+ uInitrd
74+ initrd.*
75+
76 simulator_dtb = rtsm_ve-ca15x4-ca7x4.dtb
77 simulator_uefi = uefi_rtsm_ve-ca15.bin
78
79
80=== modified file 'lava_dispatcher/device/fastmodel.py'
81--- lava_dispatcher/device/fastmodel.py 2013-06-25 10:50:02 +0000
82+++ lava_dispatcher/device/fastmodel.py 2013-07-01 10:49:37 +0000
83@@ -23,10 +23,8 @@
84 import cStringIO
85 import logging
86 import os
87-import shutil
88 import stat
89 import subprocess
90-import re
91
92 import lava_dispatcher.device.boot_options as boot_options
93
94@@ -48,7 +46,6 @@
95 ensure_directory,
96 extract_targz,
97 DrainConsoleOutput,
98- string_to_list,
99 )
100
101
102@@ -93,24 +90,30 @@
103 subdir = os.path.join(mntdir, subdir)
104 self._copy_needed_files_from_directory(subdir)
105
106+ def _copy_first_find_from_list(self, subdir, odir, file_list):
107+ f_path = None
108+ for fname in file_list:
109+ f_path = self._find_and_copy(subdir, odir, fname)
110+ if f_path:
111+ break
112+
113+ return f_path
114+
115 def _copy_needed_files_from_directory(self, subdir):
116 odir = os.path.dirname(self._sd_image)
117 if self._bootloader == 'u_boot':
118 # Extract the bootwrapper from the image
119- for fname in self.config.simulator_axf_files:
120- if self._axf is None:
121- self._axf = self._find_and_copy(
122- subdir, odir, fname)
123- else:
124- break
125+ if self.config.simulator_axf_files and self._axf is None:
126+ self._axf = self._copy_first_find_from_list(subdir, odir,
127+ self.config.simulator_axf_files)
128 # Extract the kernel from the image
129- if self.config.simulator_kernel and self._kernel is None:
130- self._kernel = self._find_and_copy(
131- subdir, odir, self.config.simulator_kernel)
132+ if self.config.simulator_kernel_files and self._kernel is None:
133+ self._kernel = self._copy_first_find_from_list(subdir, odir,
134+ self.config.simulator_kernel_files)
135 # Extract the initrd from the image
136- if self.config.simulator_initrd and self._initrd is None:
137- self._initrd = self._find_and_copy(
138- subdir, odir, self.config.simulator_initrd)
139+ if self.config.simulator_initrd_files and self._initrd is None:
140+ self._initrd = self._copy_first_find_from_list(subdir, odir,
141+ self.config.simulator_initrd_files)
142 # Extract the dtb from the image
143 if self.config.simulator_dtb and self._dtb is None:
144 self._dtb = self._find_and_copy(
145@@ -128,13 +131,13 @@
146 raise RuntimeError('No AXF found, %r' %
147 self.config.simulator_axf_files)
148 # Kernel is needed only for b.L models
149- if self._kernel is None and self.config.simulator_kernel:
150+ if self._kernel is None and self.config.simulator_kernel_files:
151 raise RuntimeError('No KERNEL found, %r' %
152- self.config.simulator_kernel)
153+ self.config.simulator_kernel_files)
154 # Initrd is needed only for b.L models
155- if self._initrd is None and self.config.simulator_initrd:
156+ if self._initrd is None and self.config.simulator_initrd_files:
157 raise RuntimeError('No INITRD found, %r' %
158- self.config.simulator_initrd)
159+ self.config.simulator_initrd_files)
160 # DTB is needed only for b.L models
161 if self._dtb is None and self.config.simulator_dtb:
162 raise RuntimeError('No DTB found, %r' %
163
164=== modified file 'lava_dispatcher/device/target.py'
165--- lava_dispatcher/device/target.py 2013-06-19 21:49:04 +0000
166+++ lava_dispatcher/device/target.py 2013-07-01 10:49:37 +0000
167@@ -158,14 +158,14 @@
168 def _find_and_copy(self, rootdir, odir, pattern, name=None):
169 dest = None
170 for root, dirs, files in os.walk(rootdir):
171- for file in files:
172- if re.match(pattern, file):
173+ for file_name in files:
174+ if re.match(pattern, file_name):
175 if name:
176 dest = os.path.join(odir, name)
177 else:
178- dest = os.path.join(odir, file)
179+ dest = os.path.join(odir, file_name)
180 if rootdir != odir:
181- src = os.path.join(rootdir, file)
182+ src = os.path.join(root, file_name)
183 shutil.copyfile(src, dest)
184 return dest
185 else:

Subscribers

People subscribed via source and target branches