Add a template for unit-tests
authorAlexander Popov <alex.popov@linux.com>
Fri, 10 Mar 2023 20:12:58 +0000 (23:12 +0300)
committerAlexander Popov <alex.popov@linux.com>
Fri, 10 Mar 2023 20:12:58 +0000 (23:12 +0300)
.github/workflows/main.yml
kconfig_hardened_check/test_engine.py [new file with mode: 0644]

index 4f543d04fab36df37986976d54c012b3302e70dd..eb1a8dda2ccb9f904f4f45b0902bf588e475aa5c 100644 (file)
@@ -170,3 +170,8 @@ jobs:
       run: |
         coverage erase
         rm ./coverage.xml
+
+    - name: Run unit-tests and collect coverage
+      run: |
+        coverage run --include=kconfig_hardened_check/engine.py,kconfig_hardened_check/test_engine.py -m unittest -v
+        coverage xml -i -o coverage_unittest.xml
diff --git a/kconfig_hardened_check/test_engine.py b/kconfig_hardened_check/test_engine.py
new file mode 100644 (file)
index 0000000..ca6698f
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/python3
+
+"""
+This tool helps me to check Linux kernel options against
+my security hardening preferences for X86_64, ARM64, X86_32, and ARM.
+Let the computers do their job!
+
+Author: Alexander Popov <alex.popov@linux.com>
+
+This module performs unit-testing of the kconfig-hardened-check engine.
+"""
+
+import unittest
+# from .engine import populate_with_data, perform_checks
+
+class TestEngine(unittest.TestCase):
+    def test_upper(self):
+        self.assertEqual('foo'.upper(), 'FOO')
+
+    def test_isupper(self):
+        self.assertTrue('FOO'.isupper())
+        self.assertTrue('Foo'.isupper())