test_stress_04.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-2.0
  3. . "$(cd "$(dirname "$0")" && pwd)"/test_common.sh
  4. ERR_CODE=0
  5. ublk_io_and_kill_daemon()
  6. {
  7. run_io_and_kill_daemon "$@"
  8. ERR_CODE=$?
  9. if [ ${ERR_CODE} -ne 0 ]; then
  10. echo "$TID failure: $*"
  11. _show_result $TID $ERR_CODE
  12. fi
  13. }
  14. if ! _have_program fio; then
  15. exit "$UBLK_SKIP_CODE"
  16. fi
  17. if ! _have_feature "ZERO_COPY"; then
  18. exit "$UBLK_SKIP_CODE"
  19. fi
  20. _prep_test "stress" "run IO and kill ublk server(zero copy)"
  21. _create_backfile 0 256M
  22. _create_backfile 1 128M
  23. _create_backfile 2 128M
  24. ublk_io_and_kill_daemon 8G -t null -q 4 -z --no_ublk_fixed_fd &
  25. ublk_io_and_kill_daemon 256M -t loop -q 4 -z --no_ublk_fixed_fd "${UBLK_BACKFILES[0]}" &
  26. ublk_io_and_kill_daemon 256M -t stripe -q 4 -z "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
  27. wait
  28. if _have_feature "AUTO_BUF_REG"; then
  29. ublk_io_and_kill_daemon 8G -t null -q 4 --auto_zc &
  30. ublk_io_and_kill_daemon 256M -t loop -q 4 --auto_zc "${UBLK_BACKFILES[0]}" &
  31. ublk_io_and_kill_daemon 256M -t stripe -q 4 --auto_zc --no_ublk_fixed_fd "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
  32. ublk_io_and_kill_daemon 8G -t null -q 4 -z --auto_zc --auto_zc_fallback &
  33. wait
  34. fi
  35. if _have_feature "PER_IO_DAEMON"; then
  36. ublk_io_and_kill_daemon 8G -t null -q 4 --auto_zc --nthreads 8 --per_io_tasks &
  37. ublk_io_and_kill_daemon 256M -t loop -q 4 --auto_zc --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[0]}" &
  38. ublk_io_and_kill_daemon 256M -t stripe -q 4 --auto_zc --nthreads 8 --per_io_tasks "${UBLK_BACKFILES[1]}" "${UBLK_BACKFILES[2]}" &
  39. ublk_io_and_kill_daemon 8G -t null -q 4 -z --auto_zc --auto_zc_fallback --nthreads 8 --per_io_tasks &
  40. wait
  41. fi
  42. _cleanup_test "stress"
  43. _show_result $TID $ERR_CODE