Skip to content

Add a CMake based system for integration tests #565

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 9 commits into from
Jun 9, 2022

Conversation

certik
Copy link
Contributor

@certik certik commented Jun 9, 2022

It tests CPython, LPython/LLVM and LPython/C. One invokes it using:

  • CPython: cmake .
  • LPython/LLVM: cmake -DLPYTHON_BACKEND=llvm .
  • LPython/C: cmake -DLPYTHON_BACKEND=c .

Then one does make and ctest.

It should be equivalent to the previous testing script.

certik added 7 commits June 8, 2022 22:32
It tests CPython, LPython/LLVM and LPython/C. One invokes it using:

* CPython: cmake .
* LPython/LLVM: cmake -DLPYTHON_BACKEND=llvm .
* LPython/C: cmake -DLPYTHON_BACKEND=c .

Then one does `make` and `ctest`.
@certik
Copy link
Contributor Author

certik commented Jun 9, 2022

@czgdp1807 After this is merged, simply add c to a given test and you'll see failures, the most common is that in C we need to forward declare functions (unlike C++). I haven't tested adding extra C files to link, but it will not be difficult.

If you want, you can try to get as many tests working with c as possible. It will require fixes in the C backend. I added one test that works with c, to ensure at least simple things work.

@certik
Copy link
Contributor Author

certik commented Jun 9, 2022

@czgdp1807 regarding this PR, would you mind please testing locally by hand as well? This is a big change in our infrastructure, so to ensure it works.

@czgdp1807
Copy link
Collaborator

If you want, you can try to get as many tests working with c as possible. It will require fixes in the C backend. I added one test that works with c, to ensure at least simple things work.

Cool. Sounds good.

would you mind please testing locally by hand as well? This is a big change in our infrastructure, so to ensure it works.

Okay. On it right now.

@certik
Copy link
Contributor Author

certik commented Jun 9, 2022

The failure on Linux and macOS at the CI is:

[  1%] Generating exit_01.o
python: can't open file '/usr/share/miniconda/envs/test/bin/../share/lpython/lib/lpython_parser.py': [Errno 2] No such file or directory
The command 'python /usr/share/miniconda/envs/test/bin/../share/lpython/lib/lpython_parser.py exit_01.py' failed.

Not sure if this path is not there at the CI anymore, or what the problem could be.

@czgdp1807
Copy link
Collaborator

Works on my mac as well. All tests pass.

@czgdp1807

This comment was marked as outdated.

@czgdp1807
Copy link
Collaborator

czgdp1807 commented Jun 9, 2022

I check the CI on my debug commit and found out the following,

Inside, /usr/local/miniconda/envs/test/bin/../share/ lpython is in ~/work/lpython/lpython/integration_tests but we are executing python command over, /usr/local/miniconda/envs/test/bin/../share/lpython/lib/lpython_parser.py but we should be doing, /usr/local/miniconda/envs/test/bin/../share/~work/lpython/lib/lpython_parser.py (see the extra ~work).

See the logs at https://github.com/lcompilers/lpython/runs/6814568188?check_suite_focus=true

@certik
Copy link
Contributor Author

certik commented Jun 9, 2022

I see, thanks! I think we are executing LPython from the wrong directory it seems, which then causes it to prepend wrong paths.

@czgdp1807
Copy link
Collaborator

Tests pass. 🎉.

@certik certik merged commit dbdd6dc into lcompilers:main Jun 9, 2022
@certik certik deleted the cmake2 branch June 9, 2022 16:31
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