Skip to content

Don't use _ASSERTE in runtime tests#68299

Merged
lambdageek merged 5 commits into
dotnet:mainfrom
lambdageek:fix-gh-68279
Apr 21, 2022
Merged

Don't use _ASSERTE in runtime tests#68299
lambdageek merged 5 commits into
dotnet:mainfrom
lambdageek:fix-gh-68279

Conversation

@lambdageek

@lambdageek lambdageek commented Apr 20, 2022

Copy link
Copy Markdown
Member

In debug configurations, use of _ASSERTE requires the PAL_frpintf function and linking with the coreclrpal static library.

Instead just use assert() from <assert.h>

Fixes #68279

In debug configurations, use of assert() (aka _ASSERTE) requires the
PAL_frpintf function

Fixes dotnet#68279
@ghost ghost assigned lambdageek Apr 20, 2022
@ghost

ghost commented Apr 20, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

Issue Details

In debug configurations, use of assert() (aka _ASSERTE) requires the PAL_frpintf function

Fixes #68279

Author: lambdageek
Assignees: lambdageek
Labels:

area-Diagnostics-coreclr

Milestone: -

@lambdageek lambdageek added area-PAL-coreclr only for closed issues and removed area-Diagnostics-coreclr labels Apr 20, 2022
@lambdageek lambdageek requested a review from trylek April 20, 2022 20:57
Comment thread src/tests/CMakeLists.txt Outdated
@lambdageek

Copy link
Copy Markdown
Member Author

Do we have a CI leg that will build the runtime tests in the debug configuration?

@trylek trylek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM but I'd welcome confirmation from JanV who's the PAL expert.

@trylek trylek requested a review from janvorli April 20, 2022 21:03
@trylek

trylek commented Apr 20, 2022

Copy link
Copy Markdown
Member

AFAIK we only do checked configurations in the lab as debug is prohibitively slow.

Comment thread src/tests/CMakeLists.txt Outdated
@lambdageek lambdageek added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Apr 21, 2022
That macro requires linking the coreclrpal static library, which the
runtime tests don't currently do.
@lambdageek

Copy link
Copy Markdown
Member Author

I'm going to try to change this PR so that the profiler tests don't depend on the PAL.

@lambdageek

Copy link
Copy Markdown
Member Author

AFAIK we only do checked configurations in the lab as debug is prohibitively slow.

Maybe we should do a debug run with Mono - we don't have as noticeable a difference, I think (nearly all of our asserts are on in Release, too). /cc @steveisok - maybe a Linux x64 debug build that runs the runtime tests (also debug) in the rolling builds?

@lambdageek lambdageek changed the title link coreclrpal static library into tests that use pal.h Don't use _ASSERTE in runtime tests Apr 21, 2022
@lambdageek lambdageek removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Apr 21, 2022
Comment thread src/tests/CMakeLists.txt Outdated

# Add this subdir. We install the headers for the jit.
add_subdirectory(../coreclr/pal/prebuilt/inc ../coreclr/pal/prebuilt/inc)
add_subdirectory(${CLR_REPO_ROOT_DIR}/src/coreclr/pal/prebuilt/inc ../coreclr/pal/prebuilt/inc)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We could use: ${CLR_ARTIFACTS_OBJ_DIR}/coreclr/pal/prebuilt/inc as we have used in other places for abs. path.

All tests were green without the second arg, so it's probably just copy pasted and actually not needed by anything.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Leaving out the binary dir is an error:

CMake Error at CMakeLists.txt:15 (add_subdirectory):
  add_subdirectory not given a binary directory but the given source
  directory
  "/home/aleksey/working/dotnet-runtime/src/coreclr/pal/prebuilt/inc" is not
  a subdirectory of "/home/aleksey/working/dotnet-runtime/src/tests".  When
  specifying an out-of-tree source a binary directory must be explicitly
  specified.

Using ${CLR_ARTIFACTS_OBJ_DIR}/coreclr/pal/prebuilt/inc works, except I'm not actually convinced it's the right thing. the normal coreclr cmake stuff goes to artifacts/obj/coreclr/<<Linux.x64.Debug>>/pal/prebuilt/inc. so we're making another copy. In which case it actually feels more correct to just drop it into a subdirectory of the runtime tests' binary dir. somehting like add_subdirectory (${CLR_REPO_ROOT_DIR}/src/coreclr/pal/prebuilt/inc coreclrpal)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yup, short paths would be nice. Some files have name clashes (canonical example is: config.h which comes from multiple places), I think that's why maintaining the same hierarchy under obj is used for uniqueness.

@lambdageek lambdageek merged commit 882eb6c into dotnet:main Apr 21, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-PAL-coreclr only for closed issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[devloop] Debug build linker errors in tests on Unix

5 participants