]> git.draconx.ca Git - gob-dx.git/blobdiff - testsuite.at
Add test cases for various command-line options.
[gob-dx.git] / testsuite.at
index c87123b9fd61150ccc0cb25f8d78e452e5ccb28e..025e78f000f542fdf5853dd897edf1edf8d022ab 100644 (file)
@@ -3,6 +3,36 @@ License GPLv2+: GNU General Public License version 2 or any later version.
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.])
 
+dnl mtime_uptodate file-a file-b: returns success iff file-a's modification
+dnl time is at least as new as file-b's.
+m4_divert_push([PREPARE_TESTS])dnl
+mtime_uptodate () {
+  cat >mtime-uptodate.mk <<EOF
+$1: $2
+       false
+EOF
+  $MAKE -f mtime-uptodate.mk >/dev/null 2>&1 || return 1
+}
+m4_divert_pop([PREPARE_TESTS])
+
+dnl TEST_MTIME_DELAY
+dnl
+dnl Delay script execution such that file modifications done prior to the
+dnl delay will have older timestamps than file modifications performed after
+dnl the delay.
+dnl
+dnl Some filesystems have insufficient timestamp resolution (or maybe
+dnl computers are just too fast) to reliably distinguish between back-to-back
+dnl file modification.
+dnl
+dnl This delay is implemented by repeatingly touching files until a different
+dnl timestamp is produced.
+m4_define([TEST_MTIME_DELAY],
+[touch mtime-delay.old; touch mtime-delay.new
+while mtime_uptodate mtime-delay.old mtime-delay.new; do
+  touch mtime-delay.new
+done])
+
 dnl Compile a C source file with default cflags for libgobject.  The test
 dnl group is skipped if libgobject was not enabled at configure time.  The
 dnl first argument contains extra compiler flags, which must include the
@@ -63,8 +93,14 @@ CPPFLAGS="-I$builddir $CPPFLAGS"
   command -v $AUTOCONF
   (set -x; $AUTOCONF --version) 2>&1
   echo
+  AS_UNSET([MAKEFLAGS])
+  AS_ECHO(["MAKE = ${MAKE=make}"])
+  command -v $MAKE
+  (set -x; $MAKE --version) 2>&1
+  echo
 } >&AS_MESSAGE_LOG_FD
 m4_divert_pop([PREPARE_TESTS])
 
 m4_include([tests/general.at])
+m4_include([tests/options.at])
 m4_include([tests/interface.at])