Commit 4c0ef26e
4c0ef26e9d86Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · ~2 modified
Description
Merge pull request #386 from mame/pr/optcarrot-test
chore(test): add optcarrot integration target
Details
- Commit
- 4c0ef26e9d86
- Parent
- 139b5d374568
- Merge parent
- 721e58cbb1be
MakefilemodifiedView file
@@ -122,7 +122,7 @@
122122
CODEGEN_STAMP := build/stamps/spinel_codegen.rb.stamp123123
PARSE_STAMP := build/stamps/spinel_parse.c.stamp124124
125-
.PHONY: all parse bootstrap codegen test retest clean-test-results regen-expected bench clean install uninstall deps125+
.PHONY: all parse bootstrap codegen test retest clean-test-results regen-expected bench optcarrot clean install uninstall deps126126
127127
all: parse regexp spinel_codegen$(EXE)128128
@@ -378,6 +378,34 @@
378378
echo "Benchmarks: $$pass pass, $$fail fail, $$err error, $$skip skip"; \379379
if [ $$fail -ne 0 ] || [ $$err -ne 0 ]; then exit 1; fi380380
381+
# ---- Optcarrot integration test ----382+
#383+
# End-to-end pipeline: clone optcarrot's `experiment/spinel` branch,384+
# pack `lib/optcarrot/*.rb` into a single Ruby file via the upstream385+
# `tools/pack-for-spinel.rb`, compile through spinel, run the386+
# resulting binary against `examples/Lan_Master.nes`, and verify the387+
# output contains `fps: <num>` and `checksum: 59662` (the canonical388+
# 180-frame checksum for `--benchmark`).389+
390+
OPTCARROT_DIR := build/optcarrot391+
OPTCARROT_REPO := https://github.com/mame/optcarrot.git392+
OPTCARROT_BRANCH := experiment/spinel393+
394+
optcarrot: spinel_parse$(EXE) $(SP_RT_LIB) spinel_codegen$(EXE)395+
@if [ ! -d $(OPTCARROT_DIR) ]; then \396+
git clone --depth=1 --branch=$(OPTCARROT_BRANCH) $(OPTCARROT_REPO) $(OPTCARROT_DIR); \397+
fi398+
@ruby $(OPTCARROT_DIR)/tools/pack-for-spinel.rb > build/optcarrot-single.rb399+
@./spinel build/optcarrot-single.rb -o build/optcarrot-single400+
@out=$$($(TIMEOUT60) ./build/optcarrot-single 2>&1); \401+
echo "$$out"; \402+
if echo "$$out" | grep -qE "^fps: [0-9.]+$$" && echo "$$out" | grep -q "^checksum: 59662$$"; then \403+
echo "Optcarrot: OK"; \404+
else \405+
echo "Optcarrot: FAIL — expected 'fps: <num>' and 'checksum: 59662'"; \406+
exit 1; \407+
fi408+
381409
# ---- Install ----382410
383411
PREFIX ?= /usr/localspinel_codegen.rbmodifiedView file
Loading diff…