mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00

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>
33 lines
708 B
Python
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()
|