mirror of
https://github.com/burrowers/garble.git
synced 2025-12-24 12:58:05 +08:00
This lets us start taking advantage of featurs from Go 1.23, particularly tracking aliases in go/types and iterators. Note that we need to add code to properly handle or skip over the new *types.Alias type which go/types produces for Go type aliases. Also note that we actually turn this mode off entirely for now, due to the bug reported at https://go.dev/issue/70394. We don't yet remove our own alias tracking code yet due to the above. We hope to be able to remove it very soon.
56 lines
1.8 KiB
Plaintext
56 lines
1.8 KiB
Plaintext
# Ensure that we support temporary directories with spaces and quotes.
|
|
env TMPDIR=${WORK}/'.temp ''quotes'' and spaces'
|
|
mkdir ${TMPDIR}
|
|
|
|
# Unfortunately, due to https://go.dev/issue/22315, cp + exec is racy.
|
|
# Since we run multiple test scripts in parallel as goroutines,
|
|
# if one thread performs a cp while another is forking, the other may keep the
|
|
# file open slightly longer than we think, causing the fork to fail due to the
|
|
# file still being open for writing.
|
|
# Until the root problem is fixed, add a sleep to try to make that narrow window
|
|
# of time less likely to cause problems.
|
|
# TODO(mvdan): remove the sleeps once cp + exec isn't racy anymore.
|
|
env CP_EXEC_SLEEP=10ms
|
|
|
|
# We need to properly quote the path to garble for toolexec.
|
|
# If we don't, characters like spaces or quotes will result in errors.
|
|
# EXEC_PATH is the test binary's os.Executable.
|
|
# Copying it to a path with basename "garble" makes testscript run our main func.
|
|
# Note that double quotes are not allowed in Windows filenames.
|
|
env NAME='with spaces'
|
|
mkdir $NAME
|
|
cp $EXEC_PATH $NAME/garble$exe
|
|
sleep $CP_EXEC_SLEEP
|
|
exec $NAME/garble$exe build
|
|
|
|
# Ensure that we cleaned up the temporary files.
|
|
! grepfiles ${TMPDIR} 'garble|importcfg|cache\.gob|\.go'
|
|
|
|
[!windows] env NAME='with"double"quotes'
|
|
[!windows] mkdir $NAME
|
|
[!windows] cp $EXEC_PATH $NAME/garble$exe
|
|
[!windows] sleep $CP_EXEC_SLEEP
|
|
[!windows] exec $NAME/garble$exe build
|
|
|
|
env NAME='with''single''quotes'
|
|
mkdir $NAME
|
|
cp $EXEC_PATH $NAME/garble$exe
|
|
exec $NAME/garble$exe build
|
|
|
|
[!windows] env NAME='with"both''quotes'
|
|
[!windows] mkdir $NAME
|
|
[!windows] cp $EXEC_PATH $NAME/garble$exe
|
|
[!windows] sleep $CP_EXEC_SLEEP
|
|
[!windows] ! exec $NAME/garble$exe build
|
|
[!windows] stderr 'cannot be quoted'
|
|
-- go.mod --
|
|
module test/main
|
|
|
|
go 1.23
|
|
-- main.go --
|
|
package main
|
|
|
|
func main() {
|
|
println("hello world")
|
|
}
|