From d3ce7204e316283cca04e3e941c56d5d71b7a98f Mon Sep 17 00:00:00 2001 From: janakr Date: Thu, 4 Apr 2019 00:20:01 -0700 Subject: [PATCH] Force a GC before taking the final histogram in t test_aspect_and_configured_target_cleared. Even though the histogram should be doing a GC (because of -histo:live), occasionally a stale aspect object can evade it. PiperOrigin-RevId: 241879702 --- src/test/shell/integration/discard_analysis_cache_test.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/shell/integration/discard_analysis_cache_test.sh b/src/test/shell/integration/discard_analysis_cache_test.sh index c8a0743a51a128..aa72084c93a5de 100755 --- a/src/test/shell/integration/discard_analysis_cache_test.sh +++ b/src/test/shell/integration/discard_analysis_cache_test.sh @@ -141,6 +141,8 @@ EOF || fail "Expected success" [[ -e "bazel-bin/foo/foo.out.aspect" ]] || fail "Aspect foo not run" [[ -e "bazel-bin/foo/dep.out.aspect" ]] || fail "Aspect bar not run" + # Make sure to clear out garbage, sometimes a spare aspect hangs around. + bazel info used-heap-size-after-gc >& /dev/null "$bazel_javabase"/bin/jmap -histo:live "$server_pid" > histo.txt cat histo.txt >> "$TEST_log" ct_count="$(extract_histogram_count histo.txt 'RuleConfiguredTarget$')"