Skip to content

Commit

Permalink
Skip insignificant frames when validating stack frames
Browse files Browse the repository at this point in the history
  • Loading branch information
kattrali committed Oct 19, 2018
1 parent 97f1a05 commit bd2016d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
public class CXXExternalStackElementScenario extends Scenario {
static {
System.loadLibrary("bugsnag-ndk");
System.loadLibrary("monochrome");
System.loadLibrary("entrypoint");
}

Expand Down
7 changes: 3 additions & 4 deletions features/native_crash_handling.feature
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ Feature: Native crash reporting
| Illegal instruction |
| Trace/breakpoint trap |
And the exception "type" equals "c"
And the "method" of stack frame 0 equals "something_innocuous"
And the "file" of stack frame 0 ends with "libmonochrome.so"
And the "method" of stack frame 1 equals "Java_com_bugsnag_android_mazerunner_scenarios_CXXExternalStackElementScenario_crash"
And the "file" of stack frame 1 ends with "libentrypoint.so"
And the first significant stack frame methods and files should match:
| something_innocuous | libmonochrome.so |
| Java_com_bugsnag_android_mazerunner_scenarios_CXXExternalStackElementScenario_crash | libentrypoint.so |
15 changes: 15 additions & 0 deletions features/steps/build_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@
value = read_key_path(find_request(0)[:body], "events.0.exceptions.0.#{keypath}")
assert_includes(possible_values.raw.flatten, value)
end
Then("the first significant stack frame methods and files should match:") do |expected_values|
stacktrace = read_key_path(find_request(0)[:body], "events.0.exceptions.0.stacktrace")
expected_frame_values = expected_values.raw
expected_index = 0
stacktrace.each_with_index do |item, index|
next if expected_index >= expected_frame_values.length
expected_frame = expected_frame_values[expected_index]
next if item["method"].start_with? "bsg_"
next if item["file"].start_with? "/system/"

assert_equal(expected_frame[0], item["method"])
assert(item["file"].end_with?(expected_frame[1]), "'#{item["file"]}' in frame #{index} does not end with '#{expected_frame[1]}'")
expected_index += 1
end
end

Then("the report in request {int} contains the required fields") do |index|
steps %Q{
Expand Down

0 comments on commit bd2016d

Please sign in to comment.