2 # Check "printf" with long arguments.
4 # Copyright (C) 2006 Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 $PERL -e 1 > /dev/null 2>&1 || {
24 echo 1>&2 "$0: configure didn't find a usable version of Perl," \
25 "so can't run this test"
30 pwd=`${BUILD_SRC_DIR?}/pwd` || framework_failure=1
31 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
32 trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
33 trap '(exit $?); exit $?' 1 2 13 15
35 mkdir -p $tmp || framework_failure=1
36 cd $tmp || framework_failure=1
38 if test $framework_failure = 1; then
39 echo "$0: failure in testing framework" 1>&2
51 # Show that pwd works even when the length of the resulting
52 # directory name is longer than PATH_MAX.
56 (my $ME = $ENV{ARGV_0}) =~ s|.*/||;
61 my $expected = $cwd . ("/$z" x $n);
67 or die "$ME: at depth $i: $!\n";
72 my $build_src_dir = $ENV{BUILD_SRC_DIR};
74 or die "$ME: envvar BUILD_SRC_DIR not defined\n";
75 my $pwd_binary = "$build_src_dir/pwd";
77 or die "$ME: $pwd_binary is not an executable file\n";
78 chomp (my $actual = `$pwd_binary`);
79 if ($expected ne $actual)
81 my $e_len = length $expected;
82 my $a_len = length $actual;
83 warn "expected len: $e_len\n";
84 warn "actual len: $a_len\n";
85 warn "expected: $expected\n";
86 warn "actual: $actual\n";