Skip to content

Commit

Permalink
chore: update logs and tests for DIFs with embedded sources
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Jan 26, 2023
1 parent 3c4f1c5 commit e1d12db
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
19 changes: 18 additions & 1 deletion src/utils/dif_upload.rs
Expand Up @@ -718,7 +718,8 @@ fn search_difs(options: &DifUpload) -> Result<Vec<DifMatch<'static>>> {
}

pb.finish_and_clear();
println!(

print!(
"{} Found {} debug information {}",
style(">").dim(),
style(collected.len()).yellow(),
Expand All @@ -728,6 +729,22 @@ fn search_difs(options: &DifUpload) -> Result<Vec<DifMatch<'static>>> {
}
);

let count_with_sources = match options.include_sources {
true => collected
.iter()
.filter(|dif| match dif.object() {
Some(object) => object.has_sources(),
None => false,
})
.count(),
false => 0,
};

match count_with_sources {
0 => println!(),
_ => println!(" ({} with embedded sources)", count_with_sources),
}

Ok(collected)
}

Expand Down
@@ -0,0 +1,9 @@
```
$ sentry-cli debug-files upload --include-sources tests/integration/_fixtures/Sentry.Samples.Console.Basic-embedded-sources.pdb
? success
> Found 1 debug information file (1 with embedded sources)
> Resolved source code for 0 debug information files
> Prepared debug information file for upload
> Nothing to upload, all files are on the server

```
Binary file not shown.
8 changes: 4 additions & 4 deletions tests/integration/debug_files/upload.rs
Expand Up @@ -64,11 +64,11 @@ fn command_debug_files_upload_pdb() {
.with_response_body("[]"),
);
register_test("debug_files/debug_files-upload-pdb.trycmd");
register_test("debug_files/debug_files-upload-pdb-include-sources.trycmd");
}

// TODO update once sources are supported by symbolic-debuginfo for PPDB
#[test]
fn command_debug_files_upload_pdb_with_sources() {
fn command_debug_files_upload_pdb_embedded_sources() {
let _chunk_upload = mock_endpoint(
EndpointOptions::new("GET", "/api/0/organizations/wat-org/chunk-upload/", 200)
.with_response_file("debug_files/get-chunk-upload.json"),
Expand All @@ -81,7 +81,7 @@ fn command_debug_files_upload_pdb_with_sources() {
)
.with_response_body(
r#"{
"5f81d6becc51980870acc9f6636ab53d26160763": {
"50dd9456dc89cdbc767337da512bdb36b15db6b2": {
"state": "ok",
"missingChunks": []
}
Expand All @@ -96,7 +96,7 @@ fn command_debug_files_upload_pdb_with_sources() {
)
.with_response_body("[]"),
);
register_test("debug_files/debug_files-upload-pdb-include-sources.trycmd");
register_test("debug_files/debug_files-upload-pdb-embedded-sources.trycmd");
}

#[test]
Expand Down

0 comments on commit e1d12db

Please sign in to comment.