diff options
| author | Your Name <you@example.com> | 2026-05-21 16:46:51 +0530 |
|---|---|---|
| committer | Your Name <you@example.com> | 2026-05-21 16:46:51 +0530 |
| commit | 19e175b1c1dea54efb61e8040ffdfa973fbac5d5 (patch) | |
| tree | f41ca977a993cc24f8bf136e96370c8097ceeaf1 /tests/unit | |
| parent | 243e4808246555f86d464d1c476681a902e644ff (diff) | |
Wallet receive via health task queue (no separate TLS worker)
- Removed standalone TLS worker task (couldn't allocate 16KB internal stack)
- Added wallet receive queue to mint_health task (already has 16KB stack + working TLS)
- health_task processes wallet tokens between probe intervals (1s poll)
- tls_worker_set_queue() registers queue from mint_health_start()
- Fallback to synchronous receive if queue not available
- Added freertos/queue.h and tollgate_api.h stubs for unit tests
- Added BaseType_t/UBaseType_t/TickType_t/pdFALSE to FreeRTOS stub
- Full payment round-trip confirmed: 2 payments → 41 sat balance
Diffstat (limited to 'tests/unit')
| -rw-r--r-- | tests/unit/stubs/freertos/FreeRTOS.h | 5 | ||||
| -rw-r--r-- | tests/unit/stubs/freertos/queue.h | 37 | ||||
| -rw-r--r-- | tests/unit/stubs/tollgate_api.h | 11 | ||||
| -rwxr-xr-x | tests/unit/test_beacon_price | bin | 0 -> 35744 bytes | |||
| -rwxr-xr-x | tests/unit/test_display | bin | 0 -> 24816 bytes | |||
| -rwxr-xr-x | tests/unit/test_firewall_sandbox | bin | 0 -> 30568 bytes | |||
| -rwxr-xr-x | tests/unit/test_keyboard | bin | 0 -> 35416 bytes | |||
| -rwxr-xr-x | tests/unit/test_market | bin | 0 -> 49456 bytes | |||
| -rwxr-xr-x | tests/unit/test_mining_payment | bin | 0 -> 28664 bytes | |||
| -rw-r--r-- | tests/unit/test_mint_health.c | 5 | ||||
| -rwxr-xr-x | tests/unit/test_negentropy_adapter | bin | 0 -> 21216 bytes | |||
| -rwxr-xr-x | tests/unit/test_session_payment_method | bin | 0 -> 54680 bytes | |||
| -rwxr-xr-x | tests/unit/test_stratum_proxy | bin | 0 -> 40784 bytes | |||
| -rwxr-xr-x | tests/unit/test_tollgate_client_mining | bin | 0 -> 48448 bytes | |||
| -rwxr-xr-x | tests/unit/test_touch | bin | 0 -> 30304 bytes | |||
| -rwxr-xr-x | tests/unit/test_wifi_setup | bin | 0 -> 33336 bytes |
16 files changed, 58 insertions, 0 deletions
diff --git a/tests/unit/stubs/freertos/FreeRTOS.h b/tests/unit/stubs/freertos/FreeRTOS.h index 2d2b967..543d4e4 100644 --- a/tests/unit/stubs/freertos/FreeRTOS.h +++ b/tests/unit/stubs/freertos/FreeRTOS.h | |||
| @@ -3,11 +3,16 @@ | |||
| 3 | 3 | ||
| 4 | #include <stdint.h> | 4 | #include <stdint.h> |
| 5 | 5 | ||
| 6 | typedef int32_t BaseType_t; | ||
| 7 | typedef uint32_t UBaseType_t; | ||
| 8 | typedef uint32_t TickType_t; | ||
| 9 | |||
| 6 | static inline uint32_t xTaskGetTickCount(void) { return 0; } | 10 | static inline uint32_t xTaskGetTickCount(void) { return 0; } |
| 7 | static inline void vTaskDelay(uint32_t ticks) { (void)ticks; } | 11 | static inline void vTaskDelay(uint32_t ticks) { (void)ticks; } |
| 8 | #define pdMS_TO_TICKS(ms) ((ms) / 10) | 12 | #define pdMS_TO_TICKS(ms) ((ms) / 10) |
| 9 | #define portTICK_PERIOD_MS 10 | 13 | #define portTICK_PERIOD_MS 10 |
| 10 | #define portMAX_DELAY 0xFFFFFFFF | 14 | #define portMAX_DELAY 0xFFFFFFFF |
| 11 | #define pdTRUE 1 | 15 | #define pdTRUE 1 |
| 16 | #define pdFALSE 0 | ||
| 12 | 17 | ||
| 13 | #endif | 18 | #endif |
diff --git a/tests/unit/stubs/freertos/queue.h b/tests/unit/stubs/freertos/queue.h new file mode 100644 index 0000000..04aef49 --- /dev/null +++ b/tests/unit/stubs/freertos/queue.h | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | #ifndef STUB_FREERTOS_QUEUE_H | ||
| 2 | #define STUB_FREERTOS_QUEUE_H | ||
| 3 | |||
| 4 | #include <stddef.h> | ||
| 5 | #include "freertos/FreeRTOS.h" | ||
| 6 | |||
| 7 | typedef void *QueueHandle_t; | ||
| 8 | |||
| 9 | static inline QueueHandle_t xQueueCreate(UBaseType_t uxQueueLength, UBaseType_t uxItemSize) | ||
| 10 | { | ||
| 11 | (void)uxQueueLength; | ||
| 12 | (void)uxItemSize; | ||
| 13 | return (QueueHandle_t)1; | ||
| 14 | } | ||
| 15 | |||
| 16 | static inline BaseType_t xQueueSend(QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait) | ||
| 17 | { | ||
| 18 | (void)xQueue; | ||
| 19 | (void)pvItemToQueue; | ||
| 20 | (void)xTicksToWait; | ||
| 21 | return pdTRUE; | ||
| 22 | } | ||
| 23 | |||
| 24 | static inline BaseType_t xQueueReceive(QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait) | ||
| 25 | { | ||
| 26 | (void)xQueue; | ||
| 27 | (void)pvBuffer; | ||
| 28 | (void)xTicksToWait; | ||
| 29 | return pdFALSE; | ||
| 30 | } | ||
| 31 | |||
| 32 | static inline void vQueueDelete(QueueHandle_t xQueue) | ||
| 33 | { | ||
| 34 | (void)xQueue; | ||
| 35 | } | ||
| 36 | |||
| 37 | #endif | ||
diff --git a/tests/unit/stubs/tollgate_api.h b/tests/unit/stubs/tollgate_api.h new file mode 100644 index 0000000..7e20fce --- /dev/null +++ b/tests/unit/stubs/tollgate_api.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #ifndef STUB_TOLLGATE_API_H | ||
| 2 | #define STUB_TOLLGATE_API_H | ||
| 3 | |||
| 4 | #include "freertos/queue.h" | ||
| 5 | |||
| 6 | static inline void tls_worker_set_queue(QueueHandle_t q) | ||
| 7 | { | ||
| 8 | (void)q; | ||
| 9 | } | ||
| 10 | |||
| 11 | #endif | ||
diff --git a/tests/unit/test_beacon_price b/tests/unit/test_beacon_price new file mode 100755 index 0000000..a9f6357 --- /dev/null +++ b/tests/unit/test_beacon_price | |||
| Binary files differ | |||
diff --git a/tests/unit/test_display b/tests/unit/test_display new file mode 100755 index 0000000..9b8364e --- /dev/null +++ b/tests/unit/test_display | |||
| Binary files differ | |||
diff --git a/tests/unit/test_firewall_sandbox b/tests/unit/test_firewall_sandbox new file mode 100755 index 0000000..3e2895b --- /dev/null +++ b/tests/unit/test_firewall_sandbox | |||
| Binary files differ | |||
diff --git a/tests/unit/test_keyboard b/tests/unit/test_keyboard new file mode 100755 index 0000000..61cc9f5 --- /dev/null +++ b/tests/unit/test_keyboard | |||
| Binary files differ | |||
diff --git a/tests/unit/test_market b/tests/unit/test_market new file mode 100755 index 0000000..8efac8e --- /dev/null +++ b/tests/unit/test_market | |||
| Binary files differ | |||
diff --git a/tests/unit/test_mining_payment b/tests/unit/test_mining_payment new file mode 100755 index 0000000..d38bf9d --- /dev/null +++ b/tests/unit/test_mining_payment | |||
| Binary files differ | |||
diff --git a/tests/unit/test_mint_health.c b/tests/unit/test_mint_health.c index d170d55..1cb05d9 100644 --- a/tests/unit/test_mint_health.c +++ b/tests/unit/test_mint_health.c | |||
| @@ -1,8 +1,13 @@ | |||
| 1 | #include <stdio.h> | 1 | #include <stdio.h> |
| 2 | #include <string.h> | 2 | #include <string.h> |
| 3 | #include <assert.h> | 3 | #include <assert.h> |
| 4 | #include "esp_err.h" | ||
| 4 | #include "mint_health.h" | 5 | #include "mint_health.h" |
| 5 | 6 | ||
| 7 | esp_err_t nucula_wallet_receive(const char *token_str) { (void)token_str; return ESP_OK; } | ||
| 8 | uint64_t nucula_wallet_balance(void) { return 0; } | ||
| 9 | void tls_worker_set_queue(void *q) { (void)q; } | ||
| 10 | |||
| 6 | static int test_count = 0; | 11 | static int test_count = 0; |
| 7 | static int pass_count = 0; | 12 | static int pass_count = 0; |
| 8 | 13 | ||
diff --git a/tests/unit/test_negentropy_adapter b/tests/unit/test_negentropy_adapter new file mode 100755 index 0000000..64b6053 --- /dev/null +++ b/tests/unit/test_negentropy_adapter | |||
| Binary files differ | |||
diff --git a/tests/unit/test_session_payment_method b/tests/unit/test_session_payment_method new file mode 100755 index 0000000..950a72f --- /dev/null +++ b/tests/unit/test_session_payment_method | |||
| Binary files differ | |||
diff --git a/tests/unit/test_stratum_proxy b/tests/unit/test_stratum_proxy new file mode 100755 index 0000000..963df67 --- /dev/null +++ b/tests/unit/test_stratum_proxy | |||
| Binary files differ | |||
diff --git a/tests/unit/test_tollgate_client_mining b/tests/unit/test_tollgate_client_mining new file mode 100755 index 0000000..d331bd1 --- /dev/null +++ b/tests/unit/test_tollgate_client_mining | |||
| Binary files differ | |||
diff --git a/tests/unit/test_touch b/tests/unit/test_touch new file mode 100755 index 0000000..43c8790 --- /dev/null +++ b/tests/unit/test_touch | |||
| Binary files differ | |||
diff --git a/tests/unit/test_wifi_setup b/tests/unit/test_wifi_setup new file mode 100755 index 0000000..aa0e0b4 --- /dev/null +++ b/tests/unit/test_wifi_setup | |||
| Binary files differ | |||