diff options
Diffstat (limited to 'src/scripts')
-rwxr-xr-x | src/scripts/ci/travis/lint.sh | 4 | ||||
-rwxr-xr-x | src/scripts/python_uniitests.py | 31 | ||||
-rwxr-xr-x | src/scripts/python_unittests_unix.py | 51 |
3 files changed, 56 insertions, 30 deletions
diff --git a/src/scripts/ci/travis/lint.sh b/src/scripts/ci/travis/lint.sh index df9288b36..92a75c026 100755 --- a/src/scripts/ci/travis/lint.sh +++ b/src/scripts/ci/travis/lint.sh @@ -24,6 +24,10 @@ echo "travis_fold:start:pylint_python_unittests" python3_pylint src/scripts/python_uniitests.py echo "travis_fold:end:pylint_python_unittests" +echo "travis_fold:start:pylint_python_unittests_unix" +python3_pylint src/scripts/python_unittests_unix.py +echo "travis_fold:end:pylint_python_unittests_unix" + echo "travis_fold:start:pylint_botanpy" python2_pylint src/python/botan2.py python3_pylint src/python/botan2.py diff --git a/src/scripts/python_uniitests.py b/src/scripts/python_uniitests.py index c804fae83..fff32e03f 100755 --- a/src/scripts/python_uniitests.py +++ b/src/scripts/python_uniitests.py @@ -10,14 +10,13 @@ Requires Python 3. Botan is released under the Simplified BSD License (see license.txt) """ -import os import sys import unittest sys.path.append("../..") # Botan repo root from configure import CompilerDetector # pylint: disable=wrong-import-position from configure import ModulesChooser # pylint: disable=wrong-import-position -from install import prepend_destdir # pylint: disable=wrong-import-position + class CompilerDetection(unittest.TestCase): @@ -270,34 +269,6 @@ class ModulesChooserResolveDependencies(unittest.TestCase): self.assertEqual(modules, set(["G", "A", "C", "E"])) -class PrependDestdir(unittest.TestCase): - def test_base(self): - os.environ["DESTDIR"] = "/" - self.assertEqual(prepend_destdir("/home/me"), "/home/me") - self.assertEqual(prepend_destdir("relative_path"), "/relative_path") - self.assertEqual(prepend_destdir("./relative_path"), "/relative_path") - self.assertEqual(prepend_destdir("relative/sub"), "/relative/sub") - - self.assertEqual(prepend_destdir("/home/me/"), "/home/me") - self.assertEqual(prepend_destdir("relative_path/"), "/relative_path") - - self.assertEqual(prepend_destdir("/home/me/../me2"), "/home/me2") - self.assertEqual(prepend_destdir("relative/sub/../sub2"), "/relative/sub2") - - os.environ["DESTDIR"] = "/opt" - self.assertEqual(prepend_destdir("/home/me"), "/opt/home/me") - self.assertEqual(prepend_destdir("relative_path"), "/opt/relative_path") - self.assertEqual(prepend_destdir("./relative_path"), "/opt/relative_path") - self.assertEqual(prepend_destdir("relative/sub"), "/opt/relative/sub") - - self.assertEqual(prepend_destdir("/home/me/"), "/opt/home/me") - self.assertEqual(prepend_destdir("relative_path/"), "/opt/relative_path") - - self.assertEqual(prepend_destdir("/home/me/../me2"), "/opt/home/me2") - self.assertEqual(prepend_destdir("relative/sub/../sub2"), "/opt/relative/sub2") - - - if __name__ == '__main__': unittest.TestCase.longMessage = True unittest.main() diff --git a/src/scripts/python_unittests_unix.py b/src/scripts/python_unittests_unix.py new file mode 100755 index 000000000..a8015d081 --- /dev/null +++ b/src/scripts/python_unittests_unix.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 + +""" +Unittests for Botan Python scripts. Those tests only need to pass un UNIX-like +operating systems. + +Requires Python 3. + +(C) 2017 Simon Warta (Kullo GmbH) + +Botan is released under the Simplified BSD License (see license.txt) +""" + +import os +import sys +import unittest + +sys.path.append("../..") # Botan repo root +from install import prepend_destdir # pylint: disable=wrong-import-position + + +class PrependDestdir(unittest.TestCase): + def test_base(self): + os.environ["DESTDIR"] = "/" + self.assertEqual(prepend_destdir("/home/me"), "/home/me") + self.assertEqual(prepend_destdir("relative_path"), "/relative_path") + self.assertEqual(prepend_destdir("./relative_path"), "/relative_path") + self.assertEqual(prepend_destdir("relative/sub"), "/relative/sub") + + self.assertEqual(prepend_destdir("/home/me/"), "/home/me") + self.assertEqual(prepend_destdir("relative_path/"), "/relative_path") + + self.assertEqual(prepend_destdir("/home/me/../me2"), "/home/me2") + self.assertEqual(prepend_destdir("relative/sub/../sub2"), "/relative/sub2") + + os.environ["DESTDIR"] = "/opt" + self.assertEqual(prepend_destdir("/home/me"), "/opt/home/me") + self.assertEqual(prepend_destdir("relative_path"), "/opt/relative_path") + self.assertEqual(prepend_destdir("./relative_path"), "/opt/relative_path") + self.assertEqual(prepend_destdir("relative/sub"), "/opt/relative/sub") + + self.assertEqual(prepend_destdir("/home/me/"), "/opt/home/me") + self.assertEqual(prepend_destdir("relative_path/"), "/opt/relative_path") + + self.assertEqual(prepend_destdir("/home/me/../me2"), "/opt/home/me2") + self.assertEqual(prepend_destdir("relative/sub/../sub2"), "/opt/relative/sub2") + + +if __name__ == '__main__': + unittest.TestCase.longMessage = True + unittest.main() |