]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.simd] simd/_gen/simdgen: rewrite etetest.sh
authorAustin Clements <austin@google.com>
Wed, 13 Aug 2025 20:59:43 +0000 (16:59 -0400)
committerGopher Robot <gobot@golang.org>
Wed, 13 Aug 2025 21:26:29 +0000 (14:26 -0700)
Now that simdgen is in the main repo, the end-to-end test script can
be much simpler, more robust, and faster.

Change-Id: Ie3b12feaf98c327920071c67cfe74f673bb08d3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/695978
Auto-Submit: Austin Clements <austin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
src/simd/_gen/simdgen/etetest.sh

index 7b5001ecbbe58cc2875354acdda16cebfef2ab7e..f6559fcfff91975b435cab1c17135c72f9c8d26a 100755 (executable)
@@ -1,33 +1,48 @@
-#!/bin/bash -x
-
-cat <<\\EOF
-
-This is an end-to-end test of Go SIMD. It checks out a fresh Go
-repository from the go.simd branch, then generates the SIMD input
-files and runs simdgen writing into the fresh repository.
-
-After that it generates the modified ssa pattern matching files, then
-builds the compiler.
-
-\EOF
-
-rm -rf go-test
-git clone https://go.googlesource.com/go -b dev.simd go-test
-go run . -xedPath xeddata  -o godefs -goroot ./go-test  go.yaml types.yaml categories.yaml
-(cd go-test/src/cmd/compile/internal/ssa/_gen ; go run *.go )
-(cd go-test/src ; GOEXPERIMENT=simd  ./make.bash )
-(cd go-test/bin; b=`pwd` ; cd ../src/simd/testdata; GOARCH=amd64 $b/go run .)
-(cd go-test/bin; b=`pwd` ; cd ../src ;
-GOEXPERIMENT=simd GOARCH=amd64 $b/go test -v simd
-GOEXPERIMENT=simd $b/go test go/doc
-GOEXPERIMENT=simd $b/go test go/build
-GOEXPERIMENT=simd $b/go test cmd/api -v -check
-$b/go test go/doc
-$b/go test go/build
-$b/go test cmd/api -v -check
-
-$b/go test cmd/compile/internal/ssagen -simd=0
-GOEXPERIMENT=simd $b/go test cmd/compile/internal/ssagen -simd=0
-)
-
-# next, add some tests of SIMD itself
+#!/bin/bash
+
+# This is an end-to-end test of Go SIMD. It updates all generated
+# files in this repo and then runs several tests.
+
+XEDDATA="${XEDDATA:-xeddata}"
+if [[ ! -d "$XEDDATA" ]]; then
+    echo >&2 "Must either set \$XEDDATA or symlink xeddata/ to the XED obj/dgen directory."
+    exit 1
+fi
+
+which go >/dev/null || exit 1
+goroot="$(go env GOROOT)"
+if [[ ! ../../../.. -ef "$goroot" ]]; then
+    # We might be able to make this work but it's SO CONFUSING.
+    echo >&2 "go command in path has GOROOT $goroot"
+    exit 1
+fi
+
+if [[ $(go env GOEXPERIMENT) != simd ]]; then
+    echo >&2 "GOEXPERIMENT=$(go env GOEXPERIMENT), expected simd"
+    exit 1
+fi
+
+set -ex
+
+# Regenerate SIMD files
+go run . -o godefs -goroot "$goroot" -xedPath "$XEDDATA" go.yaml types.yaml categories.yaml
+# Regenerate SSA files from SIMD rules
+go run -C "$goroot"/src/cmd/compile/internal/ssa/_gen .
+
+# Rebuild compiler
+cd "$goroot"/src
+go install cmd/compile
+
+# Tests
+GOARCH=amd64 go run -C simd/testdata .
+GOARCH=amd64 go test -v simd
+go test go/doc go/build
+go test cmd/api -v -check -run ^TestCheck$
+go test cmd/compile/internal/ssagen -simd=0
+
+# Check tests without the GOEXPERIMENT
+GOEXPERIMENT= go test go/doc go/build
+GOEXPERIMENT= go test cmd/api -v -check -run ^TestCheck$
+GOEXPERIMENT= go test cmd/compile/internal/ssagen -simd=0
+
+# TODO: Add some tests of SIMD itself