shibosoftwaredev/f1c100s-linux-nema17-stepper-controller

A four-layer NEMA 17 motor-controller PCB combining an Allwinner F1C100S Linux computer, USB‑PD/buck power system, W5500 Ethernet, STM32 real-time motion control, DRV8825 stepper driver, protection/temperature/current telemetry, USB interfaces, and local LED/buzzer diagnostics.

Version
0.4.56
License
unset
Stars
0

scripts/test-export-gates.mjs

import fs from "node:fs"
import path from "node:path"
import crypto from "node:crypto"
import assert from "node:assert/strict"
import {spawnSync} from "node:child_process"

function manifest(directory){
  if(!fs.existsSync(directory))return {}
  return Object.fromEntries(fs.readdirSync(directory,{recursive:true}).sort()
    .filter(name=>fs.statSync(path.join(directory,name)).isFile())
    .map(name=>[name,crypto.createHash("sha256").update(fs.readFileSync(path.join(directory,name))).digest("hex")]))
}
const before=manifest("fabrication")
const handoffPresentBefore=fs.existsSync("fabrication")
const audit=fs.readFileSync("reports/fabrication-audit.json","utf8")
const result=spawnSync("python3",["scripts/export-assembly.py"],{encoding:"utf8"})
assert.notEqual(result.status,0,"Export must reject the unresolved solder-process findings")
assert.match(result.stderr,/Ordinary via-in-pad and thermal\/opposite-face solder process remain unresolved/)
assert.deepEqual(manifest("fabrication"),before,"Blocked export must preserve every old handoff byte")
assert.equal(fs.existsSync("fabrication"),handoffPresentBefore,"Blocked export must not create a misleading handoff")
assert.equal(fs.readFileSync("reports/fabrication-audit.json","utf8"),audit)
const report={checkedAt:new Date().toISOString(),exitCode:result.status,
  blockedFor:"Unqualified ordinary/thermal via solder process",previousHandoffFilesPreserved:Object.keys(before).length,
  handoffPresentBefore,previousAuditPreserved:true}
fs.writeFileSync("reports/export-gate-test.json",JSON.stringify(report,null,2)+"\n")
console.log(JSON.stringify(report))