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

test: extend ALPAKA_CHECK to show better error messages #1770

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

psychocoderHPC
Copy link
Member

@psychocoderHPC psychocoderHPC commented Jul 28, 2022

To know where a test fails the line and file can be very useful.

before:

1: ALPAKA_CHECK failed because '!(equals(operandOrig, ret))'
1: ALPAKA_CHECK failed because '!(equals(operandOrig, ret))'

after:

1: ALPAKA_CHECK failed because '!(equals(operandOrig, ret))' in alpaka/test/unit/atomic/src/AtomicTest.cpp:90
1: ALPAKA_CHECK failed because '!(equals(operandOrig, ret))' in alpaka/test/unit/atomic/src/AtomicTest.cpp:96

@sbastrakov sbastrakov changed the title test: extent ALPAKA_CHECK to show better error messages test: extend ALPAKA_CHECK to show better error messages Jul 28, 2022
sbastrakov
sbastrakov previously approved these changes Jul 28, 2022
@psychocoderHPC psychocoderHPC force-pushed the topic-testShowBetterErrorMsg branch from 003f260 to 3c36501 Compare July 29, 2022 09:02
@psychocoderHPC psychocoderHPC force-pushed the topic-testShowBetterErrorMsg branch 7 times, most recently from aef5b7d to 2ee4cdf Compare July 29, 2022 14:57
To know where a test fails the line and file can be very usefull.
@psychocoderHPC psychocoderHPC force-pushed the topic-testShowBetterErrorMsg branch 2 times, most recently from 294b1a5 to e4c0e1b Compare August 1, 2022 13:02
@psychocoderHPC psychocoderHPC marked this pull request as draft August 2, 2022 11:09
@psychocoderHPC psychocoderHPC force-pushed the topic-testShowBetterErrorMsg branch from 91d7d21 to 78e212e Compare August 2, 2022 11:41
Disable printf to avoid compiler error: `error: stack size limit
exceeded (181896) in _ZN6alpaka...`
@psychocoderHPC psychocoderHPC force-pushed the topic-testShowBetterErrorMsg branch from 78e212e to ef0dfb7 Compare August 3, 2022 08:37
@j-stephan
Copy link
Member

What is the state here?

Comment on lines +24 to +25
acc.cout << "ALPAKA_CHECK failed because '!(" << #expression << ")' in " << file << ":" << line \
<< "\n"; \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
acc.cout << "ALPAKA_CHECK failed because '!(" << #expression << ")' in " << file << ":" << line \
<< "\n"; \
acc.cout << "ALPAKA_CHECK failed because '!(" << #expression << ")' in " << __FILE__<< ":" << __LINE__\
<< "\n"; \

You should be able to use the file and line macros directly inside the macro definition and not pass them around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants