summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2026-03-17 21:09:29 +0300
committerJonathan Corbet <corbet@lwn.net>2026-03-23 00:02:29 +0300
commitbd167a2122600ac787913275ad1eb5dd38698d9f (patch)
treee395b6d8cd9f2b264ac9bb3acf904dc499211e31 /tools
parent5f6fc8ed4933760c2bcddb86460fe45ada1b943c (diff)
downloadlinux-bd167a2122600ac787913275ad1eb5dd38698d9f.tar.xz
unittests: add a runner to execute all unittests
We'll soon have multiple unit tests, add a runner that will discover all of them and execute all tests. It was opted to discover only files that starts with "test", as this way unittest discover won't try adding libraries or other stuff that might not contain unittest classes. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Message-ID: <2d9dd14f03d3d6394346fdaceeb3167d54d1dd0c.1773770483.git.mchehab+huawei@kernel.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/unittests/run.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/unittests/run.py b/tools/unittests/run.py
new file mode 100755
index 000000000000..8c19036d43a1
--- /dev/null
+++ b/tools/unittests/run.py
@@ -0,0 +1,17 @@
+#!/bin/env python3
+import os
+import unittest
+import sys
+
+TOOLS_DIR=os.path.join(os.path.dirname(os.path.realpath(__file__)), "..")
+sys.path.insert(0, TOOLS_DIR)
+
+from lib.python.unittest_helper import TestUnits
+
+if __name__ == "__main__":
+ loader = unittest.TestLoader()
+
+ suite = loader.discover(start_dir=os.path.join(TOOLS_DIR, "unittests"),
+ pattern="test*.py")
+
+ TestUnits().run("", suite=suite)