mirror of
https://github.com/bybrooklyn/openbitdo.git
synced 2026-03-19 04:12:56 -04:00
Bootstrap OpenBitdo clean-room SDK and reliability milestone
This commit is contained in:
15
sdk/scripts/cleanroom_guard.sh
Executable file
15
sdk/scripts/cleanroom_guard.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
forbidden_pattern='decompiled(_dll|_autoupdate)?/|bundle_extract/|extracted(_net)?/|session-ses_35e4|8BitDo_Ultimate_Software_V2\.decompiled\.cs'
|
||||
scan_paths=(crates tests .github)
|
||||
|
||||
if rg -n --hidden -g '!target/**' "$forbidden_pattern" "${scan_paths[@]}"; then
|
||||
echo "cleanroom guard failed: forbidden dirty-room reference detected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "cleanroom guard passed"
|
||||
45
sdk/scripts/run_hardware_smoke.sh
Executable file
45
sdk/scripts/run_hardware_smoke.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
REPORT_DIR="${ROOT}/../harness/reports"
|
||||
mkdir -p "$REPORT_DIR"
|
||||
TS="$(date +%Y%m%d-%H%M%S)"
|
||||
REPORT_PATH="${1:-$REPORT_DIR/hardware_smoke_${TS}.json}"
|
||||
|
||||
LIST_JSON="$(cargo run -q -p bitdoctl -- --json list 2>/dev/null || echo '[]')"
|
||||
|
||||
TEST_OUTPUT_FILE="$(mktemp)"
|
||||
set +e
|
||||
BITDO_HARDWARE=1 cargo test --workspace --test hardware_smoke -- --ignored >"$TEST_OUTPUT_FILE" 2>&1
|
||||
TEST_STATUS=$?
|
||||
set -e
|
||||
|
||||
python3 - <<'PY' "$REPORT_PATH" "$TEST_STATUS" "$TEST_OUTPUT_FILE" "$LIST_JSON"
|
||||
import json, sys, pathlib, datetime
|
||||
report_path = pathlib.Path(sys.argv[1])
|
||||
test_status = int(sys.argv[2])
|
||||
output_file = pathlib.Path(sys.argv[3])
|
||||
list_json_raw = sys.argv[4]
|
||||
|
||||
try:
|
||||
devices = json.loads(list_json_raw)
|
||||
except Exception:
|
||||
devices = []
|
||||
|
||||
report = {
|
||||
"timestamp_utc": datetime.datetime.utcnow().isoformat() + "Z",
|
||||
"test_status": test_status,
|
||||
"tests_passed": test_status == 0,
|
||||
"devices": devices,
|
||||
"raw_test_output": output_file.read_text(errors="replace"),
|
||||
}
|
||||
|
||||
report_path.write_text(json.dumps(report, indent=2))
|
||||
print(report_path)
|
||||
PY
|
||||
|
||||
rm -f "$TEST_OUTPUT_FILE"
|
||||
echo "hardware smoke report written: $REPORT_PATH"
|
||||
Reference in New Issue
Block a user