(t *testing.T, tmpWorkspace string)
| 95 | } |
| 96 | |
| 97 | func setupArchiveFile(t *testing.T, tmpWorkspace string) (archivePath string, archiveSha string) { |
| 98 | t.Helper() |
| 99 | |
| 100 | // Create a tiny source tree and compress it into a local archive so the |
| 101 | // archive-cache test stays deterministic and does not depend on downloads. |
| 102 | srcRoot := filepath.Join(tmpWorkspace, "archive-src") |
| 103 | if err := os.MkdirAll(srcRoot, os.ModePerm); err != nil { |
| 104 | t.Fatal(err) |
| 105 | } |
| 106 | if err := os.WriteFile(filepath.Join(srcRoot, "hello.txt"), []byte("hello-from-archive"), os.ModePerm); err != nil { |
| 107 | t.Fatal(err) |
| 108 | } |
| 109 | |
| 110 | archivePath = filepath.Join(tmpWorkspace, "x264-archive.tar.gz") |
| 111 | if err := fileio.Targz(archivePath, srcRoot, false); err != nil { |
| 112 | t.Fatal(err) |
| 113 | } |
| 114 | |
| 115 | checksum, err := fileio.ComputeSHA256(archivePath) |
| 116 | if err != nil { |
| 117 | t.Fatal(err) |
| 118 | } |
| 119 | return archivePath, checksum |
| 120 | } |
| 121 | |
| 122 | func TestBuildConfigClone_GitRepoCache(t *testing.T) { |
| 123 | // Goal: |
no test coverage detected