aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/go.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-01-25 19:05:07 +0900
committerOphestra <cat@gensokyo.uk>2026-01-25 21:21:53 +0900
commite34a59e33203503b7d734820ed91b760288a6d98 (patch)
tree1ebec8f58eec9a1deadf2bdc40f32a29f8594e73 /internal/rosa/go.go
parent861801597d800661b26ca03e503cc571537e1304 (diff)
internal/rosa/go: run toolchain tests
LLVM patches and a TMPDIR backed by tmpfs fixed most tests. Broken tests in older versions are disabled. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/go.go')
-rw-r--r--internal/rosa/go.go62
1 files changed, 45 insertions, 17 deletions
diff --git a/internal/rosa/go.go b/internal/rosa/go.go
index fa5a4a49..803c1bc8 100644
--- a/internal/rosa/go.go
+++ b/internal/rosa/go.go
@@ -1,6 +1,7 @@
package rosa
import (
+ "runtime"
"slices"
"hakurei.app/internal/pkg"
@@ -15,8 +16,8 @@ func (t Toolchain) newGoBootstrap() pkg.Artifact {
"CGO_ENABLED=0",
}, `
mkdir -p /var/tmp
-cp -r /usr/src/go1.4-bootstrap /work
-cd /work/go1.4-bootstrap/src
+cp -r /usr/src/go /work
+cd /work/go/src
chmod -R +w ..
ln -s ../system/bin/busybox /bin/pwd
@@ -31,8 +32,11 @@ rm \
syscall/creds_test.go \
net/multicast_test.go
-CC="cc -Qunused-arguments ${LDFLAGS}" ./all.bash
-`, pkg.Path(AbsUsrSrc.Append("go1.4-bootstrap"), false, pkg.NewHTTPGetTar(
+./all.bash
+cd /work/
+mkdir system/
+mv go/ system/
+`, pkg.Path(AbsUsrSrc.Append("go"), false, pkg.NewHTTPGetTar(
nil, "https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz",
mustDecode(checksum),
pkg.TarGzip,
@@ -42,22 +46,24 @@ CC="cc -Qunused-arguments ${LDFLAGS}" ./all.bash
// newGo returns a specific version of the Go toolchain.
func (t Toolchain) newGo(
version, checksum string,
- boot pkg.Artifact,
- env ...string,
+ env []string,
+ script string,
+ extra ...pkg.Artifact,
) pkg.Artifact {
- return t.New("go"+version, []pkg.Artifact{
- boot,
- }, nil, slices.Concat([]string{
+ return t.New("go"+version, slices.Concat([]pkg.Artifact{
+ t.Load(Bash),
+ }, extra), nil, slices.Concat([]string{
"CC=cc",
"GOCACHE=/tmp/gocache",
"GOROOT_BOOTSTRAP=/system/go",
+ "TMPDIR=/dev/shm/go",
}, env), `
-mkdir /work/system
+mkdir /work/system "${TMPDIR}"
cp -r /usr/src/go /work/system
cd /work/system/go/src
chmod -R +w ..
-sed -i 's/bash run.bash/sh run.bash/' all.bash
-sh make.bash
+`+script+`
+./all.bash
`, pkg.Path(AbsUsrSrc.Append("go"), false, pkg.NewHTTPGetTar(
nil, "https://go.dev/dl/go"+version+".src.tar.gz",
mustDecode(checksum),
@@ -69,24 +75,46 @@ func (t Toolchain) newGoLatest() pkg.Artifact {
go119 := t.newGo(
"1.19",
"9_e0aFHsIkVxWVGsp9T2RvvjOc3p4n9o9S8tkNe9Cvgzk_zI2FhRQB7ioQkeAAro",
- t.newGoBootstrap(),
- "GOROOT_BOOTSTRAP=/go1.4-bootstrap",
+ []string{"CGO_ENABLED=0"}, `
+rm \
+ crypto/tls/handshake_client_test.go
+`, t.newGoBootstrap(),
)
+
go121 := t.newGo(
"1.21.13",
"YtrDka402BOAEwywx03Vz4QlVwoBiguJHzG7PuythMCPHXS8CVMLvzmvgEbu4Tzu",
- go119,
+ []string{"CGO_ENABLED=0"}, `
+sed -i \
+ 's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
+ cmd/link/internal/`+runtime.GOARCH+`/obj.go
+
+rm \
+ crypto/tls/handshake_client_test.go \
+ crypto/tls/handshake_server_test.go
+`, go119,
)
+
go123 := t.newGo(
"1.23.12",
"wcI32bl1tkqbgcelGtGWPI4RtlEddd-PTd76Eb-k7nXA5LbE9yTNdIL9QSOOxMOs",
- go121,
+ nil, `
+sed -i \
+ 's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
+ cmd/link/internal/`+runtime.GOARCH+`/obj.go
+`, go121,
)
+
go125 := t.newGo(
"1.25.6",
"x0z430qoDvQbbw_fftjW0rh_GSoh0VJhPzttWk_0hj9yz9AKOjuwRMupF_Q0dbt7",
- go123,
+ nil, `
+sed -i \
+ 's,/lib/ld-musl-`+linuxArch()+`.so.1,/system/bin/linker,' \
+ cmd/link/internal/`+runtime.GOARCH+`/obj.go
+`, go123,
)
+
return go125
}
func init() { artifactsF[Go] = Toolchain.newGoLatest }