diff options
author | Randy Witt <randy.e.witt@linux.intel.com> | 2016-04-06 23:55:40 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-04-09 23:00:46 +0100 |
commit | 7e739acfa781fd29fe030e425ecc32dc8402b896 (patch) | |
tree | 5c062f061d50662b881082af65901ad204d94652 /bitbake | |
parent | e1e459e480bc6a530cec6ed2718ce52d5ef93149 (diff) | |
download | openembedded-core-contrib-7e739acfa781fd29fe030e425ecc32dc8402b896.tar.gz |
bitbake: tests/utils.py: test origvalue in a callback matches what is expected
There were no tests that verified the value of origvalue in the callback
routines used by edit_metadata(). This patch adds one for a simple
multiline variable.
(Bitbake rev: ece3a4d02d8162dee78c2062c10291b5fd625c36)
Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/tests/utils.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/utils.py b/bitbake/lib/bb/tests/utils.py index 6ded4dfd13..2f4ccf3c62 100644 --- a/bitbake/lib/bb/tests/utils.py +++ b/bitbake/lib/bb/tests/utils.py @@ -23,6 +23,7 @@ import unittest import bb import os import tempfile +import re class VerCmpString(unittest.TestCase): @@ -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): |