Skip to content

[tests] Conditionally skip valgrind xfails using llvm::sys #281

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 5 commits into from
May 19, 2024

Conversation

aaronj0
Copy link
Collaborator

@aaronj0 aaronj0 commented May 14, 2024

No description provided.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@vgvassilev vgvassilev left a comment

Choose a reason for hiding this comment

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

Nice!

@aaronj0
Copy link
Collaborator Author

aaronj0 commented May 14, 2024

This doesn't seem to work yet, I think we should hold on merging it

@vgvassilev
Copy link
Contributor

Yeah, just noticed that...

@aaronj0
Copy link
Collaborator Author

aaronj0 commented May 14, 2024

strange, this was building locally with no problems

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.20%. Comparing base (01b5bc3) to head (90c9bab).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #281       +/-   ##
===========================================
+ Coverage   54.31%   72.20%   +17.89%     
===========================================
  Files           8        8               
  Lines        2957     2961        +4     
===========================================
+ Hits         1606     2138      +532     
+ Misses       1351      823      -528     

see 4 files with indirect coverage changes

see 4 files with indirect coverage changes

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

#ifndef __APPLE__
#include <valgrind/valgrind.h>
#endif //__APPLE__

#ifdef __APPLE__
#define RUNNING_ON_VALGRIND 0
#endif //__APPLE__

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
#ifndef __APPLE__
#include <valgrind/valgrind.h>
#endif //__APPLE__
#ifdef __APPLE__
#define RUNNING_ON_VALGRIND 0
#endif //__APPLE__
#include "llvm/Support/Valgrind.h"

Copy link
Collaborator Author

@aaronj0 aaronj0 May 16, 2024

Choose a reason for hiding this comment

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

this doesn't work as the preprocessor macro isn't visible anymore. Maybe switching to the original usage of llvm::sys::RunningOnValgrind will work, but it uses the same directive to determine if we are running on valgrind.. This way we avoid the extra function calls

Copy link
Contributor

Choose a reason for hiding this comment

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

Which preprocessor macro? How does this work for llvm then?

Copy link
Collaborator Author

@aaronj0 aaronj0 May 17, 2024

Choose a reason for hiding this comment

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

it's something like:

#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
 
bool llvm::sys::RunningOnValgrind() {
  return RUNNING_ON_VALGRIND;
}
 
#else  // !HAVE_VALGRIND_VALGRIND_H
 
bool llvm::sys::RunningOnValgrind() {
  return false;
}

Let me try again with the previous usage to see if it works now, with the apt install

update : it doesn't seem to work..I think we can go ahead with the current working implementation

Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately I do not think so. Do we need to rebuild the cached llvm or something?

Copy link
Collaborator Author

@aaronj0 aaronj0 May 17, 2024

Choose a reason for hiding this comment

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

@vgvassilev Ah I think I got it: we aren't setting HAVE_VALGRIND_VALGRIND_H in the llvm config, but it is something that should be automatically checked and set by llvm's cmake:

check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)

It's used in llvm/Support/Valgrind to conditionally include the valgrind/valgrind.h headers.

But doesn't happen because we use a cached llvm that was built without valgrind at the time of build.
I think we need to rebuild the cache on all the platforms, after installing valgrind(on ubuntu) and it should work.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@aaronj0 aaronj0 added the tests label May 17, 2024
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@vgvassilev vgvassilev merged commit ecb1b33 into compiler-research:main May 19, 2024
46 of 48 checks passed
@aaronj0 aaronj0 deleted the unittest-patch branch April 22, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants