mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-04 18:30:37 +08:00

### Maintenance page * Add add tab color for mobile view * Add spellcheck off / autocorect off in input * Add disconnect button when authenticate enabled * Add Invalid user or password message when authentication failed ### Board support * Add ESP32 S2 support * Add ESP32 S3 support * Add ESP32 C3 support ### ESP commands * Add command 701 to control GCODE streaming * Remove command 901 as duplicate * Update command 420 to add more details * Use text as default output * All json on all commands for formated output ### Core * Add benchmak function to check transfer speed (for test only-not production) * Merge code for ESP3DLib support * Add better printer display support (M117 / Serial TFT) * Use ESP32 analogWrite instead of emulated one ### Modules * Display * Refactor code * Remove SPI ILI 9341 / 9488 support as not suitable * Add ST7789 support (135x240 / 240x240) * Filesystem * Bug fixes due to esp core updates * Better SD sharing mecanism * Better global FS management * FTP * Add SD sharing support * Better global FS management * GCODE Host * Add basic support for macro files * Add ESP command support * Use not blocking method to stream commands / handle response * Notifications * Add IFTTT notification service * Add WebUI notification * Add ESP3D display notification * WebDav * Add SD sharing support * Add bug fix from https://github.com/d-a-v/ESPWebDAV * Better global FS management * Websocket * Add function to handle zombies connections * WiFi * Fix connection to AP sometime fail * Fix low signal not diplayed in ESP420 even connected * Add AP Setup mode ### Libraries * Update SDFat-2.0.6 to 2.1.2 * Update ESP32SSDP 1.1.1 to 1.2.0 * Update TFT_eSPI-1.4.11 to 2.4.61 * Update arduinoWebSockets-2.3.5 to 2.3.6 * Update esp8266-oled-ssd1306-4.0.0 to 4.3.0 * Remove lvgl support ### Tools * Add I2C scanner script * Add python script to simulate/stress printer serial communication ### PlatformIO * Use latest 4.4.0 Espressif32 release (ESP32-arduino core 2.0.3) * Add fix for Flash more than 4MB * Add Esp32 S2/S3/C3 env * Add ESP32-ST7789 / esp32-TTGO_T_Display env
209 lines
6.8 KiB
Python
209 lines
6.8 KiB
Python
#!/usr/bin/env python3
|
|
|
|
import argparse
|
|
import errno
|
|
import glob
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
lvgl_test_dir = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
# Key values must match variable names in CMakeLists.txt.
|
|
build_only_options = {
|
|
'OPTIONS_MINIMAL_MONOCHROME': 'Minimal config monochrome',
|
|
'OPTIONS_NORMAL_8BIT': 'Normal config, 8 bit color depth',
|
|
'OPTIONS_16BIT': 'Minimal config, 16 bit color depth',
|
|
'OPTIONS_16BIT_SWAP': 'Normal config, 16 bit color depth swapped',
|
|
'OPTIONS_FULL_32BIT': 'Full config, 32 bit color depth',
|
|
}
|
|
|
|
test_options = {
|
|
'OPTIONS_TEST_SYSHEAP': 'Test config, system heap, 32 bit color depth',
|
|
'OPTIONS_TEST_DEFHEAP': 'Test config, LVGL heap, 32 bit color depth',
|
|
}
|
|
|
|
|
|
def is_valid_option_name(option_name):
|
|
return option_name in build_only_options or option_name in test_options
|
|
|
|
|
|
def get_option_description(option_name):
|
|
if option_name in build_only_options:
|
|
return build_only_options[option_name]
|
|
return test_options[option_name]
|
|
|
|
|
|
def delete_dir_ignore_missing(dir_path):
|
|
'''Recursively delete a directory and ignore if missing.'''
|
|
try:
|
|
shutil.rmtree(dir_path)
|
|
except FileNotFoundError:
|
|
pass
|
|
|
|
|
|
def generate_test_runners():
|
|
'''Generate the test runner source code.'''
|
|
global lvgl_test_dir
|
|
os.chdir(lvgl_test_dir)
|
|
delete_dir_ignore_missing('src/test_runners')
|
|
os.mkdir('src/test_runners')
|
|
|
|
# TODO: Intermediate files should be in the build folders, not alongside
|
|
# the other repo source.
|
|
for f in glob.glob("./src/test_cases/test_*.c"):
|
|
r = f[:-2] + "_Runner.c"
|
|
r = r.replace("/test_cases/", "/test_runners/")
|
|
subprocess.check_call(['ruby', 'unity/generate_test_runner.rb',
|
|
f, r, 'config.yml'])
|
|
|
|
|
|
def options_abbrev(options_name):
|
|
'''Return an abbreviated version of the option name.'''
|
|
prefix = 'OPTIONS_'
|
|
assert options_name.startswith(prefix)
|
|
return options_name[len(prefix):].lower()
|
|
|
|
|
|
def get_base_buid_dir(options_name):
|
|
'''Given the build options name, return the build directory name.
|
|
|
|
Does not return the full path to the directory - just the base name.'''
|
|
return 'build_%s' % options_abbrev(options_name)
|
|
|
|
|
|
def get_build_dir(options_name):
|
|
'''Given the build options name, return the build directory name.
|
|
|
|
Returns absolute path to the build directory.'''
|
|
global lvgl_test_dir
|
|
return os.path.join(lvgl_test_dir, get_base_buid_dir(options_name))
|
|
|
|
|
|
def build_tests(options_name, build_type, clean):
|
|
'''Build all tests for the specified options name.'''
|
|
global lvgl_test_dir
|
|
|
|
print()
|
|
print()
|
|
label = 'Building: %s: %s' % (options_abbrev(
|
|
options_name), get_option_description(options_name))
|
|
print('=' * len(label))
|
|
print(label)
|
|
print('=' * len(label))
|
|
print(flush=True)
|
|
|
|
build_dir = get_build_dir(options_name)
|
|
if clean:
|
|
delete_dir_ignore_missing(build_dir)
|
|
|
|
os.chdir(lvgl_test_dir)
|
|
created_build_dir = False
|
|
if not os.path.isdir(build_dir):
|
|
os.mkdir(build_dir)
|
|
created_build_dir = True
|
|
os.chdir(build_dir)
|
|
if created_build_dir:
|
|
subprocess.check_call(['cmake', '-DCMAKE_BUILD_TYPE=%s' % build_type,
|
|
'-D%s=1' % options_name, '..'])
|
|
subprocess.check_call(['cmake', '--build', build_dir,
|
|
'--parallel', str(os.cpu_count())])
|
|
|
|
|
|
def run_tests(options_name):
|
|
'''Run the tests for the given options name.'''
|
|
|
|
print()
|
|
print()
|
|
label = 'Running tests for %s' % options_abbrev(options_name)
|
|
print('=' * len(label))
|
|
print(label)
|
|
print('=' * len(label), flush=True)
|
|
|
|
os.chdir(get_build_dir(options_name))
|
|
subprocess.check_call(
|
|
['ctest', '--parallel', str(os.cpu_count()), '--output-on-failure'])
|
|
|
|
|
|
def generate_code_coverage_report():
|
|
'''Produce code coverage test reports for the test execution.'''
|
|
global lvgl_test_dir
|
|
|
|
print()
|
|
print()
|
|
label = 'Generating code coverage reports'
|
|
print('=' * len(label))
|
|
print(label)
|
|
print('=' * len(label))
|
|
print(flush=True)
|
|
|
|
os.chdir(lvgl_test_dir)
|
|
delete_dir_ignore_missing('report')
|
|
os.mkdir('report')
|
|
root_dir = os.pardir
|
|
html_report_file = 'report/index.html'
|
|
cmd = ['gcovr', '--root', root_dir, '--html-details', '--output',
|
|
html_report_file, '--xml', 'report/coverage.xml',
|
|
'-j', str(os.cpu_count()), '--print-summary',
|
|
'--html-title', 'LVGL Test Coverage']
|
|
for d in ('.*\\bexamples/.*', '\\bsrc/test_.*', '\\bsrc/lv_test.*', '\\bunity\\b'):
|
|
cmd.extend(['--exclude', d])
|
|
|
|
subprocess.check_call(cmd)
|
|
print("Done: See %s" % html_report_file, flush=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
epilog = '''This program builds and optionally runs the LVGL test programs.
|
|
There are two types of LVGL tests: "build", and "test". The build-only
|
|
tests, as their name suggests, only verify that the program successfully
|
|
compiles and links (with various build options). There are also a set of
|
|
tests that execute to verify correct LVGL library behavior.
|
|
'''
|
|
parser = argparse.ArgumentParser(
|
|
description='Build and/or run LVGL tests.', epilog=epilog)
|
|
parser.add_argument('--build-options', nargs=1,
|
|
help='''the build option name to build or run. When
|
|
omitted all build configurations are used.
|
|
''')
|
|
parser.add_argument('--clean', action='store_true', default=False,
|
|
help='clean existing build artifacts before operation.')
|
|
parser.add_argument('--report', action='store_true',
|
|
help='generate code coverage report for tests.')
|
|
parser.add_argument('actions', nargs='*', choices=['build', 'test'],
|
|
help='build: compile build tests, test: compile/run executable tests.')
|
|
|
|
args = parser.parse_args()
|
|
|
|
if args.build_options:
|
|
options_to_build = args.build_options
|
|
else:
|
|
if 'build' in args.actions:
|
|
if 'test' in args.actions:
|
|
options_to_build = {**build_only_options, **test_options}
|
|
else:
|
|
options_to_build = build_only_options
|
|
else:
|
|
options_to_build = test_options
|
|
|
|
for opt in options_to_build:
|
|
if not is_valid_option_name(opt):
|
|
print('Invalid build option "%s"' % opt, file=sys.stderr)
|
|
sys.exit(errno.EINVAL)
|
|
|
|
generate_test_runners()
|
|
|
|
for options_name in options_to_build:
|
|
is_test = options_name in test_options
|
|
build_type = 'Debug'
|
|
build_tests(options_name, build_type, args.clean)
|
|
if is_test:
|
|
try:
|
|
run_tests(options_name)
|
|
except subprocess.CalledProcessError as e:
|
|
sys.exit(e.returncode)
|
|
|
|
if args.report:
|
|
generate_code_coverage_report()
|