arm-trusted-firmware/tools/cot_dt2c/tests/test_util.py
Xialin Liu 4274d6f885 feat(auth): standalone CoT dt2c tool
Add the standalone CoT dt2c tool for CoT DTB conversion to
c file

Change-Id: If28e580a4c2825f5dc9008e93cd2aae3fc173e73
Signed-off-by: Xialin Liu <Xialin.Liu@ARM.com>
2024-08-07 08:46:30 +01:00

33 lines
708 B
Python

#
# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
import os
import sys
from cot_dt2c.cli import *
from click.testing import CliRunner
def get_script_path():
return os.path.dirname(os.path.realpath(sys.argv[0]))
def test_convert():
runner = CliRunner()
test_file = get_script_path() + "/test.dtsi"
test_output = get_script_path() + "/test.c"
result = runner.invoke(convert_to_c, [test_file, test_output])
try:
assert result.output == ""
except:
print("test convert fail")
try:
os.remove(test_output)
except OSError:
pass
if __name__=="__main__":
test_convert()