[gjs] tests: Fallback for uuidgen -r flag



commit 243002decafdc23f60b41efbfa0e40b9553a34f8
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Jan 24 14:16:48 2016 -0800

    tests: Fallback for uuidgen -r flag
    
    In order to run the tests under DBus a UUID is generated using
    "uuidgen -r". The -r flag isn't standard, though; neither BSD's nor
    Apple's implementations support it. Check in configure.ac whether the
    flag is supported and fall back if not.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761072

 Makefile-test.am   |    3 ++-
 configure.ac       |    7 +++++++
 test/run-with-dbus |    2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/Makefile-test.am b/Makefile-test.am
index d65daad..5d9274f 100644
--- a/Makefile-test.am
+++ b/Makefile-test.am
@@ -119,7 +119,8 @@ TESTS_ENVIRONMENT =                                                 \
        GJS_PATH= \
        GI_TYPELIB_PATH=$(builddir):$(GI_TYPELIB_PATH)                                  \
        LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(FIREFOX_JS_LIBDIR)"       \
-       G_FILENAME_ENCODING=latin1      # ensure filenames are not utf8
+       G_FILENAME_ENCODING=latin1      # ensure filenames are not utf8 \
+       UUIDGEN="$(UUIDGEN)"
 
 if ENABLE_COVERAGE
 TESTS_ENVIRONMENT += \
diff --git a/configure.ac b/configure.ac
index 700bcf0..242d6c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -223,6 +223,13 @@ fi
 
 AC_SUBST(EXTRA_LINK_FLAGS)
 
+AC_PATH_PROG([UUIDGEN], [uuidgen])
+AC_MSG_CHECKING([whether $UUIDGEN supports the -r flag])
+AS_IF([$UUIDGEN -r >/dev/null 2>&1], [
+  AC_MSG_RESULT([yes])
+  UUIDGEN="$UUIDGEN -r"
+], [AC_MSG_RESULT([no])])
+
 AC_ARG_WITH([xvfb-tests],
   [AS_HELP_STRING([--with-xvfb-tests],
     [Run all tests under an XVFB server @<:@default=no@:>@])])
diff --git a/test/run-with-dbus b/test/run-with-dbus
index d776d3d..93d41f1 100755
--- a/test/run-with-dbus
+++ b/test/run-with-dbus
@@ -73,7 +73,7 @@ if test -z "$BUILDDIR" ; then
     die "Must set BUILDDIR"
 fi
 
-RANDOM=`uuidgen -r | cut -d '-' -f 3`
+RANDOM=`${UUIDGEN:-uuidgen -r} | cut -d '-' -f 3`
 
 ## this has to be set BEFORE we start session bus,
 ## or stuff the session bus starts won't get it


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]