Skip to content

cpu/native: return error code on failed assertion #20419

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

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

benpicco
Copy link
Contributor

Contribution description

When native hits a failed assertion, it will exit but the exit code will still be EXIT_SUCCESS.

Fix this by setting an error exit code in the panic_arch() handler.

Testing procedure

I added an assert(0) in examples/hello-world:

RIOT native interrupts/signals initialized.
RIOT native board initialized.
RIOT native hardware initialization complete.

main(): This is RIOT! (Version: 2024.04-devel-291-gd83ec)
Hello World!
You are running RIOT on a(n) native board.
This board features a(n) native CPU.
examples/hello-world/main.c:32 => *** RIOT kernel panic:
FAILED ASSERTION.

*** halted.


native: exiting
22 benpicco@T430s ~/dev/RIOT/examples/hello-world (git)-[cpu/native_assert-reval] %

Issues/PRs references

@benpicco benpicco requested a review from kaspar030 as a code owner February 22, 2024 15:09
@github-actions github-actions bot added Platform: native Platform: This PR/issue effects the native platform Area: cpu Area: CPU/MCU ports labels Feb 22, 2024
@benpicco benpicco requested a review from maribu February 22, 2024 15:09
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Feb 22, 2024
@maribu maribu enabled auto-merge February 22, 2024 15:28
@riot-ci
Copy link

riot-ci commented Feb 22, 2024

Murdock results

✔️ PASSED

9e9a906 cpu/native: return error code on failed assertion

Success Failures Total Runtime
9997 0 9997 10m:27s

Artifacts

@maribu maribu added this pull request to the merge queue Feb 22, 2024
Merged via the queue into RIOT-OS:master with commit 047fb8d Feb 22, 2024
@benpicco benpicco deleted the cpu/native_assert-reval branch February 23, 2024 01:02
@MrKevinWeiss MrKevinWeiss added this to the Release 2024.04 milestone Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: native Platform: This PR/issue effects the native platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants