[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Automake-NG] [PATCH 2/3] [ng] coverage: distributing lots of files
From: |
Stefano Lattarini |
Subject: |
[Automake-NG] [PATCH 2/3] [ng] coverage: distributing lots of files |
Date: |
Fri, 13 Jul 2012 12:19:20 +0200 |
* t/dist-many.sh: New test, try distributing ~ 30 thousands files.
Currently fails on several systems (e.g., Linux 2.6.30 on i686,
Solaris 10 on i86pc).
* t/dist-many2.sh: New test, check that our distribution rules do not
hit errors due to an exceeded command line length when there are
many files to distribute; it does so by faking a very low command
line length limit for 'mkdir' (max 50 arguments) and the shell (max
4000 characters). Currently failing.
Signed-off-by: Stefano Lattarini <address@hidden>
---
t/dist-many.sh | 82 ++++++++++++++++++++++++++++++++++++++
t/dist-many2.sh | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 201 insertions(+)
create mode 100755 t/dist-many.sh
create mode 100755 t/dist-many2.sh
diff --git a/t/dist-many.sh b/t/dist-many.sh
new file mode 100755
index 0000000..e006c01
--- /dev/null
+++ b/t/dist-many.sh
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# 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 2, 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/>.
+
+# Check that our dist rules do not hit errors due to a huge number
+# of files to be distributed. Checks similar in spirit are done by
+# sister test 'dist-many2.sh', which fakes an artificially low
+# command line length limit for 'mkdir' and the shell.
+
+. ./defs || exit 1
+
+echo AC_OUTPUT >> configure.ac
+
+file=an-empty-file-with-a-long-name
+dir1=a-directory-with-a-long-name
+dir2=another-long-named-directory
+
+# Distributed files will be 3 * $count.
+count=10000
+
+i=1
+while test $i -le $count; do
+ files="
+ $file.$i
+ $dir1.$i/foo
+ $dir2.$i/$file.$i
+ "
+ mkdir $dir1.$i $dir2.$i
+ for f in $files; do
+ : > $f
+ echo $f
+ done
+ i=$(($i + 1))
+ # Disable shell traces after the first iteration, to avoid
+ # polluting the test logs.
+ set +x
+done > t
+set -x # Re-enable shell traces.
+echo 'EXTRA_DIST = \' >> Makefile.am
+sed 's/$/ \\/' t >> Makefile.am
+echo '$(am__empty)' >> Makefile.am
+rm -f t
+
+test $(wc -l <Makefile.am) -eq $(( 2 + (3 * $count) )) \
+ || fatal_ "populating 'EXTRA_DIST'"
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+$MAKE distdir
+
+# Only check head, tail, and a random sample.
+
+test -f $distdir/$file.1
+test -f $distdir/$dir1.1/foo
+test -f $distdir/$dir2.1/$file.1
+
+test -f $distdir/$file.$count
+test -f $distdir/$dir1.$count/foo
+test -f $distdir/$dir2.$count/$file.$count
+
+test -f $distdir/$file.163
+test -f $distdir/$dir1.7645/foo
+test -f $distdir/$dir2.4077/$file.4077
+
+$MAKE distcheck
+
+:
diff --git a/t/dist-many2.sh b/t/dist-many2.sh
new file mode 100755
index 0000000..09e9d26
--- /dev/null
+++ b/t/dist-many2.sh
@@ -0,0 +1,119 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# 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 2, 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/>.
+
+# Check that our dist rules do not hit errors due to an exceeded
+# command line length when there are many files to distribute. Here,
+# we fake a very low command line length limit for 'mkdir' (max 50
+# arguments) and the shell (max 2000 chars in its command line).
+# The sister test 'dist-many.sh' try to hit the real command line length
+# limit of the system, by declaring a huge number of files to be cleaned.
+
+. ./defs || exit 1
+
+mkdir bin
+
+cat > bin/mkdir << END
+#!$AM_TEST_RUNNER_SHELL -u
+PATH='$PATH'; export PATH
+END
+cat >> bin/mkdir << 'END'
+if test $# -eq 0; then
+ echo "mkdir: missing argument" >&2
+ exit 1
+elif test $# -gt 50; then
+ echo "mkdir: argument list too long ($# arguments)" >&2
+ exit 1
+fi
+exec mkdir "$@"
+END
+
+cat > bin/am--sh << END
+#!$AM_TEST_RUNNER_SHELL -u
+sh='$SHELL'
+END
+cat >> bin/am--sh << 'END'
+cmdline=$*
+cmdline_len=${#cmdline}
+test $cmdline_len -le 4000 || {
+ echo "sh: command line to long (~ $cmdline_len characters)" >&2
+ exit 1
+}
+exec $sh "$@"
+END
+
+chmod a+x bin/mkdir bin/am--sh
+PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
+CONFIG_SHELL=$(pwd)/bin/am--sh; export CONFIG_SHELL
+
+echo AC_OUTPUT >> configure.ac
+
+file=an-empty-file-with-a-long-name
+dir1=a-directory-with-a-long-name
+dir2=another-long-named-directory
+
+# Distributed files will be 3 * $count.
+count=200
+
+i=1
+while test $i -le $count; do
+ files="
+ $file.$i
+ $dir1.$i/foo
+ $dir2.$i/$file.$i
+ "
+ mkdir $dir1.$i $dir2.$i
+ for f in $files; do
+ : > $f
+ echo $f
+ done
+ i=$(($i + 1))
+ # Disable shell traces after the first iteration, to avoid
+ # polluting the test logs.
+ set +x
+done > t
+set -x # Re-enable shell traces.
+echo 'EXTRA_DIST = \' >> Makefile.am
+sed 's/$/ \\/' t >> Makefile.am
+echo '$(am__empty)' >> Makefile.am
+rm -f t
+
+test $(wc -l <Makefile.am) -eq $(( 2 + (3 * $count) )) \
+ || fatal_ "populating 'EXTRA_DIST'"
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+$MAKE distdir
+
+# Only check head, tail, and a random sample.
+
+test -f $distdir/$file.1
+test -f $distdir/$dir1.1/foo
+test -f $distdir/$dir2.1/$file.1
+
+test -f $distdir/$file.$count
+test -f $distdir/$dir1.$count/foo
+test -f $distdir/$dir2.$count/$file.$count
+
+test -f $distdir/$file.87
+test -f $distdir/$dir1.32/foo
+test -f $distdir/$dir2.15/$file.15
+
+$MAKE distcheck
+
+:
--
1.7.9.5
- [Automake-NG] [PATCH 0/3] Distribute many files without hitting command line length limits, Stefano Lattarini, 2012/07/13
- [Automake-NG] [PATCH 2/3] [ng] coverage: distributing lots of files,
Stefano Lattarini <=
- [Automake-NG] [PATCH 1/3] [ng] dist: memoize some internal variables, Stefano Lattarini, 2012/07/13
- [Automake-NG] [PATCH 3/3] [ng] dist: do not exceed command line length limits, even with many files, Stefano Lattarini, 2012/07/13
- Re: [Automake-NG] [PATCH 3/3] [ng] dist: do not exceed command line length limits, even with many files, Akim Demaille, 2012/07/14
- Re: [Automake-NG] [PATCH 3/3] [ng] dist: do not exceed command line length limits, even with many files, Stefano Lattarini, 2012/07/14
- Re: [Automake-NG] [PATCH 3/3] [ng] dist: do not exceed command line length limits, even with many files, Eric Blake, 2012/07/14
- Re: [Automake-NG] [PATCH 3/3] [ng] dist: do not exceed command line length limits, even with many files, Stefano Lattarini, 2012/07/14
- Re: [Automake-NG] [PATCH 3/3] [ng] dist: do not exceed command line length limits, even with many files, Eric Blake, 2012/07/14