summaryrefslogtreecommitdiff
path: root/gl
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-04-27 14:46:32 +0200
committerSimon Josefsson <simon@josefsson.org>2009-04-27 14:46:32 +0200
commitbea72ffce0b5b981a06eb4e80f14f10412924f6b (patch)
tree8af0ea38c56f9e0e96ad0039ba9a91b19d20890a /gl
parentb85f70d2f0a20c21b2500d89c66ac56a249abf26 (diff)
downloadgnutls-bea72ffce0b5b981a06eb4e80f14f10412924f6b.tar.gz
Update gnulib files.
Diffstat (limited to 'gl')
-rw-r--r--gl/Makefile.am14
-rw-r--r--gl/m4/gnulib-comp.m46
-rw-r--r--gl/tests/Makefile.am9
-rwxr-xr-xgl/tests/test-vc-list-files-cvs.sh62
-rwxr-xr-xgl/tests/test-vc-list-files-git.sh46
5 files changed, 137 insertions, 0 deletions
diff --git a/gl/Makefile.am b/gl/Makefile.am
index db003a5038..95dc23078f 100644
--- a/gl/Makefile.am
+++ b/gl/Makefile.am
@@ -1046,6 +1046,13 @@ EXTRA_DIST += unistd.in.h
## end gnulib module unistd
+## begin gnulib module useless-if-before-free
+
+
+EXTRA_DIST += $(top_srcdir)/build-aux/useless-if-before-free
+
+## end gnulib module useless-if-before-free
+
## begin gnulib module vasnprintf
@@ -1055,6 +1062,13 @@ EXTRA_libgnu_la_SOURCES += asnprintf.c printf-args.c printf-parse.c vasnprintf.c
## end gnulib module vasnprintf
+## begin gnulib module vc-list-files
+
+
+EXTRA_DIST += $(top_srcdir)/build-aux/vc-list-files
+
+## end gnulib module vc-list-files
+
## begin gnulib module version-etc
libgnu_la_SOURCES += version-etc.h version-etc.c
diff --git a/gl/m4/gnulib-comp.m4 b/gl/m4/gnulib-comp.m4
index db94eda7ac..fc7e4eb811 100644
--- a/gl/m4/gnulib-comp.m4
+++ b/gl/m4/gnulib-comp.m4
@@ -235,6 +235,8 @@ AC_SUBST([LTALLOCA])
gl_SYS_IOCTL_H
AC_PROG_MKDIR_P
AC_CHECK_FUNCS([shutdown])
+ abs_aux_dir=`cd "$ac_aux_dir"; pwd`
+ AC_SUBST([abs_aux_dir])
m4_ifval(gltests_LIBSOURCES_LIST, [
m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ ||
for gl_file in ]gltests_LIBSOURCES_LIST[ ; do
@@ -332,6 +334,8 @@ AC_DEFUN([gl_FILE_LIST], [
build-aux/link-warning.h
build-aux/pmccabe.css
build-aux/pmccabe2html
+ build-aux/useless-if-before-free
+ build-aux/vc-list-files
doc/fdl-1.3.texi
doc/gendocs_template
doc/gpl-3.0.texi
@@ -521,6 +525,8 @@ AC_DEFUN([gl_FILE_LIST], [
tests/test-sys_time.c
tests/test-unistd.c
tests/test-vasnprintf.c
+ tests/test-vc-list-files-cvs.sh
+ tests/test-vc-list-files-git.sh
tests/test-wchar.c
tests=lib/dummy.c
tests=lib/gettimeofday.c
diff --git a/gl/tests/Makefile.am b/gl/tests/Makefile.am
index d6d7b03085..421303a3a8 100644
--- a/gl/tests/Makefile.am
+++ b/gl/tests/Makefile.am
@@ -352,6 +352,15 @@ EXTRA_DIST += test-vasnprintf.c
## end gnulib module vasnprintf-tests
+## begin gnulib module vc-list-files-tests
+
+TESTS += test-vc-list-files-git.sh
+TESTS += test-vc-list-files-cvs.sh
+TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)'$(PATH_SEPARATOR)"$$PATH"
+EXTRA_DIST += test-vc-list-files-git.sh test-vc-list-files-cvs.sh
+
+## end gnulib module vc-list-files-tests
+
## begin gnulib module verify
libtests_a_SOURCES += verify.h
diff --git a/gl/tests/test-vc-list-files-cvs.sh b/gl/tests/test-vc-list-files-cvs.sh
new file mode 100755
index 0000000000..12c93664d2
--- /dev/null
+++ b/gl/tests/test-vc-list-files-cvs.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+# Unit tests for vc-list-files
+# Copyright (C) 2008 Free Software Foundation, Inc.
+# This file is part of the GNUlib Library.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+tmpdir=vc-cvs-$$
+trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0
+trap '(exit $?); exit $?' 1 2 13 15
+
+if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
+ compare() { diff -u "$@"; }
+elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
+ compare() { cmp -s "$@"; }
+else
+ compare() { cmp "$@"; }
+fi
+
+repo=`pwd`/$tmpdir/repo
+
+fail=0
+for i in with-cvsu without; do
+ # On the first iteration, test using cvsu, if it's in your path.
+ # On the second iteration, ensure that cvsu fails, so we'll
+ # exercise the awk-using code.
+ if test $i = without; then
+ printf '%s\n' '#!/bin/sh' 'exit 1' > cvsu
+ chmod a+x cvsu
+ PATH=`pwd`:$PATH
+ export PATH
+ fi
+ ok=0
+ mkdir $tmpdir && cd $tmpdir &&
+ # without cvs, skip the test
+ # The double use of 'exit' is needed for the reference to $? inside the trap.
+ { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 \
+ || { echo "Skipping test: cvs not found in PATH"; (exit 77); exit 77; }; } &&
+ mkdir w && cd w &&
+ mkdir d &&
+ touch d/a b c &&
+ cvs -Q -d "$repo" import -m imp m M M0 &&
+ cvs -Q -d "$repo" co m && cd m &&
+ printf '%s\n' b c d/a > expected &&
+ vc-list-files | sort > actual &&
+ compare expected actual &&
+ ok=1
+ test $ok = 0 && fail=1
+done
+
+(exit $fail); exit $fail
diff --git a/gl/tests/test-vc-list-files-git.sh b/gl/tests/test-vc-list-files-git.sh
new file mode 100755
index 0000000000..a42aec19a4
--- /dev/null
+++ b/gl/tests/test-vc-list-files-git.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Unit tests for vc-list-files
+# Copyright (C) 2008 Free Software Foundation, Inc.
+# This file is part of the GNUlib Library.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+if ( diff --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
+ compare() { diff -u "$@"; }
+elif ( cmp --version < /dev/null 2>&1 | grep GNU ) 2>&1 > /dev/null; then
+ compare() { cmp -s "$@"; }
+else
+ compare() { cmp "$@"; }
+fi
+
+tmpdir=vc-git-$$
+trap 'st=$?; cd '"`pwd`"' && rm -rf $tmpdir; exit $st' 0
+trap '(exit $?); exit $?' 1 2 13 15
+
+fail=1
+mkdir $tmpdir && cd $tmpdir &&
+ # without git, skip the test
+ # The double use of 'exit' is needed for the reference to $? inside the trap.
+ { ( git init -q ) > /dev/null 2>&1 \
+ || { echo "Skipping test: git not found in PATH"; (exit 77); exit 77; }; } &&
+ mkdir d &&
+ touch d/a b c &&
+ git add . > /dev/null &&
+ git commit -q -a -m log &&
+ printf '%s\n' b c d/a > expected &&
+ vc-list-files > actual &&
+ compare expected actual &&
+ fail=0
+
+(exit $fail); exit $fail