diff options
| author | Your Name <you@example.com> | 2026-05-23 04:10:28 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-23 04:10:28 +0530 |
| commit | 851801f50f1282ab1db5f8a241dbd245f59e447e (patch) | |
| tree | 3285d0714da89879acd21b8c3fb9afeff586ed1e /tests/unit/Makefile | |
| parent | 39aa27a9522aeb8f731f4d3de48939e75775900e (diff) | |
Phase 5: Wire main/ shims to components/tollgate_core
- session.c/h: thin shim casting session_t* <-> tg_session_t*, delegates to tollgate_core_session_*
- firewall.c/h: keeps ESP-specific lwIP hooks, delegates allowlist to tollgate_core_fw_*
- cashu.c/h: shim delegates to tollgate_core_cashu_*, multi-mint via config directly
- mining_payment.c: shim delegates to tollgate_core_mining_*
- tollgate_main.c: calls tollgate_core_init(tollgate_esp_get_platform(), ap_ip) in start_services()
- tollgate_esp: removed target_sources for standalone sources, depends on tollgate_core component
- tollgate_core component: added tollgate_core_get_platform(), tg_payment_method_t enum
- Unit tests: updated Makefile for component source compilation, all 22 tests pass
- Hardware verified: Board A boots, AP visible, 5/6 smoke tests pass (internet test needs upstream WiFi)
Diffstat (limited to 'tests/unit/Makefile')
| -rw-r--r-- | tests/unit/Makefile | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/tests/unit/Makefile b/tests/unit/Makefile index cb06472..5fdc315 100644 --- a/tests/unit/Makefile +++ b/tests/unit/Makefile | |||
| @@ -4,6 +4,8 @@ SECP256K1_INC := $(SECP256K1_SRC)/include | |||
| 4 | SECP256K1_PRIV_INC := $(SECP256K1_SRC)/src | 4 | SECP256K1_PRIV_INC := $(SECP256K1_SRC)/src |
| 5 | SECP256K1_CFG := $(REPO_ROOT)/nucula_src/components/secp256k1 | 5 | SECP256K1_CFG := $(REPO_ROOT)/nucula_src/components/secp256k1 |
| 6 | CJSON_SRC := $(REPO_ROOT)/../esp/esp-idf/components/json/cJSON | 6 | CJSON_SRC := $(REPO_ROOT)/../esp/esp-idf/components/json/cJSON |
| 7 | TG_CORE_SRC := $(REPO_ROOT)/components/tollgate_core/src | ||
| 8 | TG_CORE_INC := $(REPO_ROOT)/components/tollgate_core/include | ||
| 7 | 9 | ||
| 8 | CC := gcc | 10 | CC := gcc |
| 9 | CFLAGS := -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-sign-compare \ | 11 | CFLAGS := -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-sign-compare \ |
| @@ -16,7 +18,9 @@ CFLAGS := -Wall -Wextra -Wno-unused-parameter -Wno-unused-function -Wno-sign-com | |||
| 16 | -I stubs \ | 18 | -I stubs \ |
| 17 | -I $(SECP256K1_INC) \ | 19 | -I $(SECP256K1_INC) \ |
| 18 | -I $(SECP256K1_CFG) \ | 20 | -I $(SECP256K1_CFG) \ |
| 19 | -I /usr/include/cjson | 21 | -I /usr/include/cjson \ |
| 22 | -I $(TG_CORE_SRC) \ | ||
| 23 | -I $(TG_CORE_INC) | ||
| 20 | 24 | ||
| 21 | LDFLAGS := -lmbedcrypto -lcjson -lm | 25 | LDFLAGS := -lmbedcrypto -lcjson -lm |
| 22 | 26 | ||
| @@ -57,11 +61,13 @@ test_identity: test_identity.c $(REPO_ROOT)/main/identity.c $(SECP256K1_OBJ) | |||
| 57 | test_nostr_event: test_nostr_event.c $(REPO_ROOT)/main/nostr_event.c $(REPO_ROOT)/main/identity.c $(SECP256K1_OBJ) | 61 | test_nostr_event: test_nostr_event.c $(REPO_ROOT)/main/nostr_event.c $(REPO_ROOT)/main/identity.c $(SECP256K1_OBJ) |
| 58 | $(CC) $(CFLAGS) -I $(SECP256K1_PRIV_INC) $< $(REPO_ROOT)/main/nostr_event.c $(REPO_ROOT)/main/identity.c $(SECP256K1_OBJ) -o $@ $(LDFLAGS) | 62 | $(CC) $(CFLAGS) -I $(SECP256K1_PRIV_INC) $< $(REPO_ROOT)/main/nostr_event.c $(REPO_ROOT)/main/identity.c $(SECP256K1_OBJ) -o $@ $(LDFLAGS) |
| 59 | 63 | ||
| 60 | test_cashu: test_cashu.c $(REPO_ROOT)/main/cashu.c | 64 | test_cashu: test_cashu.c $(REPO_ROOT)/main/cashu.c $(TG_CORE_SRC)/tollgate_core_cashu.c $(TG_CORE_SRC)/tollgate_core_session.c $(TG_CORE_SRC)/tollgate_core_firewall.c $(TG_CORE_SRC)/tollgate_core.c $(TG_CORE_SRC)/tollgate_core_mining.c $(TG_CORE_SRC)/tollgate_core_dns.c $(TG_CORE_SRC)/tollgate_core_stratum_proxy.c |
| 61 | $(CC) $(CFLAGS) -include stubs/mint_health.h $< $(REPO_ROOT)/main/cashu.c -o $@ $(LDFLAGS) | 65 | $(CC) $(CFLAGS) -include stubs/mint_health.h -include stubs/esp_netif.h -include stubs/esp_log.h -include stubs/esp_http_client.h -include stubs/esp_crt_bundle.h $^ -o $@ $(LDFLAGS) |
| 62 | 66 | ||
| 63 | test_session: test_session.c $(REPO_ROOT)/main/session.c $(REPO_ROOT)/main/cashu.c | 67 | TG_CORE_OBJS_CFLAGS := -include stubs/mint_health.h -include stubs/esp_netif.h -include stubs/esp_log.h -include stubs/esp_http_client.h -include stubs/esp_crt_bundle.h -include stubs/esp_crt_bundle.h |
| 64 | $(CC) $(CFLAGS) -include stubs/mint_health.h $< $(REPO_ROOT)/main/session.c $(REPO_ROOT)/main/cashu.c -o $@ $(LDFLAGS) | 68 | |
| 69 | test_session: test_session.c $(REPO_ROOT)/main/session.c $(REPO_ROOT)/main/cashu.c $(TG_CORE_SRC)/tollgate_core_cashu.c $(TG_CORE_SRC)/tollgate_core_session.c $(TG_CORE_SRC)/tollgate_core_firewall.c $(TG_CORE_SRC)/tollgate_core.c $(TG_CORE_SRC)/tollgate_core_mining.c $(TG_CORE_SRC)/tollgate_core_dns.c $(TG_CORE_SRC)/tollgate_core_stratum_proxy.c | ||
| 70 | $(CC) $(CFLAGS) $(TG_CORE_OBJS_CFLAGS) $^ -o $@ $(LDFLAGS) | ||
| 65 | 71 | ||
| 66 | test_tollgate_client: test_tollgate_client.c $(REPO_ROOT)/main/market.c $(REPO_ROOT)/main/beacon_price.c | 72 | test_tollgate_client: test_tollgate_client.c $(REPO_ROOT)/main/market.c $(REPO_ROOT)/main/beacon_price.c |
| 67 | $(CC) $(CFLAGS) -I $(REPO_ROOT)/main $< $(REPO_ROOT)/main/market.c $(REPO_ROOT)/main/beacon_price.c -o $@ $(LDFLAGS) | 73 | $(CC) $(CFLAGS) -I $(REPO_ROOT)/main $< $(REPO_ROOT)/main/market.c $(REPO_ROOT)/main/beacon_price.c -o $@ $(LDFLAGS) |
| @@ -90,20 +96,20 @@ test_beacon_price: test_beacon_price.c $(REPO_ROOT)/main/beacon_price.c | |||
| 90 | test_market: test_market.c $(REPO_ROOT)/main/market.c $(REPO_ROOT)/main/beacon_price.c | 96 | test_market: test_market.c $(REPO_ROOT)/main/market.c $(REPO_ROOT)/main/beacon_price.c |
| 91 | $(CC) $(CFLAGS) -I $(REPO_ROOT)/main $< $(REPO_ROOT)/main/market.c $(REPO_ROOT)/main/beacon_price.c -o $@ $(LDFLAGS) | 97 | $(CC) $(CFLAGS) -I $(REPO_ROOT)/main $< $(REPO_ROOT)/main/market.c $(REPO_ROOT)/main/beacon_price.c -o $@ $(LDFLAGS) |
| 92 | 98 | ||
| 93 | test_mining_payment: test_mining_payment.c $(REPO_ROOT)/main/mining_payment.c | 99 | test_mining_payment: test_mining_payment.c $(REPO_ROOT)/main/mining_payment.c $(TG_CORE_SRC)/tollgate_core_mining.c $(TG_CORE_SRC)/tollgate_core.c $(TG_CORE_SRC)/tollgate_core_session.c $(TG_CORE_SRC)/tollgate_core_firewall.c $(TG_CORE_SRC)/tollgate_core_cashu.c $(TG_CORE_SRC)/tollgate_core_dns.c $(TG_CORE_SRC)/tollgate_core_stratum_proxy.c |
| 94 | $(CC) $(CFLAGS) $< $(REPO_ROOT)/main/mining_payment.c -o $@ $(LDFLAGS) | 100 | $(CC) $(CFLAGS) $(TG_CORE_OBJS_CFLAGS) $^ -o $@ $(LDFLAGS) |
| 95 | 101 | ||
| 96 | test_stratum_proxy: test_stratum_proxy.c $(REPO_ROOT)/main/stratum_proxy.c $(REPO_ROOT)/main/mining_payment.c | 102 | test_stratum_proxy: test_stratum_proxy.c $(REPO_ROOT)/main/stratum_proxy.c $(REPO_ROOT)/main/mining_payment.c $(TG_CORE_SRC)/tollgate_core_mining.c $(TG_CORE_SRC)/tollgate_core.c $(TG_CORE_SRC)/tollgate_core_session.c $(TG_CORE_SRC)/tollgate_core_firewall.c $(TG_CORE_SRC)/tollgate_core_cashu.c $(TG_CORE_SRC)/tollgate_core_dns.c $(TG_CORE_SRC)/tollgate_core_stratum_proxy.c |
| 97 | $(CC) $(CFLAGS) $< $(REPO_ROOT)/main/stratum_proxy.c $(REPO_ROOT)/main/mining_payment.c -o $@ $(LDFLAGS) | 103 | $(CC) $(CFLAGS) $(TG_CORE_OBJS_CFLAGS) $^ -o $@ $(LDFLAGS) |
| 98 | 104 | ||
| 99 | test_session_payment_method: test_session_payment_method.c $(REPO_ROOT)/main/session.c $(REPO_ROOT)/main/cashu.c | 105 | test_session_payment_method: test_session_payment_method.c $(REPO_ROOT)/main/session.c $(REPO_ROOT)/main/cashu.c $(TG_CORE_SRC)/tollgate_core_cashu.c $(TG_CORE_SRC)/tollgate_core_session.c $(TG_CORE_SRC)/tollgate_core_firewall.c $(TG_CORE_SRC)/tollgate_core.c $(TG_CORE_SRC)/tollgate_core_mining.c $(TG_CORE_SRC)/tollgate_core_dns.c $(TG_CORE_SRC)/tollgate_core_stratum_proxy.c |
| 100 | $(CC) $(CFLAGS) -include stubs/mint_health.h $< $(REPO_ROOT)/main/session.c $(REPO_ROOT)/main/cashu.c -o $@ $(LDFLAGS) | 106 | $(CC) $(CFLAGS) $(TG_CORE_OBJS_CFLAGS) $^ -o $@ $(LDFLAGS) |
| 101 | 107 | ||
| 102 | test_tollgate_client_mining: test_tollgate_client_mining.c | 108 | test_tollgate_client_mining: test_tollgate_client_mining.c |
| 103 | $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) | 109 | $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) |
| 104 | 110 | ||
| 105 | test_firewall_sandbox: test_firewall_sandbox.c $(REPO_ROOT)/main/firewall.c | 111 | test_firewall_sandbox: test_firewall_sandbox.c $(REPO_ROOT)/main/firewall.c $(TG_CORE_SRC)/tollgate_core_firewall.c $(TG_CORE_SRC)/tollgate_core.c $(TG_CORE_SRC)/tollgate_core_session.c $(TG_CORE_SRC)/tollgate_core_cashu.c $(TG_CORE_SRC)/tollgate_core_mining.c $(TG_CORE_SRC)/tollgate_core_dns.c $(TG_CORE_SRC)/tollgate_core_stratum_proxy.c |
| 106 | $(CC) $(CFLAGS) -include stubs/dns_server.h $< $(REPO_ROOT)/main/firewall.c -o $@ $(LDFLAGS) | 112 | $(CC) $(CFLAGS) -include stubs/dns_server.h $(TG_CORE_OBJS_CFLAGS) $^ -o $@ $(LDFLAGS) |
| 107 | 113 | ||
| 108 | test_relay_selector: test_relay_selector.c | 114 | test_relay_selector: test_relay_selector.c |
| 109 | $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) | 115 | $(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) |