6f2d618b8d
The http table copies crosspoint-reader's signatures exactly -- get/head/delete/post/ patch returning (body|nil, status), download taking maxBytes/expectedSize/sha256, the same 50000 byte body cap and the same -1 for a request that never left the device -- so a script that talks to a server runs on either firmware. docs/lua-api-parity.md records that, and every other place the two APIs agree, differ for a reason, or differ because nobody noticed. Two crosspoint behaviours are deliberately not copied. It reinterprets a string in argument 2 of a GET as a request body, which turns a mistyped headers table into a silent protocol error. More seriously it calls setInsecure() on every request, so TLS is encrypted but unauthenticated on the very path a firmware update would use; this verifies against the root bundle already sitting in the framework, and the emulator confirms expired.badssl.com is refused while a wrong sha256 deletes the file. Downloading exposed two failures worth naming. A 2KB read buffer on the stack tripped the loop task's canary because a TLS handshake had already spent it, and the hand-rolled read loop spun forever on a stream that stopped producing -- HTTPClient's own writeToStream handles both, so the loop is gone and the loop task gets 16KB. scripts/gen_lua_stubs.py generates stubs/esp32lcd.lua in the same LuaLS format crosspoint uses, reading annotations off the luaL_Reg tables so a module's docs sit with its registration. make test runs --check, which crosspoint's copy never wired up.
46 lines
1.3 KiB
Makefile
46 lines
1.3 KiB
Makefile
# Run inside `nix develop`, which provides pio, lua and a compiler.
|
|
# LUA is pinned to 5.4 to match the interpreter vendored into the firmware.
|
|
|
|
LUA ?= lua
|
|
CXX ?= c++
|
|
CXXFLAGS ?= -std=c++11 -Wall -Wextra
|
|
BUILD_DIR := .pio/build/esp32-32e
|
|
LUA_TESTS := test/ui_layout.lua test/ui_theme.lua test/settings_calibration.lua
|
|
|
|
.PHONY: test test-lua test-cpp test-stubs stubs build upload monitor clean
|
|
|
|
test: test-cpp test-lua test-stubs
|
|
|
|
# The stub is only useful if it matches the bindings, and nothing but a check keeps it
|
|
# honest -- an editor completing a function the firmware no longer has is worse than no
|
|
# completion at all.
|
|
test-stubs:
|
|
@printf '%-32s ' stubs/esp32lcd.lua; python3 scripts/gen_lua_stubs.py --check && echo ok
|
|
|
|
stubs:
|
|
@python3 scripts/gen_lua_stubs.py
|
|
|
|
test-lua:
|
|
@$(LUA) -e 'assert(_VERSION == "Lua 5.4", "tests need Lua 5.4 to match the firmware, got " .. _VERSION)'
|
|
@for t in $(LUA_TESTS); do printf '%-32s ' "$$t"; $(LUA) "$$t" || exit 1; done
|
|
|
|
test-cpp: $(BUILD_DIR)/round_rect_test
|
|
@printf '%-32s ' test/round_rect_test.cpp; $(BUILD_DIR)/round_rect_test
|
|
|
|
$(BUILD_DIR)/round_rect_test: test/round_rect_test.cpp src/gfx/round_rect.h
|
|
@mkdir -p $(@D)
|
|
@$(CXX) $(CXXFLAGS) $< -o $@
|
|
|
|
build:
|
|
pio run
|
|
|
|
upload:
|
|
pio run -t upload
|
|
|
|
monitor:
|
|
pio device monitor
|
|
|
|
clean:
|
|
pio run -t clean
|
|
rm -f $(BUILD_DIR)/round_rect_test
|