[ovs-dev] [branch-1.9 Debian 1/2] tests: Skip Python daemon tests in directory with non-ASCII name.

Ben Pfaff blp at nicira.com
Fri Oct 25 16:22:36 UTC 2013


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 <blp at nicira.com>
---
 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 c736df4..2ca17af 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -24,6 +24,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 59507ff..e08f55b 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 e66c943..47266cb 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
-- 
1.7.10.4




More information about the dev mailing list