-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add debug test and run at CI #29
Conversation
This needs to be rebased after merging/completion of #28. |
It failed:
But the CI succeeded. So we need to investigate how to make the CI fail (maybe LFortran returns 0 exit code), and then we need to fix it. |
7f1f0fb
to
3b65277
Compare
Now it prints: On Ubuntu: + lfortran -g --debug-with-line-column tests/expr2.f90
25 On Mac: 25
__mamba_xctivate "${@}"
;;
install|update|upgrade|remove|uninstall)
__mamba_exe "${@}" || \return
total 104
__mamba_xctivate reactivate
-rw-r--r-- 1 runner staff 1065 Jan 29 22:19 LICENSE
;;
-rw-r--r-- 1 runner staff 73 Jan 29 22:19 README.md
self-update)
-rw-r--r-- 1 runner staff 109 Jan 29 22:19 environment.yml
__mamba_exe "${@}" || \return
-rwxr-xr-x 1 runner staff 49768 Jan 29 22:24 expr2.out
drwxr-xr-x 3 runner staff 96 Jan 29 22:24 expr2.out.dSYM
-rw-r--r-- 1 runner staff 1992 Jan 29 22:24 expr2.out.tmp.o
-rw-r--r-- 1 runner staff 1615 Jan 29 22:24 expr2_ldd.txt
-rw-r--r-- 1 runner staff 96 Jan 29 22:24 expr2_lines.dat
-rw-r--r-- 1 runner staff 60 Jan 29 22:24 expr2_lines.dat.txt
-rw-r--r-- 1 runner staff 20 Jan 29 22:24 expr2_lines.txt
drwxr-xr-x 40 runner staff 1280 Jan 29 22:24 lfortran
drwxr-xr-x 3 runner staff 96 Jan 29 22:19 tests Seems like it worked. |
(lf) ubaid@ubaids-MacBook-Pro lfortran % git diff
diff --git a/src/bin/lfortran.cpp b/src/bin/lfortran.cpp
index 00471ccab..0e825f0e7 100644
--- a/src/bin/lfortran.cpp
+++ b/src/bin/lfortran.cpp
@@ -1610,6 +1610,7 @@ int link_executable(const std::vector<std::string> &infiles,
"the debug information. This might be caused because either"
" `llvm-dwarfdump` or `Python` are not available. "
"Please activate the CONDA environment and compile again.\n";
+ std::cerr << "status is: " << status << std::endl;
return status;
}
}
@@ -2370,7 +2371,9 @@ int main(int argc, char *argv[])
LCompilers::print_stack_on_segfault();
#endif
try {
- return main_app(argc, argv);
+ int status = main_app(argc, argv);
+ std::cerr << "Main app returned: " << status << std::endl;
+ return status;
} catch(const LCompilers::LCompilersException &e) {
std::cerr << "Internal Compiler Error: Unhandled exception" << std::endl;
std::vector<LCompilers::StacktraceItem> d = e.stacktrace_addresses();
diff --git a/src/libasr/dwarf_convert.py b/src/libasr/dwarf_convert.py
deleted file mode 100755 With the above git diff, we get the status (returned by % lfortran examples/expr2.f90 -g --debug-with-line-column
sh: /Users/ubaid/Desktop/OpenSource/lfortran/src/bin/../libasr/dwarf_convert.py: No such file or directory
Error in creating the files used to generate the debug information. This might be caused because either `llvm-dwarfdump` or `Python` are not available. Please activate the CONDA environment and compile again.
status is: 32512
Main app returned: 32512
% echo $?
0 I think although the status returned by Python 3.12.1 | packaged by conda-forge | (main, Dec 23 2023, 08:01:35) [Clang 16.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 32512 % 256
0
>>> 32512 % 128
0
>>> |
Found the following here:
|
7c390f2
to
3329116
Compare
This is a bug in LFortran. The return integer must be in the range 0..255, otherwise it gets clamped and can become 0, as in this case. |
e6b956d
to
71d7f03
Compare
On my local system M1 mac: LFortran v0.32.0: (lf_32) ubaid@ubaids-MacBook-Pro lfortran % which lfortran
/Users/ubaid/conda_root/envs/lf_32/bin/lfortran
(lf_32) ubaid@ubaids-MacBook-Pro lfortran % lfortran --version
LFortran version: 0.32.0
Platform: macOS ARM
Default target: arm64-apple-darwin22.4.0
(lf_32) ubaid@ubaids-MacBook-Pro lfortran % cat examples/expr2.f90
program expr2
implicit none
integer :: x
x = (2+3)*5
print *, x
error stop
end program
(lf_32) ubaid@ubaids-MacBook-Pro lfortran % lfortran examples/expr2.f90
25
ERROR STOP
(lf_32) ubaid@ubaids-MacBook-Pro lfortran % lfortran examples/expr2.f90 -g --debug-with-line-column
expr2.out.dSYM/Contents/Resources/DWARF/expr2.out: No available targets are compatible with triple "aarch64-unknown-unknown"
sh: /Users/ubaid/conda_root/envs/lf_32/bin/../include/lfortran/impure/../dwarf_convert.py: No such file or directory
Error in creating the files used to generate the debug information. This might be caused because either `llvm-dwarfdump` or `Python` are not available. Please activate the CONDA environment and compile again. LFortran v0.33.0: (lf_conda) ubaid@ubaids-MacBook-Pro lfortran % which lfortran
/Users/ubaid/conda_root/envs/lf_conda/bin/lfortran
(lf_conda) ubaid@ubaids-MacBook-Pro lfortran % lfortran --version
LFortran version: 0.33.0
Platform: macOS ARM
Default target: arm64-apple-darwin22.4.0
(lf_conda) ubaid@ubaids-MacBook-Pro lfortran % cat examples/expr2.f90
program expr2
implicit none
integer :: x
x = (2+3)*5
print *, x
error stop
end program
(lf_conda) ubaid@ubaids-MacBook-Pro lfortran % lfortran examples/expr2.f90
25
ERROR STOP
(lf_conda) ubaid@ubaids-MacBook-Pro lfortran % lfortran examples/expr2.f90 -g --debug-with-line-column
expr2.out.dSYM/Contents/Resources/DWARF/expr2.out: No available targets are compatible with triple "aarch64-unknown-unknown"
25
File "examples/expr2.f90", line 9
error stop
ERROR STOP |
tests/expr2.f90
Outdated
x = (2+3)*5 | ||
print *, x | ||
|
||
error stop |
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.
Shall I remove this error stop
so that the CI passes?
It works:
We just need to figure out how to make it "succeed". |
.github/workflows/CI.yml
Outdated
lfortran -g --debug-with-line-column tests/expr2.f90 | ||
ls -l |
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.
Also, I think we need to ponder if the above is a good way of adding this test. Plus we also need to fix lfortran to exit with appropriate code when the exit code is > 255 (or < 0).
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.
It would be good to compare somehow the text that it prints.
Sure. At the moment, I think we atleast know that the latest lfortran version works with debugging support on linux and macos. Is it safe to close the issue lfortran/lfortran#3190? Or shall we close it after we figue out how to test the debugging support? |
I think it's safe to close the LFortran issue. There is no bug in LFortran, nor in the conda package. But after that let's test this properly, to ensure it does not break. |
Sure, Thanks! It seems we have an issue open for it here #27. |
Let's do this: #27 (comment) |
Yes, sure. Submitted lfortran/lfortran#3263 that will allow the test to run when |
After this gets merged, shall we simply checkout the commit id and use lfortran-conda-testing/.github/workflows/CI.yml Lines 53 to 56 in ae68aa8
If we make a release then we might need to update at |
71d7f03
to
c29db95
Compare
.github/workflows/CI.yml
Outdated
run: | | ||
git clone https://github.com/lfortran/lfortran.git | ||
cd lfortran | ||
git checkout 925797482746846763531d5d5ea2cf9995359b63 |
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.
For now I simply used checking out the specific commit. It seems this might not work, since the reference outputs generated by the lfortran
v0.33.03
and the reference outputs expected at this commit 925797482746846763531d5d5ea2cf9995359b63
would not be the same (the ref tests might have got updated by the time of this commit).
I can make a release. Just ensure locally that the reference tests now behave correctly, and ping me if they do. I'll then make a release. |
Yes, they behave as expected. (lf) ubaid@ubaids-MacBook-Pro lfortran % ./run_tests.py --no-llvm --skip-cpptranslate
...
errors/runtime_stacktrace_01.f90 * run_dbg ✓
TESTS PASSED |
Perfect, thanks! Here is the new release: |
c29db95
to
6be4685
Compare
From the CI, for both linux and macos: ...
errors/runtime_stacktrace_01.f90 * run_dbg ✓
TESTS PASSED It works! |
closes lfortran/lfortran#3190
fixes #27