-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
doctests: Filter out linker warning messages #31204
Comments
comment:1
I've only seen this on OS X. The following has worked for me, although it hasn't been thoroughly tested: diff --git a/src/sage/doctest/parsing.py b/src/sage/doctest/parsing.py
index 4e1a6b32e4..77f726a27b 100644
--- a/src/sage/doctest/parsing.py
+++ b/src/sage/doctest/parsing.py
@@ -40,6 +40,8 @@ optional_regex = re.compile(r'(arb216|arb218|py2|py3|long time|not implemented|n
# which has not been patched, we need to ignore that message.
# See :trac:`29317`.
glpk_simplex_warning_regex = re.compile(r'(Long-step dual simplex will be used)')
+# :trac:`31204` -- suppress warning about ld and OS version for dylib files.
+ld_warning_regex = re.compile(r'ld: warning: dylib.*was built for newer macOS version .* than being linked.*')
find_sage_prompt = re.compile(r"^(\s*)sage: ", re.M)
find_sage_continuation = re.compile(r"^(\s*)\.\.\.\.:", re.M)
find_python_continuation = re.compile(r"^(\s*)\.\.\.([^\.])", re.M)
@@ -1087,6 +1089,7 @@ class SageOutputChecker(doctest.OutputChecker):
"""
got = self.human_readable_escape_sequences(got)
got = glpk_simplex_warning_regex.sub('', got)
+ got = ld_warning_regex.sub('', got)
if isinstance(want, MarkedOutput):
if want.random:
return True I can produce a branch easily enough. |
comment:2
Looks fine to me. I briefly looked to find instances of this on Linux in GH Actions logs, but did not find anything, it's likely that I have confused this with something else. |
comment:3
This doesn't quite catch all of the warnings:
I'm not sure why the "..." doesn't capture all of this. Maybe it matches the verbatim "..." in the doctest output, or maybe it doesn't capture multiline strings. |
comment:4
Could you push a branch please? |
Branch: u/jhpalmieri/31204-ld-warnings |
Commit: |
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
|
comment:8
I modified the filter a bit, starting it with "dylib..." instead of "ld: warning: dylib...", since I've seen a few cases without "ld: warning". |
comment:9
I was doing some testing today and could, for example, eliminate these warnings by doing something like: MACOSX_DEPLOYMENT_TARGET=11.0 ./sage -t --random-seed=0 src/sage/docs/instancedoc.pyx I think the underlying problem lies in the python that sage is using. You can see this, for example, by running sage and trying
the issue is that the homebrew libraries were built on a particular operating system with its own deployment target, which is newer than the python target of sage. This problem also manifests itself in #31227 where /usr/bin/python3 has the target set to 10.14.6 for some reason. I wonder if you can try to fix this by making sage set MACOSX_DEPLOYMENT_TARGET environment variable when it's run. You can probably get away with just setting it to whatever version of the Mac operating system you are on. |
comment:10
I like the idea but I'm not getting it to work:
Maybe part of the solution is #18272: we should not be artificially setting |
comment:11
What happen's if you try
That won't change sysconfig's deployment target, but it might stop the linking warnings. (I just ran make distclean for some reason and won't be able to test until tomorrow) |
comment:12
ok, that definitely didn't work. For some reason that seemed to work with /usr/bin/python3 but not with the sage built python which is built for target 10.9 |
comment:13
We should definitely stop arbitrarily defining |
comment:14
I've posted a branch at #18272 to stop defining
works when Sage is built with |
comment:15
Marking as "needs info" because the suggestion from comment:9 may be the right approach, and it would be better than filtering out the warnings. |
comment:16
I like gh-zlscherr's suggestion, but what is the right way to do it?
Do we set it in |
comment:18
Maybe we should filter out the warnings and on separate tickets deal with the underlying issue of setting |
comment:19
+1 for this strategy. Let's get this ticket into Sage 9.3. https://github.com/mkoeppe/sage/actions/runs/649866485 tests this ticket together with #31492 - but there seems to be a scarcity of macOS runners on GH Actions at the moment |
Author: John Palmieri |
comment:21
This regexp does not seem to be working for me |
comment:23
Try this one. |
comment:24
The example from comment:3 is still a problem |
comment:25
Replying to @mkoeppe:
It is, and the only thing I can think is to change the doctest: diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py
index 086704317f..82f825321b 100644
--- a/src/sage/tests/cmdline.py
+++ b/src/sage/tests/cmdline.py
@@ -292,15 +292,16 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False
sage: (out, err, ret) = test_executable(["sage", fullname], pydebug_ignore_warnings=True)
sage: print(out)
499500
- sage: err
- 'Compiling ...spyx...'
+ sage: import re
+ sage: bool(re.match('Compiling.*spyx.*', err))
+ True
sage: ret
0
sage: (out, err, ret) = test_executable(["sage", name], cwd=dir, pydebug_ignore_warnings=True)
sage: print(out)
499500
- sage: err
- 'Compiling ...spyx...'
+ sage: bool(re.match('Compiling.*spyx.*', err))
+ True
sage: ret
0
What do you think about that? |
comment:26
Fine with me to change these doctests, could you push it to the ticket please? |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:28
This works well. |
Reviewer: Matthias Koeppe |
comment:29
Good, thanks! |
Changed branch from u/jhpalmieri/31204-ld-warnings to |
(from #30589)
On OS X Big Sur + various homebrew packages, if I use
then Sage builds (if I also incorporate various other changes from #30651), but I get doctest failures of the form
We should filter out these warnings in doctesting.
CC: @jhpalmieri @dimpase @kiwifb
Component: doctest framework
Author: John Palmieri
Branch/Commit:
55cf2ee
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/31204
The text was updated successfully, but these errors were encountered: