mirror of
https://github.com/burrowers/garble.git
synced 2025-12-24 12:58:05 +08:00
This mainly cleans up the few bits of code where we explicitly kept support for Go 1.15.x. With v0.1.0 released, we can drop support now, since the next v0.2.0 release will only support Go 1.16.x. Also updates all modules, including test ones, to 'go 1.16'. Note that the TOOLEXEC_IMPORTPATH refactor is not done here, despite all the TODOs about doing so when we drop 1.15 support. This is because that refactor needs to be done carefully and might have side effects, so it's best to keep it to a separate commit. Finally, update the deps.
63 lines
1.5 KiB
Plaintext
63 lines
1.5 KiB
Plaintext
env GOPRIVATE=test/main
|
|
|
|
# Check the binary with a given base64 encoded seed
|
|
garble -literals -seed=OQg9kACEECQ build
|
|
exec ./main$exe
|
|
cmp stderr main.stdout
|
|
! binsubstr main$exe 'teststring' 'teststringVar' 'imported var value' 'ImportedVar'
|
|
|
|
[short] stop # checking that the build is reproducible and random is slow
|
|
|
|
# Also check that the binary is reproducible.
|
|
# No packages should be rebuilt either, thanks to the build cache.
|
|
cp main$exe main_old$exe
|
|
rm main$exe
|
|
garble -literals -seed=OQg9kACEECQ= build -v
|
|
! stderr .
|
|
bincmp main$exe main_old$exe
|
|
|
|
# Also check that a different seed leads to a different binary.
|
|
# We can't know if caching happens here, because of previous test runs.
|
|
cp main$exe main_old$exe
|
|
rm main$exe
|
|
garble -literals -seed=NruiDmVz6/s build
|
|
! bincmp main$exe main_old$exe
|
|
|
|
# Use a random seed, which should always trigger a full build.
|
|
garble -literals -seed=random build -v
|
|
stderr .
|
|
exec ./main$exe
|
|
cmp stderr main.stdout
|
|
! binsubstr main$exe 'teststring' 'teststringVar' 'imported var value' 'ImportedVar'
|
|
|
|
# Also check that the random binary is not reproducible.
|
|
cp main$exe main_old$exe
|
|
rm main$exe
|
|
garble -literals -seed=random build -v
|
|
stderr .
|
|
! bincmp main$exe main_old$exe
|
|
|
|
-- go.mod --
|
|
module test/main
|
|
|
|
go 1.16
|
|
-- main.go --
|
|
package main
|
|
|
|
import "test/main/imported"
|
|
|
|
var teststringVar = "teststring"
|
|
|
|
func main() {
|
|
println(teststringVar)
|
|
println(imported.ImportedVar)
|
|
}
|
|
-- imported/imported.go --
|
|
package imported
|
|
|
|
var ImportedVar = "imported var value"
|
|
|
|
-- main.stdout --
|
|
teststring
|
|
imported var value
|