diff options
Diffstat (limited to 'bitbake/lib/bb/tests')
| -rw-r--r-- | bitbake/lib/bb/tests/siggen.py | 77 |
1 files changed, 7 insertions, 70 deletions
diff --git a/bitbake/lib/bb/tests/siggen.py b/bitbake/lib/bb/tests/siggen.py index c21ab4e4fb..0dc67e6cc2 100644 --- a/bitbake/lib/bb/tests/siggen.py +++ b/bitbake/lib/bb/tests/siggen.py | |||
| @@ -17,75 +17,12 @@ import bb.siggen | |||
| 17 | 17 | ||
| 18 | class SiggenTest(unittest.TestCase): | 18 | class SiggenTest(unittest.TestCase): |
| 19 | 19 | ||
| 20 | def test_clean_basepath_simple_target_basepath(self): | 20 | def test_build_pnid(self): |
| 21 | basepath = '/full/path/to/poky/meta/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask' | 21 | tests = { |
| 22 | expected_cleaned = 'helloworld/helloworld_1.2.3.bb:do_sometask' | 22 | ('', 'helloworld', 'do_sometask') : 'helloworld:do_sometask', |
| 23 | ('XX', 'helloworld', 'do_sometask') : 'mc:XX:helloworld:do_sometask', | ||
| 24 | } | ||
| 23 | 25 | ||
| 24 | actual_cleaned = bb.siggen.clean_basepath(basepath) | 26 | for t in tests: |
| 27 | self.assertEqual(bb.siggen.build_pnid(*t), tests[t]) | ||
| 25 | 28 | ||
| 26 | self.assertEqual(actual_cleaned, expected_cleaned) | ||
| 27 | |||
| 28 | def test_clean_basepath_basic_virtual_basepath(self): | ||
| 29 | basepath = 'virtual:something:/full/path/to/poky/meta/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask' | ||
| 30 | expected_cleaned = 'helloworld/helloworld_1.2.3.bb:do_sometask:virtual:something' | ||
| 31 | |||
| 32 | actual_cleaned = bb.siggen.clean_basepath(basepath) | ||
| 33 | |||
| 34 | self.assertEqual(actual_cleaned, expected_cleaned) | ||
| 35 | |||
| 36 | def test_clean_basepath_mc_basepath(self): | ||
| 37 | basepath = 'mc:somemachine:/full/path/to/poky/meta/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask' | ||
| 38 | expected_cleaned = 'helloworld/helloworld_1.2.3.bb:do_sometask:mc:somemachine' | ||
| 39 | |||
| 40 | actual_cleaned = bb.siggen.clean_basepath(basepath) | ||
| 41 | |||
| 42 | self.assertEqual(actual_cleaned, expected_cleaned) | ||
| 43 | |||
| 44 | def test_clean_basepath_virtual_long_prefix_basepath(self): | ||
| 45 | basepath = 'virtual:something:A:B:C:/full/path/to/poky/meta/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask' | ||
| 46 | expected_cleaned = 'helloworld/helloworld_1.2.3.bb:do_sometask:virtual:something:A:B:C' | ||
| 47 | |||
| 48 | actual_cleaned = bb.siggen.clean_basepath(basepath) | ||
| 49 | |||
| 50 | self.assertEqual(actual_cleaned, expected_cleaned) | ||
| 51 | |||
| 52 | def test_clean_basepath_mc_virtual_basepath(self): | ||
| 53 | basepath = 'mc:somemachine:virtual:something:/full/path/to/poky/meta/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask' | ||
| 54 | expected_cleaned = 'helloworld/helloworld_1.2.3.bb:do_sometask:virtual:something:mc:somemachine' | ||
| 55 | |||
| 56 | actual_cleaned = bb.siggen.clean_basepath(basepath) | ||
| 57 | |||
| 58 | self.assertEqual(actual_cleaned, expected_cleaned) | ||
| 59 | |||
| 60 | def test_clean_basepath_mc_virtual_long_prefix_basepath(self): | ||
| 61 | basepath = 'mc:X:virtual:something:C:B:A:/full/path/to/poky/meta/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask' | ||
| 62 | expected_cleaned = 'helloworld/helloworld_1.2.3.bb:do_sometask:virtual:something:C:B:A:mc:X' | ||
| 63 | |||
| 64 | actual_cleaned = bb.siggen.clean_basepath(basepath) | ||
| 65 | |||
| 66 | self.assertEqual(actual_cleaned, expected_cleaned) | ||
| 67 | |||
| 68 | |||
| 69 | # def test_clean_basepath_performance(self): | ||
| 70 | # input_basepaths = [ | ||
| 71 | # 'mc:X:/full/path/to/poky/meta/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask', | ||
| 72 | # 'mc:X:virtual:something:C:B:A:/full/path/to/poky/meta/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask', | ||
| 73 | # 'virtual:something:C:B:A:/different/path/to/poky/meta/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask', | ||
| 74 | # 'virtual:something:A:/full/path/to/poky/meta/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask', | ||
| 75 | # '/this/is/most/common/input/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask', | ||
| 76 | # '/and/should/be/tested/with/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask', | ||
| 77 | # '/more/weight/recipes-whatever/helloworld/helloworld_1.2.3.bb:do_sometask', | ||
| 78 | # ] | ||
| 79 | |||
| 80 | # time_start = time.time() | ||
| 81 | |||
| 82 | # i = 2000000 | ||
| 83 | # while i >= 0: | ||
| 84 | # for basepath in input_basepaths: | ||
| 85 | # bb.siggen.clean_basepath(basepath) | ||
| 86 | # i -= 1 | ||
| 87 | |||
| 88 | # elapsed = time.time() - time_start | ||
| 89 | # print('{} ({}s)'.format(self.id(), round(elapsed, 3))) | ||
| 90 | |||
| 91 | # self.assertTrue(False) | ||
