@@ -926,6 +926,33 @@ test_expect_success 'flux-jobs --format={waitstatus},{returncode}' '
926926 test $count -eq $(state_count canceled)
927927'
928928
929+ test_expect_success ' flux-jobs --format={inactive_reason}' '
930+ FORMAT="{inactive_reason:h}" &&
931+ flux jobs --filter=pending,running -no "$FORMAT" > inactivereasonPR.out &&
932+ count=$(grep -c "^-$" inactivereasonPR.out) &&
933+ test_debug "echo empty got $count, want $(state_count active)" &&
934+ test $count -eq $(state_count active) &&
935+ flux jobs --filter=inactive -no "$FORMAT" > inactivereasonI.out &&
936+ count=$(grep -c "^command not found$" inactivereasonI.out) &&
937+ test_debug "echo command not found got $count, want $(state_count failed_exec)" &&
938+ test $count -eq $(state_count failed_exec) &&
939+ count=$(grep -c "^Terminated$" inactivereasonI.out) &&
940+ test_debug "echo Terminated got $count, want $(state_count terminated)" &&
941+ test $count -eq $(state_count terminated) &&
942+ count=$(grep -c "^Exception: type=myexception note=myexception$" inactivereasonI.out) &&
943+ test_debug "echo exception got $count, want $(state_count exception)" &&
944+ test $count -eq $(state_count exception) &&
945+ count=$(grep -c "^Timeout$" inactivereasonI.out) &&
946+ test_debug "echo Timeout got $count, want $(state_count timeout)" &&
947+ test $count -eq $(state_count timeout) &&
948+ count=$(grep -c "^Exit 0$" inactivereasonI.out) &&
949+ test_debug "echo Exit 0 got $count, want $(state_count completed)" &&
950+ test $count -eq $(state_count completed) &&
951+ count=$(grep -c "^Canceled: mecanceled$" inactivereasonI.out) &&
952+ test_debug "echo canceled got $count, want $(state_count canceled)" &&
953+ test $count -eq $(state_count canceled)
954+ '
955+
929956test_expect_success ' flux-jobs --format={expiration},{t_remaining} works' '
930957 expiration=$(flux jobs -f running -c1 -no "{expiration:.0f}") &&
931958 t_remaining=$(flux jobs -f running -c1 -no "{t_remaining:.0f}") &&
@@ -1094,6 +1121,7 @@ test_expect_success 'flux-jobs: header included with all custom formats' '
10941121 nodelist==NODELIST
10951122 contextual_info==INFO
10961123 contextual_time==TIME
1124+ inactive_reason==INACTIVE-REASON
10971125 success==SUCCESS
10981126 exception.occurred==EXCEPTION-OCCURRED
10991127 exception.severity==EXCEPTION-SEVERITY
0 commit comments