From 3bc099108a7c076ef2f0f4f637b7ecb323e7a2f7 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 28 Mar 2018 13:45:27 -0700 Subject: [PATCH 1/5] travis: add a LANG= linux build to catch things like ticket:2912 (https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2912) Also clean up other "list"-ish keys to avoid causing too many builds: * "os": move this into "matrix" * "python": 2.7 is the default, and we weren't running the pypy build anyways (not sure why, something else in this config must have disabled it, maybe when we moved away from language: python) * "allow_failures" was causing a pypy build to happen even without listing it in "python" We now have exactly three builds: * linux * linux with LANG= * OS-X --- .travis.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3373458c6..7c29474f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,8 @@ dist: trusty sudo: required -os: - - "linux" - - "osx" cache: pip before_cache: - rm -f $HOME/.cache/pip/log/debug.log -python: - - "2.7" - - "pypy" before_install: - sh -c set - git config --global user.email "travis-tahoe@tahoe-lafs.org" @@ -38,6 +32,9 @@ notifications: - "%{repository}#%{build_number} [%{branch}: %{commit} by %{author}] %{message}" - "Changes: %{compare_url} | Details: %{build_url}" matrix: - allow_failures: - - python: "pypy" + include: + - os: linux + - os: linux + env: LANG= + - os: osx fast_finish: true From 0616aa7de7a991f25c4c8c07c3763311128ccc35 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 28 Mar 2018 15:17:23 -0700 Subject: [PATCH 2/5] test_absolute_storage_dir: don't use uSNOWMAN on non-unicode platforms Exercising the unicode possibilities are nice, but not critical to this test, so let's just avoid the non-ascii characters when the filesystem encoding can't handle them --- src/allmydata/test/test_client.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/allmydata/test/test_client.py b/src/allmydata/test/test_client.py index d2c701d1e..cf1d92b7b 100644 --- a/src/allmydata/test/test_client.py +++ b/src/allmydata/test/test_client.py @@ -11,7 +11,7 @@ from allmydata.node import OldConfigError, OldConfigOptionError, UnescapedHashEr from allmydata.frontends.auth import NeedRootcapLookupScheme from allmydata import client from allmydata.storage_client import StorageFarmBroker -from allmydata.util import base32, fileutil +from allmydata.util import base32, fileutil, encodingutil from allmydata.util.fileutil import abspath_expanduser_unicode from allmydata.interfaces import IFilesystemNode, IFileNode, \ IImmutableFileNode, IMutableFileNode, IDirectoryNode @@ -320,8 +320,11 @@ class Basic(testutil.ReallyEqualMixin, testutil.NonASCIIPathMixin, unittest.Test # don't want a literal absolute path like /myowndir which we won't # have write permission to. So construct an absolute path that we # should be able to write to. + base = u"\N{SNOWMAN}" + if encodingutil.filesystem_encoding != "utf-8": + base = u"melted_snowman" expected_path = abspath_expanduser_unicode( - u"client.Basic.test_absolute_storage_dir_myowndir/\N{SNOWMAN}" + u"client.Basic.test_absolute_storage_dir_myowndir/" + base ) config_path = expected_path.encode("utf-8") self._storage_dir_test( From ce473bd5f4b334dbda0ebe1f3cde7b1ece37fab2 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 28 Mar 2018 15:30:24 -0700 Subject: [PATCH 3/5] cli.test_alias: move skip-unless utility to common_util.py next to the other skip-unless function --- src/allmydata/test/cli/test_alias.py | 16 ++++------------ src/allmydata/test/common_util.py | 7 +++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/allmydata/test/cli/test_alias.py b/src/allmydata/test/cli/test_alias.py index a3f30257c..6542d154f 100644 --- a/src/allmydata/test/cli/test_alias.py +++ b/src/allmydata/test/cli/test_alias.py @@ -4,22 +4,14 @@ from mock import patch from twisted.trial import unittest from twisted.internet.defer import inlineCallbacks -from allmydata.util.encodingutil import unicode_to_argv, get_io_encoding +from allmydata.util.encodingutil import unicode_to_argv from allmydata.scripts.common import get_aliases from allmydata.test.no_network import GridTestMixin from .common import CLITestMixin - +from ..common_util import skip_if_cannot_represent_argv # see also test_create_alias -def skip_unless_unicode(): - try: - etudes_arg = u"\u00E9tudes".encode(get_io_encoding()) - del etudes_arg - except UnicodeEncodeError: - raise unittest.SkipTest("A non-ASCII command argument could not be encoded on this platform.") - - class ListAlias(GridTestMixin, CLITestMixin, unittest.TestCase): @inlineCallbacks @@ -55,7 +47,7 @@ class ListAlias(GridTestMixin, CLITestMixin, unittest.TestCase): this """ self.basedir = "cli/ListAlias/test_list_unicode_mismatch_json" - skip_unless_unicode() + skip_if_cannot_represent_argv(u"tahoe\u263A") self.set_up_grid(oneshare=True) rc, stdout, stderr = yield self.do_cli( @@ -87,7 +79,7 @@ class ListAlias(GridTestMixin, CLITestMixin, unittest.TestCase): @inlineCallbacks def test_list_unicode_mismatch(self): self.basedir = "cli/ListAlias/test_list_unicode_mismatch" - skip_unless_unicode() + skip_if_cannot_represent_argv(u"tahoe\u263A") self.set_up_grid(oneshare=True) rc, stdout, stderr = yield self.do_cli( diff --git a/src/allmydata/test/common_util.py b/src/allmydata/test/common_util.py index 78e4c79bb..ea9cb861d 100644 --- a/src/allmydata/test/common_util.py +++ b/src/allmydata/test/common_util.py @@ -22,6 +22,13 @@ def skip_if_cannot_represent_filename(u): except UnicodeEncodeError: raise unittest.SkipTest("A non-ASCII filename could not be encoded on this platform.") +def skip_if_cannot_represent_argv(u): + precondition(isinstance(u, unicode)) + try: + u.encode(get_io_encoding()) + except UnicodeEncodeError: + raise unittest.SkipTest("A non-ASCII argv could not be encoded on this platform.") + def run_cli(verb, *args, **kwargs): precondition(not [True for arg in args if not isinstance(arg, str)], "arguments to do_cli must be strs -- convert using unicode_to_argv", args=args) From 4cd8c699e299f0b2e3eaf7789b44dd5ab501f761 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 28 Mar 2018 16:16:52 -0700 Subject: [PATCH 4/5] travis: use LANG=C instead of unsetting it entirely Thanks to exarkun for the suggestion. The failing buildbots have LANG unset, but I'm pretty sure that defaults to LANG=C, and LANG=C triggers the failures just as well as LANG= did. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7c29474f2..63880548b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,6 @@ matrix: include: - os: linux - os: linux - env: LANG= + env: LANG=C - os: osx fast_finish: true From 8ae1b520706af1e49369fb6347c3fdfa7e400e6c Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 28 Mar 2018 17:09:51 -0700 Subject: [PATCH 5/5] travis: explicitly set LANG on all builds (to C or en_US.UTF-8) --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 63880548b..4f7aa6c24 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,9 @@ notifications: matrix: include: - os: linux + env: LANG=en_US.UTF-8 - os: linux env: LANG=C - os: osx + env: LANG=en_US.UTF-8 fast_finish: true