-# create file(s) (mknod (2)), write data, check data, check file attributes
-echo "Part 1. create file(s) (mknod (2)), write data, check data, check file attributes."
-do_mknod || error_exit "mknod failed"
-echo "Writing data to file(s) ... store md5sum ... "
-sums="$(do_write)" || error_exit "write data failed"
-do_check_data "$sums" || error_exit "md5sum verification failed"
-get_stat || { error_noexit "attributes check failed" ; STATUS=1; }
-
-# file(s) attributes modification
-echo "Part 2. file(s) attributes modification."
-do_chmod || error_exit "chmod failed"
-get_stat || { error_noexit "wrong attributes after chmod"; STATUS=1; }
-
-do_change_timestamps || error_exit "timestamps change failed"
-do_check_timestamps || { error_noexit "wrong timestamps"; STATUS=1; }
-
-# truncate file(s) to 0 size, check new file size
-echo "Part 3. truncate file(s) to 0 size, check new file size."
-do_truncate || error_exit"truncate failed"
-get_stat || { error_noexit "wrong attributes after truncate"; STATUS=1; }
-
-# directory content solidity
-echo "Part 4. directory content solidity: fill up directory, check dir content, remove some files, check dir content."
-do_fill_dir || error_exit "dir creation failed"
-check_dir_contents || { error_noexit "dir contents check failed"; STATUS=1; }
-
-do_partial_delete $(($NUM_FILES / 2)) || error_exit "delete failed"
-check_dir_contents $(($NUM_FILES / 2 + 1)) ||
- { error_noexit "dir contents check after delete failed"; STATUS=1; }
-
-# "write_disjoint" test
-echo "Part 5. write_disjoint test: see lustre/tests/mpi/write_disjoint.c for details"
-if [ -f "$WRITE_DISJOINT" ]; then
- set $TRACE
- MACHINEFILE=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
- generate_machine_file $NODES_TO_USE $MACHINEFILE
- mpi_run -np $(get_node_count ${NODES_TO_USE//,/ }) -machinefile $MACHINEFILE \
- $WRITE_DISJOINT -f $WRITE_DISJOINT_FILE -n $NUMLOOPS || STATUS=1
-else
- skip_env "$0 : write_disjoint not found "
-fi
-
-equals_msg `basename $0`: test complete, cleaning up
+test_1(){
+ log "Create files (mknod (2)) and write data"
+ do_mknod || error "mknod failed"
+ do_write || error "write data failed"
+ log "Check data and file attributes."
+ do_check_data || error "md5sum verification failed"
+ get_stat || error "attributes check failed"
+
+ # file attributes modification
+ log "File attributes modification."
+ do_chmod || error "chmod failed"
+ get_stat || error "wrong attributes after chmod"
+
+ do_change_timestamps || error "timestamps change failed"
+ do_check_timestamps || error "wrong timestamps"
+
+ # truncate file(s) to 0 size, check new file size
+ log "Truncate file(s) to 0 size, check new file size."
+ do_truncate || error "truncate failed"
+ get_stat || error "wrong attributes after truncate"
+}
+run_test 1 "create files (mknod), write and check data, truncate files"
+
+test_2() {
+ do_fill_dir || error "dir creation failed"
+ check_dir_contents || error "dir contents check failed"
+
+ do_partial_delete $(($NUM_FILES / 2)) || error "delete failed"
+ check_dir_contents $(($NUM_FILES / 2 + 1)) ||
+ error "dir contents check after delete failed"
+}
+run_test 2 "directory content create, check, delete files , check"
+
+test_3() {
+ WRITE_DISJOINT=${WRITE_DISJOINT:-$(which write_disjoint 2> /dev/null)} || true
+ disjoint_file=$TESTDIR/$tfile
+ machine_file=${MACHINEFILE:-$TMP/$(basename $0 .sh).machines}
+ numloops=1000
+
+ [ ! -f "$WRITE_DISJOINT" ] && skip_env "write_disjoint not found"
+
+ set $TRACE
+ generate_machine_file $NODES_TO_USE $machine_file
+ mpi_run ${MACHINEFILE_OPTION} $machine_file \
+ -np $(get_node_count ${NODES_TO_USE//,/ }) \
+ $WRITE_DISJOINT -f $disjoint_file -n $numloops ||
+ error "mpi_run failed"
+
+ rm -f $machine_file
+}
+run_test 3 "write_disjoint test"
+
+complete $SECONDS