changeset 2534:7fad2a5465dd

PR2256: Add UseCompressedOops tests to jstaptest.pl. * Makefile.am (check-tapset-probes): New target. (check-tapset-jstack): Likewise. (check-tapset): Depend on check-tapset-probes check-tapset-jstack. * test/tapset/jstaptest.pl (process_args): Add -p [$run_test_probes] and -j [$run_test_jstack]. (test_jstack): Takes argument to pass to java process. Pass -XX:+UseCompressedOops and/or -Xmx5G.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Wed, 04 Mar 2015 15:05:45 +0000
parents 8e4fc4803bd3
children 9fe29e53b2f1
files ChangeLog Makefile.am test/tapset/jstaptest.pl
diffstat 3 files changed, 69 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 27 15:54:44 2012 -0400
+++ b/ChangeLog	Wed Mar 04 15:05:45 2015 +0000
@@ -1,3 +1,13 @@
+2012-08-03  Mark Wielaard  <mjw@redhat.com>
+
+	* Makefile.am (check-tapset-probes): New target.
+	(check-tapset-jstack): Likewise.
+	(check-tapset): Depend on check-tapset-probes check-tapset-jstack.
+	* test/tapset/jstaptest.pl (process_args): Add -p [$run_test_probes]
+	and -j [$run_test_jstack].
+	(test_jstack): Takes argument to pass to java process.
+	Pass -XX:+UseCompressedOops and/or -Xmx5G.
+
 2012-06-26  Omair Majid  <omajid@redhat.com>
 
 	* test/tapset/jstaptest.pl (get_arch_dir): Fix dir for x86.
--- a/Makefile.am	Wed Jun 27 15:54:44 2012 -0400
+++ b/Makefile.am	Wed Mar 04 15:05:45 2015 +0000
@@ -2181,14 +2181,24 @@
 	  $(jtreg_processes); \
 	fi
 
-check-tapset:
+check-tapset-probes: 
 if ENABLE_SYSTEMTAP
 	$(abs_top_srcdir)/test/tapset/jstaptest.pl \
 	  -B $(BUILD_OUTPUT_DIR) -A $(BUILD_ARCH_DIR) \
 	  -S $(abs_top_srcdir)/test/tapset \
-	  -o test/check-stap.log
+	  -a test/check-stap.log -p
 endif
 
+check-tapset-jstack: 
+if ENABLE_SYSTEMTAP
+	$(abs_top_srcdir)/test/tapset/jstaptest.pl \
+	  -B $(BUILD_OUTPUT_DIR) -A $(BUILD_ARCH_DIR) \
+	  -S $(abs_top_srcdir)/test/tapset \
+	  -a test/check-stap.log -j
+endif
+
+check-tapset: check-tapset-probes check-tapset-jstack
+
 clean-tapset-report:
 if ENABLE_SYSTEMTAP
 	rm -f test/check-stap.log
--- a/test/tapset/jstaptest.pl	Wed Jun 27 15:54:44 2012 -0400
+++ b/test/tapset/jstaptest.pl	Wed Mar 04 15:05:45 2015 +0000
@@ -14,7 +14,7 @@
 use Getopt::Std;
 $Getopt::Std::OUTPUT_HELP_VERSION = 1;
 # sub main::HELP_MESSAGE defined below.
-our($opt_B, $opt_A, $opt_o, $opt_a, $opt_S, $opt_J);
+our($opt_B, $opt_A, $opt_o, $opt_a, $opt_S, $opt_J, $opt_p, $opt_j);
 
 # Gigantic nested array.
 # Each element in outer array should be of the form:
@@ -546,6 +546,8 @@
 my $jvm_so = "";
 my $test_sourcedir = ".";
 my @include_dirs = ();
+my $run_test_probes = 1;
+my $run_test_jstack = 1;
 
 
 ### MAIN BODY
@@ -553,11 +555,30 @@
 process_args();
 log_preamble();
 build_tests();
