tarpaulin icon indicating copy to clipboard operation
tarpaulin copied to clipboard

Cannot run cargo-tarpulin in a pyo3 project

Open noamteyssier opened this issue 1 year ago • 18 comments

Not sure if this is a feature request or a bug - but am entering it into the bug system. Happy to provide more information / help anyway I can.

Bug Description

cargo-tarpaulin will fail with linking errors if run on a pyo3 project. Attached the full error here tarpaulin_error.txt

Reproducing

This can be reproduced by just creating a new pyo3 project with maturin

maturin new example_pyo3
cd example_pyo3
cargo-tarpaulin

Expected Behavior

I was expecting this to work like purely rust projects.

noamteyssier avatar Sep 18 '22 22:09 noamteyssier

I am facing the same issue :| @noamteyssier did you find any workaround ?

ketkarameya avatar Dec 28 '22 22:12 ketkarameya

Just an FYI I am working on this, the issue is -Clink-dead-code causes the linker to have a hissy fit with some FFI libs. Unfortunately, it also means that for ptrace coverage whole functions can end up marked as not-coverable just because no tests use them so they contribute no executable instructions to final binary. This means the llvm coverage via --engine llvm should be preferred for maximum accuracy.

EDIT: This can be tested via the feat/no-dead-code branch just pushed!

xd009642 avatar Jan 29 '23 18:01 xd009642

And it all passes and works in examples I've checked so I'm going to go ahead and merge :tada:

xd009642 avatar Jan 29 '23 20:01 xd009642

@xd009642 I was testing your fix.

I got this error on cargo-tarpaulin version: 0.25.0 when I tried to run the command cargo tarpaulin --no-dead-code

ERROR cargo_tarpaulin: Failed to run tests: A segfault occurred while executing tests
Error: "Failed to run tests: A segfault occurred while executing tests"

I am running this tool over piranha

ketkarameya avatar Feb 01 '23 05:02 ketkarameya

Did you add --engine llvm as well?

xd009642 avatar Feb 01 '23 07:02 xd009642

Ok. I tried that. I got :

error: Broken pipe (os error 32)
warning: build failed, waiting for other jobs to finish...
error: could not compile `indoc` due to 2 previous errors
Feb 01 14:34:55.512 ERROR cargo_tarpaulin: Failed to compile tests!
error: linking with `cc` failed: exit status: 1

...

Error: "Failed to compile tests!\nerror: linking with `cc` failed: exit status: 1\n  |\n  = note: \"cc\" \"-Wl,--version-script=/tmp/rustcOcFiGe/list\" \"-m64\" \"/tmp/rustcOcFiGe/symbols.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.0.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.1.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.10.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.11.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.12.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.13.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.14.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.15.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.2.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.3.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.4.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.5.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.6.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.7.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.8.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.indoc.b245230d-cgu.9.rcgu.o\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.68ap3v3rxjj0rf0.rcgu.rmeta\" \"/home/user/piranha/target/debug/deps/indoc-0631006aaa1110f0.l0gf9rpa1xqcgxv.rcgu.o\" \"-Wl,--as-needed\" \"-L\" \"/home/user/piranha/target/debug/deps\" \"-L\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib\" \"-Wl,-Bstatic\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libprofiler_builtins-9b09c3cec8a5576d.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libproc_macro-bfb4a82e06efc4d7.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-2a15b3cd0948397b.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-8f251cec381c549e.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-e8062a7445a64946.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-431dd9a65eafb1c5.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-5d5a85338b125cfb.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-3cf84ad460df483a.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-5a049915d61fbb5d.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-aabc21fad3549c98.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-dac6992ac677a0cb.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-3cd49acf880d0306.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-6c93f515800d4657.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-8a30445cf40d74de.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-47cbfc4f5b0f6f87.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-0b6ce813aa5d1704.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-f0ffbd64420a69ad.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-60668236929c1cf5.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-2fb2d4481260f706.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-c888e061ea504c93.rlib\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-93189d615c3f2d6a.rlib\" \"-Wl,-Bdynamic\" \"-lgcc_s\" \"-lutil\" \"-lrt\" \"-lpthread\" \"-lm\" \"-ldl\" \"-lc\" \"-Wl,--eh-frame-hdr\" \"-Wl,-znoexecstack\" \"-L\" \"/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib\" \"-o\" \"/home/user/piranha/target/debug/deps/libindoc-0631006aaa1110f0.so\" \"-Wl,--gc-sections\" \"-shared\" \"-Wl,-zrelro,-znow\" \"-nodefaultlibs\" \"-u\" \"__llvm_profile_runtime\"\n  = note: /usr/bin/ld: /home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libprofiler_builtins-9b09c3cec8a5576d.rlib(InstrProfilingPlatformLinux.o): relocation R_X86_64_PC32 against undefined hidden symbol `__ehdr_start' can not be used when making a shared object\n          /usr/bin/ld: final link failed: nonrepresentable section on output\n          collect2: error: ld returned 1 exit status\n          \n\n"

