summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/tests/utils.py')
-rw-r--r--bitbake/lib/bb/tests/utils.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/utils.py b/bitbake/lib/bb/tests/utils.py
index 507de2de3c..6e09858e51 100644
--- a/bitbake/lib/bb/tests/utils.py
+++ b/bitbake/lib/bb/tests/utils.py
@@ -21,6 +21,7 @@
21 21
22import unittest 22import unittest
23import bb 23import bb
24import os
24 25
25class VerCmpString(unittest.TestCase): 26class VerCmpString(unittest.TestCase):
26 27
@@ -88,3 +89,19 @@ class VerCmpString(unittest.TestCase):
88 89
89 # Check that clearly invalid operator raises an exception 90 # Check that clearly invalid operator raises an exception
90 self.assertRaises(bb.utils.VersionStringException, bb.utils.vercmp_string_op, '0', '0', '$') 91 self.assertRaises(bb.utils.VersionStringException, bb.utils.vercmp_string_op, '0', '0', '$')
92
93
94class Path(unittest.TestCase):
95 def test_unsafe_delete_path(self):
96 checkitems = [('/', True),
97 ('//', True),
98 ('///', True),
99 (os.getcwd().count(os.sep) * ('..' + os.sep), True),
100 (os.environ.get('HOME', '/home/test'), True),
101 ('/home/someone', True),
102 ('/home/other/', True),
103 ('/home/other/subdir', False),
104 ('', False)]
105 for arg1, correctresult in checkitems:
106 result = bb.utils._check_unsafe_delete_path(arg1)
107 self.assertEqual(result, correctresult, '_check_unsafe_delete_path("%s") != %s' % (arg1, correctresult))