diff options
Diffstat (limited to 'yocto-poky/bitbake/lib/bb/tests/utils.py')
-rw-r--r-- | yocto-poky/bitbake/lib/bb/tests/utils.py | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/yocto-poky/bitbake/lib/bb/tests/utils.py b/yocto-poky/bitbake/lib/bb/tests/utils.py index a035ccf17..2f4ccf3c6 100644 --- a/yocto-poky/bitbake/lib/bb/tests/utils.py +++ b/yocto-poky/bitbake/lib/bb/tests/utils.py @@ -23,6 +23,7 @@ import unittest import bb import os import tempfile +import re class VerCmpString(unittest.TestCase): @@ -176,7 +177,7 @@ do_functionname() { # Test file doesn't get modified with some the same values self._testeditfile({'THIS': ('that', None, 0, True), 'OTHER': ('anothervalue', None, 0, True), - 'MULTILINE3': (' c1 c2 c3', None, 4, False)}, self._origfile) + 'MULTILINE3': (' c1 c2 c3 ', None, 4, False)}, self._origfile) def test_edit_metadata_file_1(self): @@ -377,6 +378,27 @@ do_functionname() { self.assertTrue(updated, 'List should be updated but isn\'t') self.assertEqual(newlines, newfile5.splitlines(True)) + # Make sure the orig value matches what we expect it to be + def test_edit_metadata_origvalue(self): + origfile = """ +MULTILINE = " stuff \\ + morestuff" +""" + expected_value = "stuff morestuff" + global value_in_callback + value_in_callback = "" + + def handle_var(varname, origvalue, op, newlines): + global value_in_callback + value_in_callback = origvalue + return (origvalue, op, -1, False) + + bb.utils.edit_metadata(origfile.splitlines(True), + ['MULTILINE'], + handle_var) + + testvalue = re.sub('\s+', ' ', value_in_callback.strip()) + self.assertEqual(expected_value, testvalue) class EditBbLayersConf(unittest.TestCase): |