1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/tests/build.py

55 lines
1.5 KiB
Python
Raw Normal View History

2020-02-29 13:35:53 +01:00
#!/usr/bin/env python3
import os
2020-01-12 15:03:12 +01:00
lvgldirname = os.path.abspath('..')
lvgldirname = os.path.basename(lvgldirname)
2020-01-12 15:15:30 +01:00
lvgldirname = '"' + lvgldirname + '"'
2020-01-12 15:03:12 +01:00
2020-01-12 15:15:30 +01:00
base_defines = '"-DLV_CONF_PATH=' + lvgldirname +'/tests/lv_test_conf.h -DLV_BUILD_TEST"'
optimization = '"-O3 -g0"'
def build(name, defines, test_name):
2020-05-24 13:13:07 +02:00
global base_defines, optimization
print("=============================")
print(name)
print("=============================")
d_all = base_defines[:-1] + " ";
for d in defines:
d_all += " -D" + d + "=" + str(defines[d])
d_all += '"'
test_file_name = test_name + ".c"
test_file_runner_name = test_name + "_Runner.c"
cmd = "make -j8 BIN=test.bin MAINSRC=" + test_file_name + " TEST_SRC=" + test_file_runner_name + " LVGL_DIR_NAME=" + lvgldirname + " DEFINES=" + d_all + " OPTIMIZATION=" + optimization
print("---------------------------")
print("Build")
print("---------------------------")
ret = os.system(cmd)
if(ret != 0):
print("BUILD ERROR! (error code " + str(ret) + ")")
exit(1)
print("---------------------------")
print("Run")
print("---------------------------")
ret = os.system("./test.bin")
if(ret != 0):
print("RUN ERROR! (error code " + str(ret) + ")")
exit(1)
print("---------------------------")
print("Finished")
print("---------------------------")
def clean():
print("---------------------------")
print("Clean")
print("---------------------------")
os.system("make clean LVGL_DIR_NAME=" + lvgldirname)
os.system("rm -f ./test.bin")