395 "-XX:+PrintGC", 396 "-XX:+PrintStringDeduplicationStatistics"); 397 output.shouldContain("GC concurrent-string-deduplication"); 398 output.shouldContain("Deduplicated:"); 399 output.shouldHaveExitValue(0); 400 401 // Test with min age theshold 402 output = DeduplicationTest.run(SmallNumberOfStrings, 403 MinAgeThreshold, 404 YoungGC, 405 "-XX:+PrintGC", 406 "-XX:+PrintStringDeduplicationStatistics"); 407 output.shouldContain("GC concurrent-string-deduplication"); 408 output.shouldContain("Deduplicated:"); 409 output.shouldHaveExitValue(0); 410 411 // Test with too low age threshold 412 output = DeduplicationTest.run(SmallNumberOfStrings, 413 TooLowAgeThreshold, 414 YoungGC); 415 output.shouldContain("StringDeduplicationAgeThreshold of " + TooLowAgeThreshold + 416 " is invalid; must be between " + MinAgeThreshold + " and " + MaxAgeThreshold); 417 output.shouldHaveExitValue(1); 418 419 // Test with too high age threshold 420 output = DeduplicationTest.run(SmallNumberOfStrings, 421 TooHighAgeThreshold, 422 YoungGC); 423 output.shouldContain("StringDeduplicationAgeThreshold of " + TooHighAgeThreshold + 424 " is invalid; must be between " + MinAgeThreshold + " and " + MaxAgeThreshold); 425 output.shouldHaveExitValue(1); 426 } 427 428 public static void testPrintOptions() throws Exception { 429 OutputAnalyzer output; 430 431 // Test without PrintGC and without PrintStringDeduplicationStatistics 432 output = DeduplicationTest.run(SmallNumberOfStrings, 433 DefaultAgeThreshold, 434 YoungGC); 435 output.shouldNotContain("GC concurrent-string-deduplication"); 436 output.shouldNotContain("Deduplicated:"); 437 output.shouldHaveExitValue(0); 438 439 // Test with PrintGC but without PrintStringDeduplicationStatistics 440 output = DeduplicationTest.run(SmallNumberOfStrings, 441 DefaultAgeThreshold, 442 YoungGC, 443 "-XX:+PrintGC"); 444 output.shouldContain("GC concurrent-string-deduplication"); | 395 "-XX:+PrintGC", 396 "-XX:+PrintStringDeduplicationStatistics"); 397 output.shouldContain("GC concurrent-string-deduplication"); 398 output.shouldContain("Deduplicated:"); 399 output.shouldHaveExitValue(0); 400 401 // Test with min age theshold 402 output = DeduplicationTest.run(SmallNumberOfStrings, 403 MinAgeThreshold, 404 YoungGC, 405 "-XX:+PrintGC", 406 "-XX:+PrintStringDeduplicationStatistics"); 407 output.shouldContain("GC concurrent-string-deduplication"); 408 output.shouldContain("Deduplicated:"); 409 output.shouldHaveExitValue(0); 410 411 // Test with too low age threshold 412 output = DeduplicationTest.run(SmallNumberOfStrings, 413 TooLowAgeThreshold, 414 YoungGC); 415 output.shouldContain("outside the allowed range"); 416 output.shouldHaveExitValue(1); 417 418 // Test with too high age threshold 419 output = DeduplicationTest.run(SmallNumberOfStrings, 420 TooHighAgeThreshold, 421 YoungGC); 422 output.shouldContain("outside the allowed range"); 423 output.shouldHaveExitValue(1); 424 } 425 426 public static void testPrintOptions() throws Exception { 427 OutputAnalyzer output; 428 429 // Test without PrintGC and without PrintStringDeduplicationStatistics 430 output = DeduplicationTest.run(SmallNumberOfStrings, 431 DefaultAgeThreshold, 432 YoungGC); 433 output.shouldNotContain("GC concurrent-string-deduplication"); 434 output.shouldNotContain("Deduplicated:"); 435 output.shouldHaveExitValue(0); 436 437 // Test with PrintGC but without PrintStringDeduplicationStatistics 438 output = DeduplicationTest.run(SmallNumberOfStrings, 439 DefaultAgeThreshold, 440 YoungGC, 441 "-XX:+PrintGC"); 442 output.shouldContain("GC concurrent-string-deduplication"); |