Created
February 22, 2016 21:16
-
-
Save ainar-g/c43446f60b3dded12e62 to your computer and use it in GitHub Desktop.
stoke issue 847
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| STOKE=${STOKE:-stoke} | |
| GO=${GO:-go} | |
| cat > popcnt.go <<EOF | |
| package main | |
| //go:noinline | |
| func popcnt(x uint64) int { | |
| var res uint64 | |
| for ; x > 0; x >>= 1 { | |
| res += x & 1 | |
| } | |
| return int(res) | |
| } | |
| func main() { | |
| println("popcnt start") | |
| var iter uint64 = 100000000 | |
| for i := uint64(0); i < iter; i++ { | |
| _ = popcnt(i) | |
| } | |
| println("popcnt end") | |
| } | |
| EOF | |
| echo "written popcnt.go" | |
| $GO build -o a.out popcnt.go | |
| echo "built popcnt" | |
| $STOKE extract -i ./a.out -o bins | |
| echo "extracted bins" | |
| # Remove all files with spaces in names. | |
| find bins -name '* *' -exec rm {} \; | |
| echo "generating testcases" | |
| $STOKE testcase --bin ./a.out --functions bins -o popcnt.tc --fxn main_popcnt --max_testcases 1024 | |
| # Never printed. | |
| echo "testcases generated" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment