Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the main crate workspace crate #246

Merged
merged 2 commits into from Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Expand Up @@ -14,6 +14,10 @@ autoexamples = true
autotests = true
edition = "2018"

[workspace]
members = ['crates/cpp_smoke_test']
exclude = ['crates/without_debuginfo']

[dependencies]
cfg-if = "0.1.6"
rustc-demangle = "0.1.4"
Expand Down
1 change: 0 additions & 1 deletion crates/backtrace-sys/build.rs
Expand Up @@ -95,7 +95,6 @@ fn main() {
"backtrace_qsort",
"backtrace_create_state",
"backtrace_uncompress_zdebug",

// These should be `static` in C, but they aren't...
"macho_get_view",
"macho_symbol_type_relevant",
Expand Down
2 changes: 1 addition & 1 deletion crates/cpp_smoke_test/Cargo.toml
Expand Up @@ -5,7 +5,7 @@ authors = ["Nick Fitzgerald <fitzgen@gmail.com>"]
build = "build.rs"

[build-dependencies]
gcc = "0.3.43"
cc = "1.0"

[dependencies]
backtrace = { path = "../..", features = ["cpp_demangle"] }
4 changes: 1 addition & 3 deletions crates/cpp_smoke_test/build.rs
@@ -1,13 +1,11 @@
extern crate gcc;

fn main() {
compile_cpp();
}

fn compile_cpp() {
println!("cargo:rerun-if-changed=cpp/trampoline.cpp");

gcc::Config::new()
cc::Build::new()
.cpp(true)
.debug(true)
.opt_level(0)
Expand Down
3 changes: 1 addition & 2 deletions crates/cpp_smoke_test/src/lib.rs
@@ -1,3 +1,2 @@
#[test]
fn it_works() {
}
fn it_works() {}
15 changes: 9 additions & 6 deletions crates/cpp_smoke_test/tests/smoke.rs
@@ -1,7 +1,7 @@
extern crate cpp_smoke_test;
extern crate backtrace;
extern crate cpp_smoke_test;

use std::sync::atomic::{ATOMIC_BOOL_INIT, AtomicBool, Ordering};
use std::sync::atomic::{AtomicBool, Ordering};

extern "C" {
fn cpp_trampoline(func: extern "C" fn()) -> ();
Expand All @@ -11,7 +11,7 @@ extern "C" {
#[ignore] // fixme(fitzgen/cpp_demangle#73)
#[cfg(not(target_os = "windows"))]
fn smoke_test_cpp() {
static RAN_ASSERTS: AtomicBool = ATOMIC_BOOL_INIT;
static RAN_ASSERTS: AtomicBool = AtomicBool::new(false);

extern "C" fn assert_cpp_frames() {
let mut physical_frames = Vec::new();
Expand All @@ -26,7 +26,8 @@ fn smoke_test_cpp() {
physical_frames.len() < 4
});

let names: Vec<_> = physical_frames.into_iter()
let names: Vec<_> = physical_frames
.into_iter()
.flat_map(|ip| {
let mut logical_frame_names = vec![];

Expand All @@ -36,8 +37,10 @@ fn smoke_test_cpp() {
logical_frame_names.push(demangled);
});

assert!(!logical_frame_names.is_empty(),
"Should have resolved at least one symbol for the physical frame");
assert!(
!logical_frame_names.is_empty(),
"Should have resolved at least one symbol for the physical frame"
);

logical_frame_names
})
Expand Down