ketkarameya avatar Feb 01 '23 14:02 ketkarameya

So @ketkarameya I know this can be the worst thing to hear but "it works on my machine". At the very bottom is the output, also here is my --print-rust-flags output:

cargo tarpaulin --engine llvm --no-dead-code --print-rust-flags
Feb 01 18:18:37.518  INFO cargo_tarpaulin::config: Creating config
Feb 01 18:18:37.785  INFO cargo_tarpaulin: Printing `RUSTFLAGS`
RUSTFLAGS="-Cdebuginfo=2 --cfg=tarpaulin -Cinstrument-coverage"

It'll be worth checking that to make sure there's nothing fishy going on

cargo tarpaulin --no-dead-code --engine llvm
Feb 01 18:04:07.222  INFO cargo_tarpaulin::config: Creating config
Feb 01 18:04:07.386  INFO cargo_tarpaulin: Running Tarpaulin
Feb 01 18:04:07.386  INFO cargo_tarpaulin: Building project
Feb 01 18:04:07.386  INFO cargo_tarpaulin::cargo: Cleaning project
   Compiling cc v1.0.79
   Compiling libc v0.2.139
   Compiling autocfg v1.1.0
   Compiling proc-macro2 v1.0.50
   Compiling unicode-ident v1.0.6
   Compiling quote v1.0.23
   Compiling syn v1.0.107
   Compiling cfg-if v1.0.0
   Compiling memchr v2.5.0
   Compiling target-lexicon v0.12.5
   Compiling scopeguard v1.1.0
   Compiling regex-syntax v0.6.28
   Compiling crossbeam-utils v0.8.14
   Compiling version_check v0.9.4
   Compiling aho-corasick v0.7.20
   Compiling once_cell v1.17.0
   Compiling pyo3-build-config v0.17.3
   Compiling memoffset v0.7.1
   Compiling tree-sitter v0.20.9
   Compiling crossbeam-epoch v0.9.13
   Compiling strsim v0.10.0
   Compiling regex v1.7.1
   Compiling proc-macro-error-attr v1.0.4
   Compiling io-lifetimes v1.0.4
   Compiling ident_case v1.0.1
   Compiling fnv v1.0.7
   Compiling proc-macro-error v1.0.4
   Compiling lock_api v0.4.9
   Compiling rustix v0.36.7
   Compiling parking_lot_core v0.9.6
   Compiling crossbeam-deque v0.8.2
   Compiling crossbeam-channel v0.5.6
   Compiling memoffset v0.6.5
   Compiling rayon-core v1.10.2
   Compiling darling_core v0.14.2
   Compiling serde v1.0.152
   Compiling pyo3-ffi v0.17.3
   Compiling bitflags v1.3.2
   Compiling linux-raw-sys v0.1.4
   Compiling log v0.4.17
   Compiling smallvec v1.10.0
   Compiling crossbeam-queue v0.3.8
   Compiling pyo3 v0.17.3
   Compiling pyo3-macros-backend v0.17.3
   Compiling num_cpus v1.15.0
   Compiling either v1.8.1
   Compiling parking_lot v0.12.1
   Compiling is-terminal v0.4.2
   Compiling tree-sitter-java v0.20.0
   Compiling tree-sitter-typescript v0.20.2
   Compiling tree-sitter-go v0.19.1 (https://github.com/uber/tree-sitter-go.git?rev=8f807196afab4a1a1256dbf62a011020c6fe7745#8f807196)
   Compiling tree-sitter-kotlin v0.2.11 (https://github.com/ketkarameya/tree-sitter-kotlin.git?rev=a87ddd003368e068563f1cc478a1b2a3f9d73b60#a87ddd00)
   Compiling tree-sitter-python v0.20.2
   Compiling tree-sitter-swift v0.3.4
   Compiling termcolor v1.2.0
   Compiling os_str_bytes v6.4.1
   Compiling unindent v0.1.11
   Compiling heck v0.4.1
   Compiling serde_json v1.0.91
   Compiling indoc v1.0.9
   Compiling serde_derive v1.0.152
   Compiling clap_lex v0.3.1
   Compiling rayon v1.6.1
   Compiling crossbeam v0.8.2
   Compiling piranha v0.2.1 (/home/daniel/personal/meta/piranha)
   Compiling rand v0.4.6
   Compiling darling_macro v0.14.2
   Compiling clap_derive v4.1.0
   Compiling atty v0.2.14
   Compiling itoa v1.0.5
   Compiling humantime v2.1.0
   Compiling pyo3-macros v0.17.3
   Compiling ryu v1.0.12
   Compiling lazy_static v1.4.0
   Compiling remove_dir_all v0.5.3
   Compiling arc-swap v1.6.0
   Compiling tempdir v0.3.7
   Compiling colored v2.0.0
   Compiling env_logger v0.10.0
   Compiling darling v0.14.2
   Compiling jwalk v0.8.1
   Compiling derive_builder_core v0.12.0
   Compiling getset v0.1.2
   Compiling toml v0.5.11
   Compiling itertools v0.10.5
   Compiling derive_builder_macro v0.12.0
   Compiling tree-sitter-traversal v0.1.2
   Compiling json v0.12.4
   Compiling clap v4.1.4
   Compiling pyo3-log v0.7.0
   Compiling derive_builder v0.12.0
    Finished test [unoptimized + debuginfo] target(s) in 9m 54s
Feb 01 18:14:02.008  INFO cargo_tarpaulin::process_handling: running /home/daniel/personal/meta/piranha/target/debug/deps/polyglot_piranha-a4b35733bed3dc0d
Feb 01 18:14:02.008  INFO cargo_tarpaulin::process_handling: Setting LLVM_PROFILE_FILE

running 58 tests
test models::rule::rule_test::test_get_edit_for_context_negative ... ok
test models::rule::rule_test::test_get_edit_for_context_positive ... ok
test models::rule::rule_test::test_get_edit_negative_recursive ... ok
test models::rule::rule_test::test_get_edit_positive_recursive ... ok
test models::rule::rule_test::test_rule_try_instantiate_negative - should panic ... ok
test models::rule::rule_test::test_rule_try_instantiate_positive ... ok
test models::scopes::scopes_test::test_get_scope_query_negative - should panic ... ok
test models::scopes::scopes_test::test_get_scope_query_positive ... ok
test models::source_code_unit::source_code_unit_test::test_apply_edit_comma_handling_via_grammar ... ok
test models::source_code_unit::source_code_unit_test::test_apply_edit_comma_handling_via_regex ... ok
test models::source_code_unit::source_code_unit_test::test_apply_edit_negative - should panic ... ok
test models::source_code_unit::source_code_unit_test::test_apply_edit_positive ... ok
test models::source_code_unit::source_code_unit_test::test_persist_delete_consecutive_lines ... ok
test models::source_code_unit::source_code_unit_test::test_persist_delete_file_when_empty ... ok
test models::source_code_unit::source_code_unit_test::test_persist_do_not_delete_consecutive_lines ... ok
test models::source_code_unit::source_code_unit_test::test_persist_do_not_delete_file_when_empty ... ok
test models::source_code_unit::source_code_unit_test::test_satisfies_constraints_negative ... ok
test models::source_code_unit::source_code_unit_test::test_satisfies_constraints_positive ... ok
test tests::test_piranha_go::test_builtin_boolean_expression_simplify ... ok
test tests::test_piranha_go::test_builtin_statement_cleanup ... ok
test tests::test_piranha_go::test_const_same_file ... ok
test tests::test_piranha_go::test_match_only_for_loop ... ok
test tests::test_piranha_go::test_match_only_go_stmt_for_loop ... ok
test tests::test_piranha_java::test_consecutive_scope_level_rules ... ok
test tests::test_piranha_java::test_feature_flag_system_1_control ... ok
test tests::test_piranha_java::test_feature_flag_system_1_treated ... ok
test tests::test_piranha_java::test_feature_flag_system_2_control ... ok
test tests::test_piranha_java::test_feature_flag_system_2_treated ... ok
test tests::test_piranha_java::test_insert_field_and_initializer ... ok
test tests::test_piranha_java::test_java_match_only ... ok
test tests::test_piranha_java::test_new_line_character_used_in_string_literal ... ok
test tests::test_piranha_java::test_non_seed_user_rule ... ok
test tests::test_piranha_java::test_scenarios_find_and_propagate ... ok
test tests::test_piranha_java::test_scenarios_find_and_propagate_panic - should panic ... ok
test tests::test_piranha_kt::test_feature_flag_system_1_control ... ok
test tests::test_piranha_kt::test_feature_flag_system_1_treated ... ok
test tests::test_piranha_kt::test_feature_flag_system_2_control ... ok
test tests::test_piranha_kt::test_feature_flag_system_2_treated ... ok
test tests::test_piranha_kt::test_file_scoped_chain_rules ... ok
test tests::test_piranha_python::test_delete_modify_str_literal_from_list ... ok
test tests::test_piranha_python::test_match_only ... ok
test tests::test_piranha_swift::test_cascading_delete_file ... ok
test tests::test_piranha_swift::test_cascading_delete_file_custom_global_tag ... ok
test tests::test_piranha_swift::test_cleanup_rules_file ... ok
test tests::test_piranha_ts::test_find_fors ... ok
test tests::test_piranha_ts::test_find_fors_within_functions ... ok
test tests::test_piranha_ts::test_find_fors_within_functions_not_within_whiles ... ok
test tests::test_piranha_tsx::test_find_props_identifiers_within_variable_declarators_not_within_divs ... ok
test tests::test_piranha_tsx::test_match_find_props_identifiers_within_b_jsx_elements ... ok
test tests::test_piranha_tsx::test_ts_match_only_find_fors ... ok
test utilities::tree_sitter_utilities::tree_sitter_utilities_test::test_get_all_matches_for_query_negative ... ok
test utilities::tree_sitter_utilities::tree_sitter_utilities_test::test_get_all_matches_for_query_positive ... ok
test utilities::tree_sitter_utilities::tree_sitter_utilities_test::test_substitute_tags ... ok
test utilities::utilities_test::test_find_file_negative - should panic ... ok
test utilities::utilities_test::test_find_file_positive ... ok
test utilities::utilities_test::test_read_file ... ok
test utilities::utilities_test::test_read_toml ... ok
test utilities::utilities_test::test_read_toml_default ... ok

test result: ok. 58 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 97.62s

Feb 01 18:15:39.634  INFO cargo_tarpaulin::statemachine::instrumented: For binary: target/debug/deps/polyglot_piranha-a4b35733bed3dc0d
Feb 01 18:15:39.634  INFO cargo_tarpaulin::statemachine::instrumented: Generated: target/tarpaulin/profraws/polyglot_piranha-a4b35733bed3dc0d_11130573668251958968_0-16649.profraw
Feb 01 18:16:06.219  INFO cargo_tarpaulin::process_handling: running /home/daniel/personal/meta/piranha/target/debug/deps/polyglot_piranha-ebef5e6694ea0b20
Feb 01 18:16:06.219  INFO cargo_tarpaulin::process_handling: Setting LLVM_PROFILE_FILE

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Feb 01 18:16:06.230  INFO cargo_tarpaulin::statemachine::instrumented: For binary: target/debug/deps/polyglot_piranha-ebef5e6694ea0b20
Feb 01 18:16:06.230  INFO cargo_tarpaulin::statemachine::instrumented: Generated: target/tarpaulin/profraws/polyglot_piranha-ebef5e6694ea0b20_13486030664074185710_0-16971.profraw
Feb 01 18:16:06.611  INFO cargo_tarpaulin::report: Coverage Results:
|| Uncovered Lines:
|| src/lib.rs: 44, 46, 49-52, 55-56, 59-68, 78
|| src/main.rs: 25-27, 29, 31, 33-34, 36-37, 40, 44, 47-49, 52
|| src/models/edit.rs: 42, 67-75, 77-78, 80
|| src/models/language.rs: 57-58, 72, 74-75, 187
|| src/models/matches.rs: 37, 92, 104
|| src/models/piranha_arguments.rs: 159, 163, 165, 168-174, 176-179, 181-184, 186-189, 193-203, 205-208, 210-213, 215-219, 221-224
|| src/models/piranha_output.rs: 42, 62-63, 66-67
|| src/models/rule_graph.rs: 72-75, 77
|| src/models/rule_store.rs: 82, 209-211, 236
|| src/models/source_code_unit.rs: 200-204, 206, 233-235, 237, 324, 423, 425, 427-428, 498, 520, 606-607
|| src/utilities/mod.rs: 46-47, 103, 105-106, 108-109
|| src/utilities/tree_sitter_utilities.rs: 256, 260-262, 267-269
|| Tested/Total Lines:
|| src/lib.rs: 64/83
|| src/main.rs: 0/15
|| src/models/constraint.rs: 1/1
|| src/models/default_configs.rs: 36/36
|| src/models/edit.rs: 5/18
|| src/models/language.rs: 60/66
|| src/models/matches.rs: 7/10
|| src/models/piranha_arguments.rs: 40/90
|| src/models/piranha_output.rs: 10/15
|| src/models/rule.rs: 40/40
|| src/models/rule_graph.rs: 19/24
|| src/models/rule_store.rs: 98/103
|| src/models/source_code_unit.rs: 277/296
|| src/models/unit_tests/scopes_test.rs: 47/47
|| src/models/unit_tests/source_code_unit_test.rs: 27/27
|| src/utilities/mod.rs: 28/35
|| src/utilities/tree_sitter_utilities.rs: 131/138
|| 
85.25% coverage, 890/1044 lines covered

xd009642 avatar Feb 01 '23 18:02 xd009642

Thanks a lot. I will compare and check . I ll let you know.

ketkarameya avatar Feb 01 '23 18:02 ketkarameya

Actually, you know what, I ll try to get it running on CI (It's alright if I am unable to run it locally :) ) After seeing that you are able to run it, it gives me more hope to get it runnning on CI

ketkarameya avatar Feb 01 '23 18:02 ketkarameya

@xd009642 I have been trying to set up tarpaulin with github actions using the documentation. I am getting this error My configuration

ketkarameya avatar Feb 03 '23 17:02 ketkarameya

It looks like the LLVM version in the rust docker images doesn't have the llvm profiling runtime (I'll need to look into this I'll make another issue for it later). I'd recommend instead installing tarpaulin via something like https://github.com/cargo-bins/cargo-binstall if you want to cut down on CI runtime instead in the meantime

xd009642 avatar Feb 03 '23 17:02 xd009642

I see. Thanks for pointing me to binstall

ketkarameya avatar Feb 03 '23 17:02 ketkarameya

I ran into a similar issue link when trying to collect coverage in my workspace, when running tarpaulin in one package it would work fine but then another package would fail with the issue in the link.

I was able to get around this using the --no-dead-code flag and everything works now, not sure why the sqlx_macros package was building fine in some of my workspaces' packages though.

Thought I'd share here in case it helps anyone else since I have nothing but a very vague assumptions as to what the actual underlying problem is.

cleverjam avatar Jul 25 '23 00:07 cleverjam

Anyone figured out another workaround for this, the --engine llvm --no-dead-code doesn't work for me, I'm getting error: Error: "Failed to run tests: A segfault occurred while executing tests"

planck-length avatar Aug 09 '23 16:08 planck-length

@planck-length if you have an open source project I can check I can take a look at it

xd009642 avatar Aug 09 '23 19:08 xd009642

@planck-length if you have an open source project I can check I can take a look at it

Don't have an open source project but I can provide you with more info, let me know what you would like to know. I also ran previous command with nightly toolchain and got different error: Inconsistency detected by ld.so: dl-lookup.c: 972: _dl_setup_hash: Assertion `(bitmask_nwords & (bitmask_nwords - 1)) == 0' failed! Error: "Test failed during run" Error: The process '/home/runner/.cargo/bin/cargo' failed with exit code 1

planck-length avatar Aug 10 '23 08:08 planck-length

@planck-length if you have an open source project I can check I can take a look at it

Don't have an open source project but I can provide you with more info, let me know what you would like to know. I also ran previous command with nightly toolchain and got different error: Inconsistency detected by ld.so: dl-lookup.c: 972: _dl_setup_hash: Assertion `(bitmask_nwords & (bitmask_nwords - 1)) == 0' failed! Error: "Test failed during run" Error: The process '/home/runner/.cargo/bin/cargo' failed with exit code 1

Ok this one is resolved by updating libraries to latest, we're back on the previous one. For refference here's my cargo.toml

[package]
name = "my_project"
version = "0.1.0"
edition = "2021"
publish = ["private_registry"]


# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "my_project"
path = "src/lib.rs"
crate-type = ["cdylib"]

[dependencies]
pcap-parser = "0.14.1"
nom="7"
arrow = "45"
parquet = "45"
pyo3 = { version = "0.19.2", features = ["extension-module"] }

planck-length avatar Aug 10 '23 09:08 planck-length

Ok my bad, I forgot to mention .tarpaulin.toml I had. It was configured:

[run-types]
all_features=true
[report]
fail-under=10

So without .tarpaulin.toml running cargo tarpaulin --engine llvm --no-dead-code works.

planck-length avatar Aug 10 '23 09:08 planck-length

Going to close this issue as resolved as there's been no further requests RE pyo3 support

xd009642 avatar Apr 27 '24 11:04 xd009642