-my @detected_probes = detect_probes(@probestrings);
-if (can_run_probes()) {
-  test_probes(@detected_probes);
-  test_jstack();
+
+my $can_probe = can_run_probes();
+my @detected_probes;
+
+if ($run_test_probes) {
+  @detected_probes = detect_probes(@probestrings);
+  if ($can_probe) {
+    test_probes(@detected_probes);
+  }
 }
+
+if ($run_test_jstack && $can_probe) {
+  # Default, no arguments.
+  test_jstack("");
+  # Explicitly turn on compressed oops.
+  test_jstack("-XX:+UseCompressedOops");
+  # Explicitly turn off compressed oops.
+  test_jstack("-XX:-UseCompressedOops");
+  # Force some shift value for compressed oops by having a 4GB+ heap.
+  test_jstack("-XX:+UseCompressedOops -Xmx5G");
+  # Explicitly disable compressed oops, but use large heap anyway.
+  test_jstack("-XX:-UseCompressedOops -Xmx5G");
+}
+
 summarize();
 log_postamble();
 clean_up();
@@ -571,8 +592,9 @@
 #     based on args. 
 sub process_args {
     die "Try \"jstaptest.pl --help\" for usage information.\n"
-            if (!getopts('B:A:J:o:a:S:') || ($opt_o && $opt_a));
-                                            # -o and -a are mutually exclusive.
+            if (!getopts('B:A:J:o:a:S:pj')
+                || ($opt_o && $opt_a)   # -o and -a are mutually exclusive.
+                || ($opt_p && $opt_j)); # -p and -j are mutually exclusive.
     if ($opt_B && $opt_A) {
         die "Directory $opt_B not found." unless (-d $opt_B);
         die "Directory $opt_B/j2sdk-image/tapset not found.\nTry rebuilding Icedtea with systemtap support.\n"
@@ -610,6 +632,14 @@
         open($log_file, '>>', $opt_a) or
                 die "Couldn't open log file: $opt_a\n$!";
     }
+    if ($opt_p) {
+      $run_test_probes = 1;
+      $run_test_jstack = 0;
+    }
+    if ($opt_j) {
+      $run_test_probes = 0;
+      $run_test_jstack = 1;
+    }
 }
 
 # Any text that should precede a test run in the log file goes here.
@@ -790,13 +820,14 @@
 }
 
 sub test_jstack {
-    log_and_print("Testing if jstack works as expected...");
     my ($stap_pre, $stap_script, $stap_post, $stap_command, $stap_result);
+    my ($jargs) = @_;
+    log_and_print("Testing if jstack works as expected with '$jargs'...");
 
     # Run staptest.SystemtapTester compiled_method_unload which does a lot
     # and can generate a somewhat "deep" stack.
     $stap_pre = "stap " . join(' ', @tapset_dirs) . " -e '";
-    $stap_post = "' -c '$java_exec staptest.SystemtapTester compiled_method_unload'";
+    $stap_post = "' -c '$java_exec $jargs staptest.SystemtapTester compiled_method_unload'";
 
     # Simple test jstack() should at least show our main method.
     # The test program runs the unloaded probe tester twice, pick the second
@@ -857,7 +888,7 @@
 
 # Any text that should follow a test run in the log file goes here.
 sub log_postamble {
-    if ($broken_count | $undetected_count) {
+    if ($broken_count | $undetected_count | $broken_jstack) {
         log_and_print("Some tests did not work as expected.  See file " . 
             $logfile_name . " for details.");
     }
@@ -964,7 +995,7 @@
     print("\n");
     print("To run test suite:\n");
     print("\n");
-    print("   $ ./jstaptest.sh [[--help] | [<[-B <DIR> -A <ARCH>] | [-J <DIR>]> [-S <DIR>] [-<o|a> <LOGFILE>]]]\n");
+    print("   $ ./jstaptest.sh [[--help] | [<[-B <DIR> -A <ARCH>] | [-J <DIR>]> [-S <DIR>] [-<o|a> <LOGFILE>]]] -<p|j>\n");
     print("\n");
     print("--help will display this help message.\n");
     print("\n");
@@ -1003,6 +1034,11 @@
     print("    the arguments passed to the script and the command executed\n");
     print("    for each test\n");
     print("\n");
+    print("-p specifies that only the tapset probes should be tested.\n");
+    print("-j specifies that only the jstack tapset should be tested.\n");
+    print("Only one of -p or -j may be given. Both are tested by default.\n");
+    print("\n");
+    print("\n");
 }
 
 #######################################################################