Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
check_compliance: Run the dtlib and edtlib test suites in CI
Browse files Browse the repository at this point in the history
zephyrproject-rtos/zephyr#17660 must go in
before this will work.

Piggyback a clarification re. ZEPHYR_BASE being None when not running on
a Zephyr tree (e.g. when running on the ci-tools repo itself).

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
  • Loading branch information
ulfalizer authored and galak committed Aug 2, 2019
1 parent d56f2dd commit 640744b
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions scripts/check_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def git(*args):
return sh.git(*args, _tty_out=False, _cwd=os.getcwd())


# This ends up as None when we're not running in a Zephyr tree
ZEPHYR_BASE = os.environ.get('ZEPHYR_BASE')

# The absolute path of the top-level git directory
GIT_TOP = git("rev-parse", "--show-toplevel").strip()

Expand Down Expand Up @@ -454,6 +456,43 @@ def check_no_undef_outside_kconfig(self, kconf):
}


class DeviceTreeCheck(ComplianceTest):
"""
Runs the dtlib and edtlib test suites in scripts/dts/.
"""
_name = "Device tree"
_doc = "https://docs.zephyrproject.org/latest/guides/dts/index.html"

def run(self):
self.prepare(ZEPHYR_BASE)
if not ZEPHYR_BASE:
self.skip("Not a Zephyr tree (ZEPHYR_BASE unset)")

scripts_path = os.path.join(ZEPHYR_BASE, "scripts", "dts")

sys.path.insert(0, scripts_path)
import testdtlib
import testedtlib

# Hack: The test suites expect to be run from the scripts/dts
# directory, because they compare repr() output that contains relative
# paths against an expected string. Temporarily change the working
# directory to scripts/dts/.
#
# Warning: This is not thread-safe, though the test suites run in a
# fraction of a second.
old_dir = os.getcwd()
os.chdir(scripts_path)
try:
testdtlib.run()
testedtlib.run()
except Exception as e:
self.add_failure(str(e))
finally:
# Restore working directory
os.chdir(old_dir)


class Codeowners(ComplianceTest):
"""
Check if added files have an owner.
Expand Down

0 comments on commit 640744b

Please sign in to comment.