Skip to content

Instantly share code, notes, and snippets.

@dnephin
Created August 30, 2016 14:57
Show Gist options
  • Save dnephin/3509caeb8ac7066e73e2155e716b4927 to your computer and use it in GitHub Desktop.
Save dnephin/3509caeb8ac7066e73e2155e716b4927 to your computer and use it in GitHub Desktop.
commit 99cbcd6031c5d09d32798457af0b44bce7e8473d
Author: Daniel Nephin <[email protected]>
Date: Wed Aug 17 12:30:47 2016 -0400
WIP adding cpu profiling to integration test suite runner.
Signed-off-by: Daniel Nephin <[email protected]>
diff --git a/hack/make/.integration-test-helpers b/hack/make/.integration-test-helpers
index af7cfed..fcc1641 100644
--- a/hack/make/.integration-test-helpers
+++ b/hack/make/.integration-test-helpers
@@ -22,16 +22,24 @@ go_test_dir() {
coverpkg=$2
testcover=()
testcoverprofile=()
- testbinary="$DEST/test.main"
+ testbinary="$ABS_DEST/integration.test"
+
+ if [ "$PROFILE_TEST_SUITE" ]; then
+ echo "Test binary in $testbinary"
+ echo "Test profile in $ABS_DEST/cpu.prof"
+ PROFFLAGS="-test.cpuprofile $ABS_DEST/cpu.prof"
+ PROFCOMPILEFLAGS="-cpuprofile $ABS_DEST/cpu.prof"
+ fi
+
(
mkdir -p "$DEST/coverprofiles"
- echo '+ go test' $TESTFLAGS "${DOCKER_PKG}${dir#.}"
cd "$dir"
- export DEST="$ABS_DEST" # in a subshell this is safe -- our integration-cli tests need DEST, and "cd" screws it up
- go test -c -o "$testbinary" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}"
+ export DEST="$ABS_DEST"
+ set -x
+ go test -c -o "$testbinary" $PROFCOMPILEFLAGS -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}"
i=0
while ((++i)); do
- test_env "$testbinary" $TESTFLAGS
+ test_env "$testbinary" $PROFFLAGS $TESTFLAGS
if [ $i -gt "$TEST_REPEAT" ]; then
break
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment