add seed flag fixes #26
parent
5604a2aa9e
commit
f5b68f5e67
@ -0,0 +1,43 @@
|
||||
# Check the binary with a given base64 encoded seed
|
||||
garble -literals -seed=OQg9kACEECQ= build main.go
|
||||
exec ./main$exe
|
||||
cmp stderr main.stdout
|
||||
! binsubstr main$exe 'teststring' 'teststringVar'
|
||||
|
||||
[short] stop # checking that the build is reproducible and random is slow
|
||||
|
||||
# Also check that the binary is reproducible.
|
||||
cp main$exe main_old$exe
|
||||
rm main$exe
|
||||
garble -literals -seed=OQg9kACEECQ= build main.go
|
||||
bincmp main$exe main_old$exe
|
||||
|
||||
# Also check that a different seed leads to a different binary
|
||||
cp main$exe main_old$exe
|
||||
rm main$exe
|
||||
garble -literals -seed=NruiDmVz6/s= build main.go
|
||||
! bincmp main$exe main_old$exe
|
||||
|
||||
# Check the random binary
|
||||
garble -literals -seed=random build main.go
|
||||
exec ./main$exe
|
||||
cmp stderr main.stdout
|
||||
! binsubstr main$exe 'teststring' 'teststringVar'
|
||||
|
||||
# Also check that the random binary is not reproducible.
|
||||
cp main$exe main_old$exe
|
||||
rm main$exe
|
||||
garble -literals -seed=random build main.go
|
||||
! bincmp main$exe main_old$exe
|
||||
|
||||
-- main.go --
|
||||
package main
|
||||
|
||||
var teststringVar = "teststring"
|
||||
|
||||
func main() {
|
||||
println(teststringVar)
|
||||
}
|
||||
|
||||
-- main.stdout --
|
||||
teststring
|
Loading…
Reference in New Issue