tests: mixed_create_failure: explicitly note the error

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Issue: #13215
Closes #13259
This commit is contained in:
наб 2022-03-22 22:26:00 +01:00 committed by Brian Behlendorf
parent 50a33b8c69
commit 0990228ab8
1 changed files with 6 additions and 10 deletions

View File

@ -70,6 +70,7 @@ function test_ops
{ {
typeset obj_type=$1 typeset obj_type=$1
typeset testdir=$2 typeset testdir=$2
typeset save_name=
target_obj='target-file' target_obj='target-file'
@ -83,7 +84,7 @@ function test_ops
log_note "Created test dir $test_path" log_note "Created test dir $test_path"
if [[ $obj_type = "symlink" || $obj_type = "hardlink" ]]; then if [[ $obj_type = "symlink" || $obj_type = "hardlink" ]]; then
touch $test_path/$target_obj > $test_path/$target_obj
log_note "Created target: $test_path/$target_obj" log_note "Created target: $test_path/$target_obj"
op="$op $test_path/$target_obj" op="$op $test_path/$target_obj"
fi fi
@ -104,21 +105,16 @@ function test_ops
fi fi
fi fi
done done
[ -n "$save_name" ] || log_fail "Didn't ENOSPC!"
log_note 'Test rename \"sample_name\" rename' log_note 'Test rename "sample_name" rename'
TMP_OBJ="$test_path/tmp_obj" TMP_OBJ="$test_path/tmp_obj"
cmd="$op $TMP_OBJ" cmd="$op $TMP_OBJ"
out=$($cmd 2>&1) log_must $cmd
ret=$?
if (($ret != 0)); then
log_fail "$cmd failed: $out"
fi
# Now, try to rename the tmp_obj to the name which we failed to add earlier. # Now, try to rename the tmp_obj to the name which we failed to add earlier.
# This should fail as well. # This should fail as well.
out=$(mv $TMP_OBJ $save_name 2>&1) if ! out=$(mv $TMP_OBJ $save_name 2>&1); then
ret=$?
if (($ret != 0)); then
if [[ $out = *@(No space left on device)* ]]; then if [[ $out = *@(No space left on device)* ]]; then
log_note "$cmd failed as expected: $out" log_note "$cmd failed as expected: $out"
else else