Skip to content

Add a CMake based system for integration tests - #565

Merged
certik merged 9 commits into
lcompilers:mainfrom
certik:cmake2
Jun 9, 2022
Merged

certik merged 9 commits into
lcompilers:mainfrom
certik:cmake2

Conversation

@certik

@certik certik commented Jun 9, 2022

Copy link
Copy Markdown
Contributor

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

certik commented Jun 9, 2022

Copy link
Copy Markdown
Contributor Author

@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

certik commented Jun 9, 2022

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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

certik commented Jun 9, 2022

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Collaborator

Works on my mac as well. All tests pass.

@czgdp1807

This comment was marked as outdated.

@czgdp1807

czgdp1807 commented Jun 9, 2022 •

Copy link
Copy Markdown
Collaborator

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

certik commented Jun 9, 2022

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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