-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
maze(tests): Rework scenarios to rely less on UB
Some Android + arch combinations do mildly unsettling things, like not crash when you start poking around released memory. It seems this hole was eventually closed, but it doesn’t help test the efficacy of the library. Add new scenarios to test raising each signal, for sanity. Replaced UB-dependent tests with cleaner, crashier ones. Marked stack buffer overflow scenario as API 18+, as prior to that, it would kill() without calling handlers.
- Loading branch information
Showing
13 changed files
with
491 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/CXXSigabrtScenario.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.mazerunner.scenarios; | ||
|
||
import android.content.Context; | ||
|
||
import com.bugsnag.android.Configuration; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
public class CXXSigabrtScenario extends Scenario { | ||
|
||
static { | ||
System.loadLibrary("bugsnag-ndk"); | ||
System.loadLibrary("entrypoint"); | ||
} | ||
|
||
public native int crash(int value); | ||
|
||
public CXXSigabrtScenario(@NonNull Configuration config, @NonNull Context context) { | ||
super(config, context); | ||
config.setAutoCaptureSessions(false); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
super.run(); | ||
String metadata = getEventMetaData(); | ||
if (metadata != null && metadata.equals("non-crashy")) { | ||
return; | ||
} | ||
crash(2726); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
.../mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/CXXSigbusScenario.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.mazerunner.scenarios; | ||
|
||
import android.content.Context; | ||
|
||
import com.bugsnag.android.Configuration; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
public class CXXSigbusScenario extends Scenario { | ||
|
||
static { | ||
System.loadLibrary("bugsnag-ndk"); | ||
System.loadLibrary("entrypoint"); | ||
} | ||
|
||
public native int crash(int value); | ||
|
||
public CXXSigbusScenario(@NonNull Configuration config, @NonNull Context context) { | ||
super(config, context); | ||
config.setAutoCaptureSessions(false); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
super.run(); | ||
String metadata = getEventMetaData(); | ||
if (metadata != null && metadata.equals("non-crashy")) { | ||
return; | ||
} | ||
crash(2726); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
.../mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/CXXSigfpeScenario.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.mazerunner.scenarios; | ||
|
||
import android.content.Context; | ||
|
||
import com.bugsnag.android.Configuration; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
public class CXXSigfpeScenario extends Scenario { | ||
|
||
static { | ||
System.loadLibrary("bugsnag-ndk"); | ||
System.loadLibrary("entrypoint"); | ||
} | ||
|
||
public native int crash(int value); | ||
|
||
public CXXSigfpeScenario(@NonNull Configuration config, @NonNull Context context) { | ||
super(config, context); | ||
config.setAutoCaptureSessions(false); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
super.run(); | ||
String metadata = getEventMetaData(); | ||
if (metadata != null && metadata.equals("non-crashy")) { | ||
return; | ||
} | ||
crash(2726); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
.../mazerunner/src/main/java/com/bugsnag/android/mazerunner/scenarios/CXXSigillScenario.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.bugsnag.android.mazerunner.scenarios; | ||
|
||
import android.content.Context; | ||
|
||
import com.bugsnag.android.Configuration; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
public class CXXSigillScenario extends Scenario { | ||
|
||
static { | ||
System.loadLibrary("bugsnag-ndk"); | ||
System.loadLibrary("entrypoint"); | ||
} | ||
|
||
public native int crash(int value); | ||
|
||
public CXXSigillScenario(@NonNull Configuration config, @NonNull Context context) { | ||
super(config, context); | ||
config.setAutoCaptureSessions(false); | ||
} | ||
|
||
@Override | ||
public void run() { | ||
super.run(); | ||
String metadata = getEventMetaData(); | ||
if (metadata != null && metadata.equals("non-crashy")) { | ||
return; | ||
} | ||
crash(2726); | ||
} | ||
} |
Oops, something went wrong.