-
Notifications
You must be signed in to change notification settings - Fork 6
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
Install missing dependencies MacOS cppyy jobs #125
Install missing dependencies MacOS cppyy jobs #125
Conversation
a402ced
to
ddc7891
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this. The changes look good to me.
If you can make the change I have specified, it would be helpful. skip
should only be used when we are missing libraries/dependencies, otherwise it should always be xfail
.
@@ -7,15 +7,12 @@ | |||
os.path.exists(os.path.join(os.path.sep, 'usr', 'local', 'include', 'boost'))): | |||
noboost = True | |||
|
|||
|
|||
@mark.skipif(noboost == True, reason="boost not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This skip tag is default on upstream cppyy should not be removed as it will cause the tests to run on platforms that do not have libboost
installed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Then we need a better test to check if boost is on the system. Its check to just see if /usr/local/include/boost exists is too basic and only applies to Linux. MacOS doesn't put them there for both homebrew and Macports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about we do something like this:
try:
cppyy.include('boost/any.hpp')
noboost = True
except ImportError:
noboost = False
@@ -67,8 +64,6 @@ def test02_any_usage(self): | |||
extract = boost.any_cast[std.vector[int]](val) | |||
assert len(extract) == 200 | |||
|
|||
|
|||
@mark.skipif(((noboost == True) or IS_MAC_ARM or IS_MAC_X86), reason="boost not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we can remove the or IS_MAC_ARM or IS_MAC_X86
part, and retain the tag as mentioned in the above comment
@@ -92,8 +87,6 @@ class Derived : boost::ordered_field_operators<Derived>, boost::ordered_field_op | |||
|
|||
assert cppyy.gbl.boost_test.Derived | |||
|
|||
|
|||
@mark.skipif(noboost == True, reason="boost not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above comment
@@ -11,8 +11,6 @@ | |||
if os.path.exists(p): | |||
eigen_path = p | |||
|
|||
|
|||
@mark.skipif(eigen_path is None, reason="Eigen not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this tag as well
@@ -135,7 +128,6 @@ class C { }; } """) | |||
assert type(boost.get['BV::C'](v[2])) == cpp.BV.C | |||
|
|||
|
|||
@mark.skipif(((noboost == True) or IS_MAC_ARM or IS_MAC_X86), reason="boost not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we can remove the or IS_MAC_ARM or IS_MAC_X86
, and retain the tag as mentioned in the above comment
@@ -148,7 +146,6 @@ def test04_resizing_through_assignment(self): | |||
assert a.size() == 9 | |||
|
|||
|
|||
@mark.skipif(eigen_path is None, reason="Eigen not found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this tag as well
Hi @aaronj0, can we do this diff --git a/test/test_boost.py b/test/test_boost.py
index a000de3..3204993 100644
--- a/test/test_boost.py
+++ b/test/test_boost.py
@@ -1,11 +1,15 @@
import py, os, sys
+import cppyy
from pytest import mark, raises, skip
from .support import setup_make, IS_CLANG_REPL, IS_MAC_X86, IS_MAC_ARM
-noboost = False
-if not (os.path.exists(os.path.join(os.path.sep, 'usr', 'include', 'boost')) or \
- os.path.exists(os.path.join(os.path.sep, 'usr', 'local', 'include', 'boost'))):
- noboost = True
+noboost = not cppyy.gbl.Cpp.Evaluate("""
+ #if __has_include("boost/any.hpp")
+ true
+ #else
+ false
+ #endif
+""")
@mark.skipif(noboost == True, reason="boost not found")
diff --git a/test/test_eigen.py b/test/test_eigen.py
index 187e244..fcce273 100644
--- a/test/test_eigen.py
+++ b/test/test_eigen.py
@@ -1,26 +1,28 @@
import py, os, sys
+import cppyy
from pytest import mark, raises
from .support import setup_make, IS_CLANG_REPL, IS_MAC_X86
inc_paths = [os.path.join(os.path.sep, 'usr', 'include'),
os.path.join(os.path.sep, 'usr', 'local', 'include')]
-eigen_path = None
-for p in inc_paths:
- p = os.path.join(p, 'eigen3')
- if os.path.exists(p):
- eigen_path = p
+noeigen = not cppyy.gbl.Cpp.Evaluate("""
+ #if __has_include("eigen3/Eigen/Dense")
+ true
+ #else
+ false
+ #endif
+""")
-@mark.skipif(eigen_path is None, reason="Eigen not found")
+@mark.skipif(noeigen == True, reason="Eigen not found")
class TestEIGEN:
def setup_class(cls):
import cppyy, warnings
- cppyy.add_include_path(eigen_path)
with warnings.catch_warnings():
warnings.simplefilter('ignore')
- cppyy.include('Eigen/Dense')
+ cppyy.include('eigen3/Eigen/Dense')
@mark.xfail
def test01_simple_matrix_and_vector(self):
@@ -148,15 +150,14 @@ class TestEIGEN:
assert a.size() == 9
-@mark.skipif(eigen_path is None, reason="Eigen not found")
+@mark.skipif(noeigen == True, reason="Eigen not found")
class TestEIGEN_REGRESSIOn:
def setup_class(cls):
import cppyy, warnings
- cppyy.add_include_path(eigen_path)
with warnings.catch_warnings():
warnings.simplefilter('ignore')
- cppyy.include('Eigen/Dense')
+ cppyy.include('eigen3/Eigen/Dense')
@mark.xfail(condition=IS_MAC_X86 and (not IS_CLANG_REPL), reason="Errors out on OS X Cling")
def test01_use_of_Map(self): ? |
Yes, this seems valid. I propose we should verify the same on platforms without eigen and boost, and an easy way would be to drop their installations from the workflow on this PR temporarily(and add back the tests that were completely dropped) @mcbarton Can you try to apply these suggestions? |
85473ba
to
3c1a374
Compare
@aaronj0 I've discussed this PR with @Vipul-Cariappa , and I said it would be ok for him to take this PR forward, and apply the suggestions he made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mcbarton. These changes look good. I have updated it with the changes I had mentioned previously in one of my comments.
Looking at the logs, OSX with clang-repl is not able to find eigen.
But OSX with cling is able to find eigen.
No issues with boost.
Can you look into this. Otherwise this is ready to be merged.
Its probably that Eigen hasn't been added the CPLUS_INCLUDE_PATH for it to be found. Will look into this later today. |
@Vipul-Cariappa @aaronj0 My fix to get cppyy to find Eigen (adding it to CPLUS_INCLUDE_PATH) appears to work. If you can double check I think this PR is ready for approval and merging. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I have cross checked. No regressions anywhere. The logs are as I would want it to be. +4 tests pass in OSX.
This reverts commit bf43358.
@Vipul-Cariappa Did you also do this:
We need to make sure that this doesn't error out if boost isn't found, like it does now that causes the CI to fail... |
Yes. I did it. Between commits "update checking external package for testing" and "Try to fix issue of Eigen not found". But I guess I skipped on testing boost. I made sure that eigen did not cause that problem. Assumed boost will not cause any problem as the logic for both are the same. |
That is not what I meant. Your check may work since the CI pip/uv/brew installs the packages but we should drop their installations on the CI and ensure the tests don't error out. |
Yes. We should do it. As the CI is failing. |
There are a lot of tests failing for things simply not being installed on MacOS. Hopefully by installing these cppyy will get more passing tests on MacOS. See here about missing dependencies https://github.com/compiler-research/CppInterOp/actions/runs/12925582648/job/36047197449#step:14:7103