From e6e590a73ebdf2cf8a7cdc264c45c9863617e524 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 25 Oct 2013 09:22:36 -0700 Subject: [PATCH] tests: Skip Python daemon tests in directory with non-ASCII name. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The Debian autobuild machines run their builds inside a top-level directory named /«BUILDDIR». That name contains two non-ASCII characters that cause the Python code in the interface-reconfigure and ovs-monitor-ipsec tests to fail. The problem seems to be related to the locale, because switching to a UTF-8 locale allows the tests to proceed farther but does not fix the problem. I was not able to easily fix the actual problem. Web searches turn up articles that imply that the problem is not reasonably fixable with Python 2.x, e.g.: http://stackoverflow.com/a/11742928 This commit instead avoids the problem by skipping these tests if the current working directory's name contains non-ASCII characters. This is a legitimate solution only because interface-reconfigure and ovs-monitor-ipsec run from initscripts and thus their current working directories are system directories. (Also, the current working directory matters much less when run in a real environment because the --root-prefix option that causes the issue is not used in a real environment.) Signed-off-by: Ben Pfaff --- tests/atlocal.in | 15 +++++++++++++++ tests/interface-reconfigure.at | 4 ++++ tests/ovs-monitor-ipsec.at | 1 + 3 files changed, 20 insertions(+) diff --git a/tests/atlocal.in b/tests/atlocal.in index 3db626c34..5c0db2a78 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -25,6 +25,21 @@ export PYTHONIOENCODING PYTHONDONTWRITEBYTECODE=yes export PYTHONDONTWRITEBYTECODE +# Test whether the current working directory name is all ASCII +# characters. Some Python code doesn't tolerate non-ASCII characters +# in filenames very well, so if the current working directory is +# non-ASCII then we skip the tests that run those programs. +# +# This would be just papering over a real problem, except that the +# tests that we skip are launched from initscripts and thus normally +# run in system directories with ASCII names. (This problem only came +# up at all because the Debian autobuilders do build in a top-level +# directory named /«BUILDDIR».) +case `pwd | tr -d ' -~'` in + '') non_ascii_cwd=false ;; + *) non_ascii_cwd=true +esac + if test $HAVE_PYTHON = yes; then if python -m argparse 2>/dev/null; then : diff --git a/tests/interface-reconfigure.at b/tests/interface-reconfigure.at index fdfe12ef7..26a77eb9c 100644 --- a/tests/interface-reconfigure.at +++ b/tests/interface-reconfigure.at @@ -696,6 +696,7 @@ AT_BANNER([interface-reconfigure]) AT_SETUP([non-VLAN, non-bond]) AT_KEYWORDS([interface-reconfigure]) +AT_SKIP_IF([$non_ascii_cwd]) ifr_setup AT_CHECK([ifr_run --force xenbr2 up], [0], [], [stderr]) @@ -771,6 +772,7 @@ AT_CLEANUP AT_SETUP([VLAN, non-bond]) AT_KEYWORDS([interface-reconfigure]) +AT_SKIP_IF([$non_ascii_cwd]) ifr_setup AT_CHECK([ifr_run --force xapi3 up], [0], [], [stderr]) @@ -844,6 +846,7 @@ AT_CLEANUP AT_SETUP([Bond, non-VLAN]) AT_KEYWORDS([interface-reconfigure]) +AT_SKIP_IF([$non_ascii_cwd]) ifr_setup # Pretend that bond0 exists, even though it would really be created by @@ -932,6 +935,7 @@ AT_CLEANUP AT_SETUP([VLAN on bond]) AT_KEYWORDS([interface-reconfigure]) +AT_SKIP_IF([$non_ascii_cwd]) ifr_setup # Pretend that bond0 exists, even though it would really be created by diff --git a/tests/ovs-monitor-ipsec.at b/tests/ovs-monitor-ipsec.at index bd150cf97..67705fa11 100644 --- a/tests/ovs-monitor-ipsec.at +++ b/tests/ovs-monitor-ipsec.at @@ -2,6 +2,7 @@ AT_BANNER([ovs-monitor-ipsec]) AT_SETUP([ovs-monitor-ipsec]) AT_SKIP_IF([test $HAVE_PYTHON = no]) +AT_SKIP_IF([$non_ascii_cwd]) OVS_RUNDIR=`pwd`; export OVS_RUNDIR OVS_DBDIR=`pwd`; export OVS_DBDIR -- 2.43.0