2020-02-29 13:35:53 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2019-12-26 02:49:30 +01:00
|
|
|
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"'
|
2019-12-26 02:49:30 +01:00
|
|
|
optimization = '"-O3 -g0"'
|
|
|
|
|
2021-06-02 15:41:47 +02:00
|
|
|
def build(name, defines, test_name):
|
2020-05-24 13:13:07 +02:00
|
|
|
global base_defines, optimization
|
2019-12-26 02:49:30 +01:00
|
|
|
|
|
|
|
print("=============================")
|
|
|
|
print(name)
|
|
|
|
print("=============================")
|
|
|
|
|
|
|
|
d_all = base_defines[:-1] + " ";
|
|
|
|
|
|
|
|
for d in defines:
|
|
|
|
d_all += " -D" + d + "=" + str(defines[d])
|
|
|
|
|
|
|
|
d_all += '"'
|
2021-06-02 15:41:47 +02:00
|
|
|
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
|
|
|
|
|
2019-12-26 02:49:30 +01:00
|
|
|
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("---------------------------")
|
|
|
|
|
2021-06-02 15:41:47 +02:00
|
|
|
def clean():
|
|
|
|
print("---------------------------")
|
|
|
|
print("Clean")
|
|
|
|
print("---------------------------")
|
|
|
|
os.system("make clean LVGL_DIR_NAME=" + lvgldirname)
|
|
|
|
os.system("rm -f ./test.bin")
|