ion_test.sh 760 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. heapsize=4096
  3. TCID="ion_test.sh"
  4. errcode=0
  5. run_test()
  6. {
  7. heaptype=$1
  8. ./ionapp_export -i $heaptype -s $heapsize &
  9. sleep 1
  10. ./ionapp_import
  11. if [ $? -ne 0 ]; then
  12. echo "$TCID: heap_type: $heaptype - [FAIL]"
  13. errcode=1
  14. else
  15. echo "$TCID: heap_type: $heaptype - [PASS]"
  16. fi
  17. sleep 1
  18. echo ""
  19. }
  20. check_root()
  21. {
  22. uid=$(id -u)
  23. if [ $uid -ne 0 ]; then
  24. echo $TCID: must be run as root >&2
  25. exit 0
  26. fi
  27. }
  28. check_device()
  29. {
  30. DEVICE=/dev/ion
  31. if [ ! -e $DEVICE ]; then
  32. echo $TCID: No $DEVICE device found >&2
  33. echo $TCID: May be CONFIG_ION is not set >&2
  34. exit 0
  35. fi
  36. }
  37. main_function()
  38. {
  39. check_device
  40. check_root
  41. # ION_SYSTEM_HEAP TEST
  42. run_test 0
  43. # ION_SYSTEM_CONTIG_HEAP TEST
  44. run_test 1
  45. }
  46. main_function
  47. echo "$TCID: done"
  48. exit $errcode