Skip to content

[3.4] Backport CI config from master #2475

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 11 commits into from
Jul 22, 2017
Merged

[3.4] Backport CI config from master #2475

merged 11 commits into from
Jul 22, 2017

Conversation

vstinner
Copy link
Member

  • Add .travis.yml for Travis CI
  • Add .github/ for AppVeyor and CodeCov.

@vstinner
Copy link
Member Author

Ok, here is my first attempt for enable Travis CI and AppVeyor to the 3.4 branch. It should help to test automatically backported security fixes.

I'm not sure about enabling CodeCov. Do we need CodeCov on 3.4?

Once this PR will work and be merged, I will backport it to the 3.3 branch.

@vstinner
Copy link
Member Author

The doc job failed with:

Warning, treated as error:
unknown config value 'latex_paper_size' in override, ignoring

=> need to backport the commit e7ffb99.

@vstinner
Copy link
Member Author

The Travis CI job failed on:

make: *** No rule to make target `regen-all'.  Stop.

Need to remove this from .travis.yml.

At least, the compilation succeeded ;-)


AppVeyor failed on:

C:\projects\cpython>"C:\projects\cpython\PCbuild\\python"  -Wd -E -bb "C:\projects\cpython\PCbuild\..\lib\test\regrtest.py" -uall -u-cpu -rwW --slowest --timeout 1200 -j0   
...
regrtest.py: error: unrecognized arguments: --slowest

Need to replace the option with --slow.

@vstinner
Copy link
Member Author

I removed CodeCov config from .github/ and tried to fix CI failures.

@vstinner
Copy link
Member Author

New failure of the Travis CI doc job:

Warning, treated as error:
/home/travis/build/python/cpython/Doc/library/xml.dom.minidom.rst:250:Footnote [#] is not referenced.

@vstinner
Copy link
Member Author

Failure of the Travis CI python job:

./python  ./Tools/scripts/run_tests.py -j 1 -u all -W --timeout=3600 -j4 -uall,-cpu,-tzdata
...
regrtest.py: error: argument -u/--use: invalid resource: tzdata

Copy link
Member

@zware zware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly fine, a couple of things pointed out below.

.travis.yml Outdated
# Only run on Linux as the check only needs to be run once.
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi
# `-r -w` implicitly provided through `make buildbottest`.
- make buildbottest TESTOPTS="-j4 -uall,-cpu,-tzdata"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/,-tzdata// (as you probably already saw in the build log :))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I wrote the same fix, again, I will push it shortly.

.travis.yml Outdated
after_script: # Probably should be after_success once test suite updated to run under coverage.py.
# Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files.
- source ./venv/bin/activate
- bash <(curl -s https://codecov.io/bash)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the codecov config missing, you can just remove this entire build. If you still want GCC coverage, you could change the main Linux build to GCC, since clang is covered by the OSX builder.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I was going to remove it, but I'm looking at failures of the doc job ;-)

@vstinner
Copy link
Member Author

I removed the Travis CI doc job. It requires too many changes to fix it. The doc wasn't tested, so it's not like it's a regresion. Moreover, security fixes don't touch Doc/ usually, so it should be fine.

@zware
Copy link
Member

zware commented Jun 28, 2017

I removed the Travis CI doc job. It requires too many changes to fix it.

In that case, let's remove the changes in Doc/ as well.

@vstinner
Copy link
Member Author

4 tests failed on Windows:

======================================================================
ERROR: test_logincapa_with_client_certfile (test.test_imaplib.RemoteIMAP_SSLTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_imaplib.py", line 473, in test_logincapa_with_client_certfile
    _server = self.imap_class(self.host, self.port, certfile=CERTFILE)
  File "C:\projects\cpython\lib\imaplib.py", line 1222, in __init__
    IMAP4.__init__(self, host, port)
  File "C:\projects\cpython\lib\imaplib.py", line 182, in __init__
    self.open(host, port)
  File "C:\projects\cpython\lib\imaplib.py", line 1235, in open
    IMAP4.open(self, host, port)
  File "C:\projects\cpython\lib\imaplib.py", line 258, in open
    self.sock = self._create_socket()
  File "C:\projects\cpython\lib\imaplib.py", line 1227, in _create_socket
    server_hostname=self.host)
  File "C:\projects\cpython\lib\ssl.py", line 368, in wrap_socket
    _context=self)
  File "C:\projects\cpython\lib\ssl.py", line 586, in __init__
    self.do_handshake()
  File "C:\projects\cpython\lib\ssl.py", line 813, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:600)
======================================================================
ERROR: test_logincapa_with_client_ssl_context (test.test_imaplib.RemoteIMAP_SSLTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_imaplib.py", line 478, in test_logincapa_with_client_ssl_context
    _server = self.imap_class(self.host, self.port, ssl_context=self.create_ssl_context())
  File "C:\projects\cpython\lib\imaplib.py", line 1222, in __init__
    IMAP4.__init__(self, host, port)
  File "C:\projects\cpython\lib\imaplib.py", line 182, in __init__
    self.open(host, port)
  File "C:\projects\cpython\lib\imaplib.py", line 1235, in open
    IMAP4.open(self, host, port)
  File "C:\projects\cpython\lib\imaplib.py", line 258, in open
    self.sock = self._create_socket()
  File "C:\projects\cpython\lib\imaplib.py", line 1227, in _create_socket
    server_hostname=self.host)
  File "C:\projects\cpython\lib\ssl.py", line 368, in wrap_socket
    _context=self)
  File "C:\projects\cpython\lib\ssl.py", line 586, in __init__
    self.do_handshake()
  File "C:\projects\cpython\lib\ssl.py", line 813, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:600)
----------------------------------------------------------------------

======================================================================
FAIL: test_walk_bottom_up (test.test_os.WalkTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_os.py", line 828, in test_walk_bottom_up
    self.sub2_tree)
AssertionError: Tuples differ: ('@test_856_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3']) != ('@test_856_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])
First differing element 1:
['broken_link', 'link']
['link']
- ('@test_856_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3'])
?                                                ----------
+ ('@test_856_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])
?                                ++++++++++
======================================================================
FAIL: test_walk_prune (test.test_os.WalkTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_os.py", line 808, in test_walk_prune
    self.assertEqual(all[1], self.sub2_tree)
AssertionError: Tuples differ: ('@test_856_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3']) != ('@test_856_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])
First differing element 1:
['broken_link', 'link']
['link']
- ('@test_856_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3'])
?                                                ----------
+ ('@test_856_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])
?                                ++++++++++
======================================================================
FAIL: test_walk_topdown (test.test_os.WalkTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_os.py", line 791, in test_walk_topdown
    self.assertEqual(all[3 - 2 * flipped], self.sub2_tree)
AssertionError: Tuples differ: ('@test_856_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3']) != ('@test_856_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])
First differing element 1:
['broken_link', 'link']
['link']
- ('@test_856_tmp\\TEST1\\SUB2', ['broken_link', 'link'], ['tmp3'])
?                                                ----------
+ ('@test_856_tmp\\TEST1\\SUB2', ['link'], ['broken_link', 'tmp3'])
?                                ++++++++++
----------------------------------------------------------------------

@vstinner
Copy link
Member Author

On Travis CI, the same 2 test_imaplib tests failed.

@vstinner
Copy link
Member Author

@zware: "In that case, let's remove the changes in Doc/ as well."

Oh, it's a mistake. I reverted most Doc changes, but I forgot one. It's now fixed.

I backported another fix for test_imaplib which removes the 2 failing tests.

@vstinner
Copy link
Member Author

Oh yeah! Travis CI now pass. AppVeyor will likely fail in test_os again, I didn't identifier the right commit to cherry-pick yet.

@serhiy-storchaka: Do you recall which commit fixed test_os random failures on os.walk on Windows? see #2475 (comment) failures

@serhiy-storchaka
Copy link
Member

See bpo-23808 and bpo-25911. Seems this issue was not fixed in 3.4.

Maybe removing the True argument from os.symlink('broken', broken_link_path, True) could help.

Copy link
Member

@brettcannon brettcannon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review is only for the Travis file.

@vstinner
Copy link
Member Author

Ok, the Python test suite now pass on Linux (Travis CI) and Windows (AppVeyor).

Summary of the PR:

  • Backport Travis CI and AppVeyor configuration
  • Fix 4 failing tests in test_os and test_smtplib: backport 2 changes which only impact tests, not the stdlib
  • Hum, that's all :-)

This PR doesn't contain:

  • CodeCov configuration: I consider that it's useless for 3.4, it's not like we want to enhance the code coverage in this branch
  • CI docs tests: fixing the doc job (fix warnings, not errors, for Sphinx 1.6.1) requires to backport 3 big changes which creates a lot of conflicts, and so there is a high risk of introducing bugs in the doc ... whereas the purpose of a CI is to prevent mistakes :-)

@brettcannon: I really prefer to fix all CI issues in a single PR, and not have to handle 2 or 3 PR to get a working CI.

@zware: Would you mind to review this PR? You worked on these CI recently, so you should be able to check it :-)

@larryhastings: Would you mind to review this PR? It should help to be more confident when merging security fixes in 3.4, since the 3.4 buildbots were removed.

Thanks @serhiy-storchaka, I backported you bpo-23808 fix and it seems like it was just enough ;-)

Copy link
Member

@zware zware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though I have added a suggestion.

exit
fi
./configure --with-pydebug
make -j4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should perhaps keep the make clinic check. That might require also backporting .gitattributes (which might not be a bad idea anyway).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should perhaps keep the make clinic check.

I don't think that it's worth it to add too many tests. I expect less than 10 commits in 3.4 next months, and each commit is carefully reviewed, and is very likely simply a backport.

That might require also backporting .gitattributes (which might not be a bad idea anyway).

This is for Windows end of line? I tried to forget this one. Tests pass on Windows on AppVeyor. Do we really need gitattributes?

Anyway, I suggest to create a separated change once this one is merged, if you consider that we should backport gitattributes.

@brettcannon
Copy link
Member

@Haypo I have no problem with rolling up the fixes to go with the .travis.yml file. All I meant was that I only looked at the .travis.yml file and not the fixes themselves.

@@ -468,16 +468,6 @@ def test_logincapa(self):
_server = self.imap_class(self.host, self.port)
self.check_logincapa(_server)

def test_logincapa_with_client_certfile(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were these tests removed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the commit 2bef165e1a142b83bc3f14e1017cd2aad50c9af8 of this PR which contains the full context, it's just a backport; http://bugs.python.org/issue30231

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Why is this bugfix part of the "Backport CI config from master" PR? As far as I can tell, it has nothing to do with backporting the config for AppVeyor, CodeConv, and Travis.

Unless this bugfix is necessary for running AppVeyor, CodeConv, or Travis, I would like this change removed from the PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@larryhastings: Please see my summary of this PR, #2475 (comment)

Technically, I don't think that you can merge a PR if the CI fails. So it's not posisble to add the CI config in one PR and then fix failing tests. I could do the opposite, but it's not possible to make a PR depends on another one. Moreover, I used this issue to see which tests on the CI and test my fixes.

I think this reply below was actually meant to be in-line here. I am replying to it here.

2bef165 says "Remove the two tests which are already skipped." If they're skipped, then they're not failing, and they don't need to be removed.

Are they actually failing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. I used "git cherry-pick -x" which keeps the commit message unchanged. In Python 3.6 and master, first I skipped the test using skipIf(True, "...") to take decide what to do with these tests. But later, we decided that it's not possible to fix the test, so I removed them in all branches.

The IMAP server now always reject our TLS certificate, so the test always fail. The question is more why the server accepted your TLS certificate in the past? :-)

@@ -770,7 +770,11 @@ def setUp(self):
if support.can_symlink():
os.symlink(os.path.abspath(t2_path), self.link_path)
os.symlink('broken', broken_link_path, True)
self.sub2_tree = (sub2_path, ["link"], ["broken_link", "tmp3"])
if os.path.isdir(broken_link_path):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this code modified?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See bpo-23808.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. Why is this bugfix part of the "Backport CI config from master" PR? As far as I can tell, it has nothing to do with backporting the config for AppVeyor, CodeConv, and Travis.

Unless this bugfix is necessary for running AppVeyor, CodeConv, or Travis, I would like this change removed from the PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI fails without this fix. If the CI fails, you cannot merge this PR.

Moreover, a prefer a green CI to more easily spot failures, than to have to compare with the previous CI build to check if there are new failures ;-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll accept this into 3.4, Even Though It's In Security Fixes Only Mode etc etc etc.

@larryhastings
Copy link
Contributor

FWIW, there's some automation when cutting releases that removes dotfiles we don't want to leak into Python release tarballs. New dotfiles like .travis.yaml (and ".mention-bot", and ".github") need to be explicitly pruned. I'm gonna follow up and make sure this happens for 3.6.2 final and 3.6.4rc1. In the future, we release managers would appreciate a heads-up warning us when people add new dotfiles to the root of cpython, so we can make sure we don't ship them.

@vstinner
Copy link
Member Author

FWIW, there's some automation when cutting releases that removes dotfiles we don't want to leak into Python release tarballs.

I guess that you use some scripts, are they public?

@brettcannon
Copy link
Member

@Haypo my guess is https://github.com/python/release-tools, but there's no explicit dot file list that I see there so I may be wrong

@larryhastings
Copy link
Contributor

Brett's link to release-tools is the right place. The logic to strip the dotfiles is hidden inside. But please don't touch it right now. @ned-deily has done a lot of work on it to update it to Github, but he hasn't checked in those changes yet. I appreciate you being willing to fix release-tools when you add new dotfiles but please wait until release.py doesn't call "hg" anymore ;-)

@vstinner
Copy link
Member Author

@larryhastings: Please see my summary of this PR, #2475 (comment)

Technically, I don't think that you can merge a PR if the CI fails. So it's not posisble to add the CI config in one PR and then fix failing tests. I could do the opposite, but it's not possible to make a PR depends on another one. Moreover, I used this issue to see which tests on the CI and test my fixes.

@vstinner
Copy link
Member Author

I just rebased this PR on top of the 3.4 branch, since many security PRs just have been merged. So it would help to check if everything is fine on 3.4 :-)

@vstinner
Copy link
Member Author

I just rebased this PR on top of the 3.4 branch, since many security PRs just have been merged. So it would help to check if everything is fine on 3.4 :-)

Oh, everything is not fine, test_subprocess fails: http://bugs.python.org/issue30730#msg298218

(Regression of PR #2362, commit fe82c46).

@serhiy-storchaka
Copy link
Member

Oh, I forgot that null character/byte errors were of type TypeError before 3.5. The simplest fix is changing corresponding ValueError in self.assertRaises() to the tuple (ValueError, TypeError). You can add 5e22721 to this PR.

vstinner and others added 10 commits July 13, 2017 13:15
* Add .travis.yml for Travis CI
* Add .github/ for AppVeyor and CodeCov.
The regen-all Makefile rule doesn't exist in Python 3.4, only since
Python 3.5 and newer (and 2.7).
tzdata resource doesn't exist in Python 3.4.
Fixing Sphinx warnings requires to backport huge intrusive changes
like:

- commit d97b7dc
- commit 5c67933
The public cyrus.andrew.cmu.edu IMAP server (port 993) doesn't accept
TLS connection using our self-signed x509 certificate. Remove the two
tests which are already skipped.
(cherry picked from commit 7895a05)
On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag.

(cherry picked from commit 388b90f)
Fix test_invalid_cmd() and test_invalid_env(), TypeError is raised on
Python 3.4.

(cherry picked from commit 5e22721)
@vstinner
Copy link
Member Author

Oh, I forgot that null character/byte errors were of type TypeError before 3.5. The simplest fix is changing corresponding ValueError in self.assertRaises() to the tuple (ValueError, TypeError). You can add 5e22721 to this PR.

It took me one minute to understand that this commit comes from PR #2363 which is not merged yet :-)

I changed the commit message and added it at the end of this PR.

I also rebased this PR on top of 3.4.

@vstinner
Copy link
Member Author

Yeah, tests pass again \o/

@larryhastings: Ok, it's your turn ;-)

@vstinner
Copy link
Member Author

Ping @larryhastings: does it now look good to you?

@vstinner
Copy link
Member Author

(The PR was already approved by 3 core devs, maybe 4 if you include myself.)

@larryhastings larryhastings merged commit b154917 into python:3.4 Jul 22, 2017
@larryhastings
Copy link
Contributor

I look forward to 3.4 entering the age of automation!

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

Successfully merging this pull request may close these issues.

6 participants