[libvirt] [PATCH v2] tests: Skip daemon-conf test if dir exceeds UNIX_PATH_MAX

The max path length for unix sockets is pretty small (108, see man 7 unix). If 'make check' is run from a directory that exceeds this, one of the tests will fail, and in such a way that requires manually editting the test to determine why. There are certainly other ways to handle this, but I've chosen just to skip the offending test if we will exceed the length limitation. v2: Drop bashism, use test infrastructure to warn and skip Signed-off-by: Cole Robinson <crobinso@redhat.com> --- tests/daemon-conf | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/tests/daemon-conf b/tests/daemon-conf index 10c1628..14d4ced 100755 --- a/tests/daemon-conf +++ b/tests/daemon-conf @@ -76,6 +76,13 @@ sed 's,^log_outputs.*,log_outputs="3:file:'"$(pwd)/log"'",' tmp.conf > k \ || fail=1 mv k tmp.conf || fail=1 +# Unix socket max path size is 108 on linux. If the generated sock path +# exceeds this, the test will fail, so skip it if CWD is too long +SOCKPATH=`pwd`/libvirt-sock +if test 108 -lt `echo $SOCKPATH | wc -c`; then + skip_test_ "CWD too long" +fi + $abs_top_builddir/daemon/libvirtd --pid-file=pid-file --config=tmp.conf > log 2>&1 & pid=$! sleep $sleep_secs kill $pid -- 1.6.6.1

On 05/17/2010 12:21 PM, Cole Robinson wrote:
+++ b/tests/daemon-conf @@ -76,6 +76,13 @@ sed 's,^log_outputs.*,log_outputs="3:file:'"$(pwd)/log"'",' tmp.conf > k \ || fail=1 mv k tmp.conf || fail=1
+# Unix socket max path size is 108 on linux. If the generated sock path +# exceeds this, the test will fail, so skip it if CWD is too long +SOCKPATH=`pwd`/libvirt-sock +if test 108 -lt `echo $SOCKPATH | wc -c`; then + skip_test_ "CWD too long" +fi
Makes for a smaller diff with the early exit :) ACK. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 05/17/2010 02:32 PM, Eric Blake wrote:
On 05/17/2010 12:21 PM, Cole Robinson wrote:
+++ b/tests/daemon-conf @@ -76,6 +76,13 @@ sed 's,^log_outputs.*,log_outputs="3:file:'"$(pwd)/log"'",' tmp.conf > k \ || fail=1 mv k tmp.conf || fail=1
+# Unix socket max path size is 108 on linux. If the generated sock path +# exceeds this, the test will fail, so skip it if CWD is too long +SOCKPATH=`pwd`/libvirt-sock +if test 108 -lt `echo $SOCKPATH | wc -c`; then + skip_test_ "CWD too long" +fi
Makes for a smaller diff with the early exit :)
ACK.
Thanks, pushed. - Cole
participants (2)
-
Cole Robinson
-
Eric Blake