tests: Skip Python daemon tests in directory with non-ASCII name.
authorBen Pfaff <blp@nicira.com>
Fri, 25 Oct 2013 16:22:36 +0000 (09:22 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 25 Oct 2013 18:04:30 +0000 (11:04 -0700)
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@nicira.com>
tests/atlocal.in
tests/interface-reconfigure.at
tests/ovs-monitor-ipsec.at

index 3db626c..5c0db2a 100644 (file)
@@ -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
         :
index fdfe12e..26a77eb 100644 (file)
@@ -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
 \f
 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
 \f
 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
 \f
 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
index bd150cf..67705fa 100644 (file)
@@ -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