Skip to contentSkip to conversation

support/testing: rename variables for readability

PATCH New Luca Ceresoli 3 participants 6 messages May 27, 2017 – May 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 support/testing: rename variables for readability

The 'lines' variable is overwritten with its own fields. Thus it contains a line first, and then a list of fields -- it never contains 'lines'.

Use two different variables named 'line' and 'fields' to make the code more readable.

---
 support/testing/tests/fs/test_ext.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
support/testing/tests/fs/test_ext.py +4 -4
index f7e2e85055e1..d35eea8bb5fa 100644
@@ -21,10 +21,10 @@ def dumpe2fs_run(builddir, image):
     return ret.strip().splitlines()
 
 def dumpe2fs_getprop(out, prop):
-    for lines in out:
-        lines = lines.split(": ")
-        if lines[0] == prop:
-            return lines[1].strip()
+    for line in out:
+        fields = line.split(": ")
+        if fields[0] == prop:
+            return fields[1].strip()
 
 def boot_img_and_check_fs_type(emulator, builddir, fs_type):
     img = os.path.join(builddir, "images", "rootfs.{}".format(fs_type))
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 support/testing: fs/ext: add a negative test for the "extent" feature

We only have a positive test for it, in ext4. Let's have a negative one as well.

---
 support/testing/tests/fs/test_ext.py | 1 +
 1 file changed, 1 insertion(+)
support/testing/tests/fs/test_ext.py +1 -0
index d35eea8bb5fa..ea3d3f11d7e7 100644
@@ -86,6 +86,7 @@ BR2_TARGET_ROOTFS_EXT2_3=y
         out = dumpe2fs_run(self.builddir, "rootfs.ext3")
         self.assertEqual(dumpe2fs_getprop(out, REVISION_PROP), "1 (dynamic)")
         self.assertIn("has_journal", dumpe2fs_getprop(out, FEATURES_PROP))
+        self.assertNotIn("extent", dumpe2fs_getprop(out, FEATURES_PROP))
 
         exit_code = boot_img_and_check_fs_type(self.emulator,
                                                self.builddir, "ext3")
Signature · 1 line
2.7.4
#3 lore raw

PATCH 1/2 support/testing: rename variables for readability

In reply to Luca Ceresoli

Hello,

Quoted 8 lines · Luca Ceresoli

The 'lines' variable is overwritten with its own fields. Thus it contains a line first, and then a list of fields -- it never contains 'lines'.

Use two different variables named 'line' and 'fields' to make the code more readable.

Regards,
Ricardo

#4 lore raw

PATCH 1/2 support/testing: rename variables for readability

In reply to Luca Ceresoli

Hello,

Quoted 11 lines · Luca Ceresoli

The 'lines' variable is overwritten with its own fields. Thus it contains a line first, and then a list of fields -- it never contains 'lines'.

Use two different variables named 'line' and 'fields' to make the code more readable.

---
 support/testing/tests/fs/test_ext.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Both applied to master. Thanks!

For some reason, your first patch had a broken prefix: [PATH] instead of [PATCH]. I guess you hand-edited the patch, and made a typo?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#5 lore raw

PATCH 1/2 support/testing: rename variables for readability

Hi,

Quoted 10 lines · Thomas Petazzoni

Hello,

Quoted 7 lines · Luca Ceresoli

The 'lines' variable is overwritten with its own fields. Thus it contains a line first, and then a list of fields -- it never contains 'lines'.

Use two different variables named 'line' and 'fields' to make the code more readable.

Quoted 6 lines
Quoted 4 lines
---
 support/testing/tests/fs/test_ext.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Both applied to master. Thanks!

Thanks.

Quoted 2 lines

For some reason, your first patch had a broken prefix: [PATH] instead of [PATCH]. I guess you hand-edited the patch, and made a typo?

That's weird, sorry about that. But at times I open my patches with emacs just for a last-time check before I do git send-email. Perhaps I hit a few wrong keystrokes in that moment.

Maybe I should switch to an editor that is not editing files when it is started... :)

Signature · 1 line
Luca