Files
linux/tools/unittests/run.py
Mauro Carvalho Chehab bd167a2122 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>
2026-03-22 15:02:29 -06:00

18 lines
437 B
Python
Executable File

#!/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)