oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package codex
2
3import "testing"
4
5// The amd64 pins are the certified ones and must not move with the arm64
6// ones beside them. The arm64 digests are the official rust-v0.165.0
7// aarch64-unknown-linux-musl binaries.
8func TestReleasePinsByArchitecture(t *testing.T) {
9 executable, host, ok := ReleasePins("amd64")
10 if !ok || executable != ExecutableSHA256 || host != CodeModeHostSHA256 {
11 t.Fatalf("amd64 must be the certified pins, got %q %q %v", executable, host, ok)
12 }
13 executable, host, ok = ReleasePins("arm64")
14 if !ok || executable != "b32ece31af06440da980b733fb8fefdd1f193439595fda84096f1caaceec543f" || host != "fd7a4a1f29871fb0015c19ad2f885ef6a878244643260703e17663418695aa14" {
15 t.Fatalf("arm64 pins changed: %q %q %v", executable, host, ok)
16 }
17 if executable == ExecutableSHA256 || host == CodeModeHostSHA256 {
18 t.Fatal("arm64 pins equal the certified amd64 pins")
19 }
20 if executable, host, ok = ReleasePins("riscv64"); ok || executable != "" || host != "" {
21 t.Fatal("an architecture with no official build has pins")
22 }
23}
24
25// A launcher trusts only the certified pins, whatever machine builds it.
26func TestLauncherKeepsCertifiedPins(t *testing.T) {
27 l, err := New(offlineCodexHost{t}, fakeCapture{})
28 if err != nil {
29 t.Fatal(err)
30 }
31 if l.digest != ExecutableSHA256 || l.hostDigest != CodeModeHostSHA256 {
32 t.Fatal("launcher pins are not the certified ones")
33 }
34}
35