// Executes the actual device adapter against deterministic transport/NVS/clock // doubles. These tests are NOT supplier release evidence or hardware acceptance. const fs=require('node:fs'),path=require('node:path'); const base=path.join(__dirname,'..'); const jsonDir=path.join(process.env.IDF_PATH||'E:/Codex/toolchains/esp-idf-v5.5.1','components/json/cJSON'); const strip=s=>s.replace(/^#include[^\n]*$/gm,'').replace(/^#pragma once/gm,''); const sdk=strip(fs.readFileSync(path.join(base,'components/volc_conv_ai/src/base/volc_device_manager.h'),'utf8')); const version=strip(fs.readFileSync(path.join(base,'main/firmware_version.h'),'utf8')); process.stdout.write(fs.readFileSync(path.join(jsonDir,'cJSON.h'),'utf8')+'\n'+fs.readFileSync(path.join(jsonDir,'cJSON.c'),'utf8').replace('#include "cJSON.h"','')+` #include #include #include #include #include #include typedef int esp_err_t; typedef int nvs_handle_t; typedef int StaticSemaphore_t; typedef int SemaphoreHandle_t; #define ESP_OK 0 #define ESP_FAIL -1 #define ESP_ERR_NO_MEM 2 #define ESP_ERR_INVALID_STATE 3 #define ESP_ERR_INVALID_RESPONSE 4 #define ESP_ERR_INVALID_SIZE 5 #define ESP_ERR_TIMEOUT 6 #define ESP_ERR_INVALID_ARG 7 #define ESP_ERR_NVS_NOT_FOUND 7 #define NVS_READWRITE 1 #define NVS_READONLY 0 #define pdTRUE 1 #define pdPASS 1 #define portMAX_DELAY 0 #define pdMS_TO_TICKS(x) (x) #define ESP_LOGI(...) ((void)0) static int64_t test_us=1000000; static int64_t esp_timer_get_time(void){return test_us;} static int xSemaphoreCreateMutexStatic(void *p){return 1;} static int xSemaphoreTake(int m,int t){return pdTRUE;} static void xSemaphoreGive(int m){} static void vTaskDelay(int t){} static int xTaskCreate(void(*f)(void*),const char*n,int stack,void*a,int priority,void*out){return pdPASS;} static int nvs_open(const char *s,int mode,int *n){*n=1;return 0;} static int credential_writes, storage_error; static unsigned char saved_record[2048]; static size_t saved_len; static int nvs_set_blob(int n,const char *key,const void *data,size_t len){if(!strcmp(key,"credential")){credential_writes++;if(!storage_error){assert(len<=sizeof(saved_record));memcpy(saved_record,data,len);saved_len=len;}}return 0;} static int nvs_get_blob(int n,const char *key,void *data,size_t *len){if(!strcmp(key,"credential")&&saved_len==*len){memcpy(data,saved_record,saved_len);return 0;}return ESP_ERR_NVS_NOT_FOUND;} static int nvs_erase_key(int n,const char *key){return 0;} static int nvs_commit(int n){return storage_error;} static void nvs_close(int n){} static void mbedtls_platform_zeroize(void*p,size_t n){memset(p,0,n);} static void mbedtls_sha256(const unsigned char*p,size_t n,unsigned char*out,int x){memset(out,0,32);for(size_t i=0;i