Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
test fix CI build error
  • Loading branch information
kisvegabor committed Jun 23, 2021
1 parent 845c408 commit c38cae2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
2 changes: 2 additions & 0 deletions tests/Makefile
Expand Up @@ -51,4 +51,6 @@ default: $(AOBJS) $(COBJS) $(MAINOBJ)

clean:
find ../ -type f -name '*.o' -exec rm -f {} +
find ../ -type f -name '*.gcda' -exec rm -f {} +
find ../ -type f -name '*.gcno' -exec rm -f {} +
rm -f $(BIN)
18 changes: 9 additions & 9 deletions tests/build.py
Expand Up @@ -23,7 +23,7 @@ def build(defines):

print("")
print("Build")
print("-----------------------")
print("-----------------------", flush=True)
# print(cmd)
ret = os.system(cmd)
if(ret != 0):
Expand All @@ -32,10 +32,10 @@ def build(defines):

print("")
print("Run")
print("-----------------------")
print("-----------------------", flush=True)
ret = os.system("./test.bin")
if(ret != 0):
print("RUN ERROR! (error code " + str(ret) + ")")
print("RUN ERROR! (error code " + str(ret) + ")", flush=True)
exit(1)


Expand All @@ -47,7 +47,7 @@ def build_test(defines, test_name):
print("")
print("~~~~~~~~~~~~~~~~~~~~~~~~")
print(re.search("/[a-z_]*$", test_name).group(0)[1:])
print("~~~~~~~~~~~~~~~~~~~~~~~~")
print("~~~~~~~~~~~~~~~~~~~~~~~~", flush=True)

d_all = base_defines[:-1] + " ";

Expand All @@ -60,28 +60,28 @@ def build_test(defines, test_name):
test_file_runner_name = test_file_runner_name.replace("/test_cases/", "/test_runners/")
csrcs = " EXTRA_CSRCS=\"unity/unity.c unity/unity_support.c src/test_fonts/font_1.c src/test_fonts/font_2.c src/test_fonts/font_3.c \" "
# -s makes it silence
cmd = "make -s -j BIN=test.bin MAINSRC=" + test_file_name + " TEST_SRC=" + test_file_runner_name + csrcs + " LVGL_DIR_NAME=" + lvgldirname + " DEFINES=" + d_all + " OPTIMIZATION=" + optimization
cmd = "make -s -j BIN=test.bin MAINSRC=" + test_file_name + " TEST_SRC=" + test_file_runner_name + csrcs + " LVGL_DIR_NAME=" + lvgldirname + " DEFINES=" + d_all + " OPTIMIZATION=" + optimization

print("")
print("Build")
print("-----------------------")
print("-----------------------", flush=True)
# print(cmd)
ret = os.system(cmd)
if(ret != 0):
print("BUILD ERROR! (error code " + str(ret) + ")")
print("BUILD ERROR! (error code " + str(ret) + ")", flush=True)
exit(1)

print("")
print("Run")
print("-----------------------")
ret = os.system("./test.bin")
if(ret != 0):
print("RUN ERROR! (error code " + str(ret) + ")")
print("RUN ERROR! (error code " + str(ret) + ")", flush=True)
exit(1)

def clean():
print("")
print("Clean")
print("-----------------------")
print("-----------------------", flush=True)
os.system("make clean LVGL_DIR_NAME=" + lvgldirname)
os.system("rm -f ./test.bin")
6 changes: 3 additions & 3 deletions tests/main.py
Expand Up @@ -12,7 +12,7 @@ def build_conf(title, defs):
print("============================================")
print(title)
print("============================================")
print("")
print("", flush=True)

build.clean()
build.build(defs)
Expand Down Expand Up @@ -43,9 +43,9 @@ def build_conf(title, defs):
if test_report:
print("")
print("Generating report")
print("-----------------------")
print("-----------------------", flush=True)
os.system("rm -r report")
os.system("mkdir report")
os.system("gcovr -r ../ --html-details -o report/index.html --exclude-directories '\.\./examples' --exclude-directories 'src/.*' --exclude-directories 'unity' --exclude 'lv_test_.*\.c'")
print("Done: See report/index.html")
print("Done: See report/index.html", flush=True)

8 changes: 4 additions & 4 deletions tests/test.py
Expand Up @@ -2,8 +2,9 @@
import glob

def prepare():
os.system("rm src/test_runners/test_*_Runner.c")
os.system("rm src/*.o")
os.system("rm -rdf src/test_runners")
os.system("mkdir src/test_runners")
files = glob.glob("./src/test_cases/test_*.c")

for index, item in enumerate(files):
Expand All @@ -12,11 +13,10 @@ def prepare():
break

files.insert(0, "./src/test_cases/test_config.c")
print(files)


for f in files:
r = f[:-2] + "_Runner.c"
r = r.replace("/test_cases/", "/test_runners/")
os.system("ruby unity/generate_test_runner.rb " + f + " " + r + " config.yml")
cmd = "ruby unity/generate_test_runner.rb " + f + " " + r + " config.yml"
os.system(cmd)
return files

0 comments on commit c38cae2

Please sign in to comment.