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
Improve error message when python 3 not available - Fix for #1385 #1392
Conversation
Can't you already do this by building with wabt's primary test runner ./test/run-tests.py is also written in python. If you don't have python the only possible tests you could run are the gtest unittests and i'm not sure it worth the extra option to allow just those tests to build built. |
Also, if you do want to run tests, isn't it easy install python3 on mac? |
Installing python3 is easy. I use pyenv to manage python versions. I wanted to contribute to this project, so I picked up #1385 with To test this PR I used a python version 3.8 which is not installed in my MacBook as I don't have Windows as mentioned in #1385. All 5 CI checks have python3 enabled and run python tests - they won't test the scenario where python3 is not installed. |
Would you mind instead improving the error message, e.g. "python3 is required to for wabt testing, please either install it or build with -DBUILD_TESTS=OFF". |
I will modify the PR accordingly. |
I have made required changes. See sample error message (ignore exact versions like 3.7.3 and 3.8 in the error message).
|
CMakeLists.txt
Outdated
endif () | ||
else() | ||
message(FATAL_ERROR "Python 3 is required for wabt testing. Please install it. \nIf you want to proceed without installing python 3, either add -no-tests to make target (example: make clang-debug-no-tests) or run cmake with -DBUILD_TESTS=OFF.") | ||
endif(PYTHONINTERP_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.
Seem like you could just put this error in an if an "if (NOT PYTHONINTERP_FOUND) .. endif()" above that the rest of the file would be left unchanged?
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.
Done
Would be better if instead it displayed that warning and then turned tests off for you, rather than failing. |
I tend to agree with @aardappel here. @sbc100, does that seem OK to you? |
Fine with me. We can set BUILD_TESTS to false is python is not found. |
Or should we even just have BUILD_TESTS default to OFF? |
I like having it default to on, personally. |
Should I revert the initial commit of this PR?
|
I think the conclusion is:
|
Got it - Oops typo, it should have been < sign (in my previous comment). |
CMakeLists.txt
Outdated
@@ -464,6 +464,13 @@ if (NOT EMSCRIPTEN) | |||
) | |||
endif () | |||
|
|||
# Python 3.5 is the version shipped in Ubuntu Xenial | |||
find_package(PythonInterp 3.5) | |||
if(NOT PYTHONINTERP_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.
how about AND BUILD_TESTS == ON there?
Otherwise lgtm!
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.
added this check.
Cmake prints a message when suitable version is not found. This will appear irrespective of BUILD_TEST is ON or OFF. When BUILD_TESTS=OFF and python3 not found
When BUILD_TESTS=ON and python3 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.
lgtm, thanks for doing this!
#1385
In this PR, I have made python optional in CMakeLists.txt . I have tested locally by bumping the required version to 3.8 which is not existing on my Mac.
I have noticed that the below tests are run from python file - test/run-c-api-examples.py.
Do we need to port run-c-api-examples.py to gtest file or cpp file?