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

A couple testing tweaks #928

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

A couple testing tweaks #928

wants to merge 2 commits into from

Conversation

fw-immunant
Copy link
Contributor

PR mostly just to run CI.

it might seem like panicking here would speed up debugging, because it would provide a backtrace directly to something approximating the root cause of the translation failure.

sadly, this is not at all the case: `translate_failure` is only called from the top-level `translator::translate` function, which decides whether to call it based on whether the more interesting functions such as `convert_decl` and `convert_main` return `Err(_)`. by the time `translate_failure` runs, the interesting functions have returned and the only relevant info is in the error string that we print *before* panicking. as such, the backtraces always look like this:

thread 'main' panicked at 'Translation failed, see error above', c2rust-transpile/src/translator/mod.rs:486:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/d394408fb38c4de61f765a3ed5189d2731a1da91/library/core/src/panicking.rs:142:14
   2: c2rust_transpile::translator::translate
   3: c2rust_transpile::transpile_single
   4: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   5: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   6: c2rust_transpile::transpile
   7: c2rust_transpile::main

this does not bring joy. we should just exit(1) here.
this makes tests fail at the translation step rather than when C compilation fails due to the failed translation step
@aneksteind
Copy link
Contributor

What's the status of this?

@fw-immunant
Copy link
Contributor Author

fw-immunant commented Jun 6, 2023

What's the status of this?

Someone with a mac needs to triage it. Volunteers welcome, or I can spend some time trying to get a VM to work.

@fw-immunant fw-immunant added the help wanted Extra attention is needed label Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants