diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/misc/mktemp | 7 | ||||
-rwxr-xr-x | tests/misc/sort-merge | 5 | ||||
-rwxr-xr-x | tests/misc/tac | 9 |
3 files changed, 19 insertions, 2 deletions
diff --git a/tests/misc/mktemp b/tests/misc/mktemp index 616a9e44f..356558291 100755 --- a/tests/misc/mktemp +++ b/tests/misc/mktemp @@ -49,6 +49,7 @@ sub check_tmp($$) # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; my $prog = 'mktemp'; +my $bad_dir = 'no/such/dir'; my @Tests = ( @@ -97,6 +98,12 @@ my @Tests = {POST => sub { my ($f) = @_; defined $f or return; chomp $f; check_tmp $f, 'F'; unlink $f; rmdir 'a' or die "rmdir a: $!\n" }} ], + + ['pipe-bad-tmpdir', + {ENV => "TMPDIR=$bad_dir"}, + {ERR_SUBST => "s,($bad_dir/)[^']+': .*,\$1...,"}, + {ERR => "$prog: failed to create file via template `$bad_dir/...\n"}, + {EXIT => 1}], ); my $save_temps = $ENV{DEBUG}; diff --git a/tests/misc/sort-merge b/tests/misc/sort-merge index 985d7a414..6b8192610 100755 --- a/tests/misc/sort-merge +++ b/tests/misc/sort-merge @@ -66,8 +66,9 @@ my @Tests = # this should fail since nmerge < # of input files, so # temp files are needed ['nmerge-no', "-m --batch-size=2 -T$badtmp", @inputs, - {ERR_SUBST=>"s|: $badtmp/sort.+||"}, - {ERR=>"$prog: cannot create temporary file\n"}, {EXIT=>2}], + {ERR_SUBST=>"s|': .*|':|"}, + {ERR=>"$prog: cannot create temporary file in `$badtmp':\n"}, + {EXIT=>2}], # This used to fail because setting batch-size without also setting # buffer size would cause the buffer size to be set to the minimum. diff --git a/tests/misc/tac b/tests/misc/tac index 2f9981d49..9995357ab 100755 --- a/tests/misc/tac +++ b/tests/misc/tac @@ -22,6 +22,8 @@ my $prog = 'tac'; # Turn off localization of executable's output. @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3; +my $bad_dir = 'no/such/dir'; + my @Tests = ( ['segfault', '-r', {IN=>"a\n"}, {IN=>"b\n"}, {OUT=>"a\nb\n"}], @@ -58,6 +60,13 @@ my @Tests = ['opt-br2', qw(-b -r -s '\._+'), {IN=>".__x.___y.____z._1._2.__3.___4"}, {OUT=>".___4.__3._2._1.____z.___y.__x"}], + + ['pipe-bad-tmpdir', + {ENV => "TMPDIR=$bad_dir"}, + {IN_PIPE => "a\n"}, + {ERR_SUBST => "s,`$bad_dir': .*,...,"}, + {ERR => "$prog: cannot create temporary file in ...\n"}, + {EXIT => 1}], ); @Tests = triple_test \@Tests; |