OSDN Git Service

Re-enable CFI test for compressed symbols.
authorDavid Srbecky <dsrbecky@google.com>
Fri, 4 Mar 2016 14:42:05 +0000 (14:42 +0000)
committerDavid Srbecky <dsrbecky@google.com>
Fri, 4 Mar 2016 15:37:13 +0000 (15:37 +0000)
This enables the test for remote unwinding (modelling debuggerd),
but it does not test local unwinding since it is disabled for
performance reasons in libunwind.

Bug: 27391690
Change-Id: I28451576c421bbd70259d757332a178f29bf3646

test/137-cfi/expected.txt
test/137-cfi/run
test/137-cfi/src/Main.java

index 6a5618e..8db7853 100644 (file)
@@ -1 +1,2 @@
 JNI_OnLoad called
+JNI_OnLoad called
index 8ec98c1..ebc729b 100755 (executable)
 
 # Test with full DWARF debugging information.
 # Check full signatures of methods.
-${RUN} "$@" -Xcompiler-option --generate-debug-info --args --full-signatures
+${RUN} "$@" -Xcompiler-option --generate-debug-info \
+  --args --full-signatures --args --test-local --args --test-remote
 
 # Test with minimal compressed debugging information.
 # Check only method names (parameters are omitted to save space).
-# Temporarily disable due to bug 27172087 (leak/race in libunwind).
-# ${RUN} "$@" -Xcompiler-option --generate-mini-debug-info
+# Check only remote unwinding since decompression is disabled in local unwinds (b/27391690).
+${RUN} "$@" -Xcompiler-option --generate-mini-debug-info --args --test-remote
index d60a4eb..5cfe33d 100644 (file)
@@ -21,43 +21,48 @@ import java.util.Arrays;
 import java.util.Comparator;
 
 public class Main implements Comparator<Main> {
-  // Whether to test local unwinding. Libunwind uses linker info to find executables. As we do
-  // not dlopen at the moment, this doesn't work, so keep it off for now.
-  public final static boolean TEST_LOCAL_UNWINDING = true;
+  // Whether to test local unwinding.
+  private boolean testLocal;
 
-  // Unwinding another process, modelling debuggerd. This doesn't use the linker, so should work
-  // no matter whether we're using dlopen or not.
-  public final static boolean TEST_REMOTE_UNWINDING = true;
+  // Unwinding another process, modelling debuggerd.
+  private boolean testRemote;
 
+  // We fork ourself to create the secondary process for remote unwinding.
   private boolean secondary;
 
-  private boolean full_signatures;
+  // Expect the symbols to contain full method signatures including parameters.
+  private boolean fullSignatures;
 
   private boolean passed;
 
-  public Main(boolean secondary, boolean full_signatures) {
-      this.secondary = secondary;
-      this.full_signatures = full_signatures;
+  public Main(String[] args) throws Exception {
+      System.loadLibrary(args[0]);
+      for (String arg : args) {
+          if (arg.equals("--test-local")) {
+              testLocal = true;
+          }
+          if (arg.equals("--test-remote")) {
+              testRemote = true;
+          }
+          if (arg.equals("--secondary")) {
+              secondary = true;
+          }
+          if (arg.equals("--full-signatures")) {
+              fullSignatures = true;
+          }
+      }
+      if (!testLocal && !testRemote) {
+          System.out.println("No test selected.");
+      }
   }
 
   public static void main(String[] args) throws Exception {
-    System.loadLibrary(args[0]);
-      boolean secondary = false;
-      boolean full_signatures = false;
-      for (String arg : args) {
-        if (arg.equals("--secondary")) {
-          secondary = true;
-        }
-        if (arg.equals("--full-signatures")) {
-          full_signatures = true;
-        }
-      }
-      new Main(secondary, full_signatures).run();
+      new Main(args).run();
   }
 
   private void run() {
       if (secondary) {
-          if (!TEST_REMOTE_UNWINDING) {
+          if (!testRemote) {
               throw new RuntimeException("Should not be running secondary!");
           }
           runSecondary();
@@ -73,11 +78,11 @@ public class Main implements Comparator<Main> {
 
   private void runPrimary() {
       // First do the in-process unwinding.
-      if (TEST_LOCAL_UNWINDING && !foo()) {
+      if (testLocal && !foo()) {
           System.out.println("Unwinding self failed.");
       }
 
-      if (!TEST_REMOTE_UNWINDING) {
+      if (!testRemote) {
           // Skip the remote step.
           return;
       }
@@ -105,7 +110,7 @@ public class Main implements Comparator<Main> {
               throw new RuntimeException(e);
           }
 
-          if (!unwindOtherProcess(full_signatures, pid)) {
+          if (!unwindOtherProcess(fullSignatures, pid)) {
               System.out.println("Unwinding other process failed.");
           }
       } finally {
@@ -163,7 +168,7 @@ public class Main implements Comparator<Main> {
       if (b) {
           return sleep(2, b, 1.0);
       } else {
-          return unwindInProcess(full_signatures, 1, b);
+          return unwindInProcess(fullSignatures, 1, b);
       }
   }
 
@@ -171,6 +176,6 @@ public class Main implements Comparator<Main> {
 
   public native boolean sleep(int i, boolean b, double dummy);
 
-  public native boolean unwindInProcess(boolean full_signatures, int i, boolean b);
-  public native boolean unwindOtherProcess(boolean full_signatures, int pid);
+  public native boolean unwindInProcess(boolean fullSignatures, int i, boolean b);
+  public native boolean unwindOtherProcess(boolean fullSignatures, int pid);
 }