chore: establish local platform baseline

This commit is contained in:
Codex Local
2026-08-26 06:41:54 +08:00
commit 29bdf4900f
575 changed files with 95644 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
package main
import (
"encoding/json"
"flag"
"fmt"
"os"
"path/filepath"
"strings"
"time"
"data-terminal-cloud/internal/rtcconformance"
)
func main() {
capturePath := flag.String("capture", "", "real-device-rtc-capture-v1 JSON")
candidateVersion := flag.String("candidate-version", "", "release candidate version")
buildDigest := flag.String("build-digest", "", "sha256 immutable build digest")
outputPath := flag.String("output", "", "absolute output report path")
flag.Parse()
if *capturePath == "" || strings.TrimSpace(*candidateVersion) == "" || strings.TrimSpace(*buildDigest) == "" || !filepath.IsAbs(*outputPath) {
fmt.Fprintln(os.Stderr, "usage: rtc-conformance -capture capture.json -candidate-version VERSION -build-digest sha256:... -output ABSOLUTE.json")
os.Exit(2)
}
content, err := os.ReadFile(*capturePath)
if err != nil {
fmt.Fprintln(os.Stderr, "read RTC capture:", err)
os.Exit(2)
}
capture, err := rtcconformance.ParseCapture(content)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(2)
}
report := rtcconformance.Evaluate(capture, *candidateVersion, *buildDigest, time.Now().UTC())
report.InputSHA256["rtc_capture"] = rtcconformance.SHA256(content)
encoded, _ := json.MarshalIndent(report, "", " ")
encoded = append(encoded, '\n')
if err = os.WriteFile(*outputPath, encoded, 0o600); err != nil {
fmt.Fprintln(os.Stderr, "write RTC report:", err)
os.Exit(2)
}
fmt.Printf("real device RTC conformance %s: %s\n", report.Result, *outputPath)
if report.Result != "PASS" {
os.Exit(1)
}
}