-
Notifications
You must be signed in to change notification settings - Fork 158
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
Allow to run integration tests outside source directory #632
Conversation
@@ -59,8 +59,8 @@ macro(RUN) | |||
if (KIND STREQUAL "llvm") | |||
add_custom_command( | |||
OUTPUT ${name}.o | |||
COMMAND lpython -c ${name}.py -o ${name}.o | |||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.py | |||
COMMAND lpython -c ${CMAKE_SOURCE_DIR}/${name}.py -o ${name}.o |
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.
Isn't CMAKE_CURRENT_SOURCE_DIR
equivalent to CMAKE_SOURCE_DIR
in this case, because we do not use add_subdirectory
?
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.
Yeah, they are same.
@@ -100,7 +100,7 @@ macro(RUN) | |||
|
|||
add_test(${name} python ${CMAKE_CURRENT_BINARY_DIR}/${name}.py) | |||
set_tests_properties(${name} PROPERTIES | |||
ENVIRONMENT "PYTHONPATH=${CMAKE_SOURCE_DIR}/../src/runtime/ltypes;LPYTHON_PY_MOD_NAME=${PY_MOD};LPYTHON_PY_MOD_PATH=${CMAKE_CURRENT_BINARY_DIR}") | |||
ENVIRONMENT "PYTHONPATH=${CMAKE_SOURCE_DIR}/../src/runtime/ltypes;LPYTHON_PY_MOD_NAME=${PY_MOD};LPYTHON_PY_MOD_PATH=${CMAKE_SOURCE_DIR}") |
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.
I think this does not seem correct. The PY_MOD
is the shared library that is compiled from hand written C, and so it is compiled in the binary directory, not in the source directory. The LPYTHON_PY_MOD_PATH
must point to it, thus it should be the ${CMAKE_CURRENT_BINARY_DIR}
.
if (getenv("LPYTHON_PY_MOD_PATH") != NULL) { | ||
rinfile = get_full_path(infile0, getenv("LPYTHON_PY_MOD_PATH"), ltypes, | ||
numpy); | ||
} |
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.
The LPYTHON_PY_MOD_PATH
is only used for CPython tests, and thus should not be needed here, as LPython does not use this environment variable.
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.
Then, how should we find the modules that are present in the current directory of tests? CPython does that itself.
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.
Please open up an issue for this --- we have to find all imported modules relative to the file they are imported from, not relative to the current directory.
Here is how to get it working: #634. |
I see, thanks!! Should I close this one? |
Sure. There are quite a few things we need to fix to get #634 working, but we can just keep fixing them until things pass. |
#577 (comment)