Files
story/firmware/echoear-platform-agent/tests/device-ota-host.cjs
T

8 lines
727 B
JavaScript
Raw Normal View History

// Compile the complete production OTA state machine with real SHA-256 and
// injected ESP partition, HTTP, NVS, timer and restart failures.
const fs=require('fs'),path=require('path');
const root=path.resolve(__dirname,'..'),json=path.join(process.env.IDF_PATH||'E:/Codex/toolchains/esp-idf-v5.5.1','components/json/cJSON');
const source=fs.readFileSync(path.join(root,'main/device_ota.c'),'utf8').replace(/^#include[^\n]*\n/gm,'');
const harness=fs.readFileSync(path.join(__dirname,'device-ota-host.c'),'utf8');
process.stdout.write(fs.readFileSync(path.join(json,'cJSON.h'),'utf8')+'\n'+fs.readFileSync(path.join(json,'cJSON.c'),'utf8').replace('#include "cJSON.h"','')+'\n'+harness.replace('/* PRODUCTION_OTA */',source));