Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

Smit-create
Copy link
Collaborator

@@ -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
Copy link
Contributor

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?

Copy link
Collaborator Author

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}")
Copy link
Contributor

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);
}
Copy link
Contributor

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.

Copy link
Collaborator Author

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.

Copy link
Contributor

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.

@certik
Copy link
Contributor

certik commented Jun 19, 2022

Here is how to get it working: #634.

@Smit-create
Copy link
Collaborator Author

I see, thanks!! Should I close this one?

@certik
Copy link
Contributor

certik commented Jun 19, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants