treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / testing / selftests / android / ion / ion_test.sh
blob69e676cfc94e36d570e1204e063f929d2823d8eb
1 #!/bin/bash
3 heapsize=4096
4 TCID="ion_test.sh"
5 errcode=0
7 # Kselftest framework requirement - SKIP code is 4.
8 ksft_skip=4
10 run_test()
12 heaptype=$1
13 ./ionapp_export -i $heaptype -s $heapsize &
14 sleep 1
15 ./ionapp_import
16 if [ $? -ne 0 ]; then
17 echo "$TCID: heap_type: $heaptype - [FAIL]"
18 errcode=1
19 else
20 echo "$TCID: heap_type: $heaptype - [PASS]"
22 sleep 1
23 echo ""
26 check_root()
28 uid=$(id -u)
29 if [ $uid -ne 0 ]; then
30 echo $TCID: must be run as root >&2
31 exit $ksft_skip
35 check_device()
37 DEVICE=/dev/ion
38 if [ ! -e $DEVICE ]; then
39 echo $TCID: No $DEVICE device found >&2
40 echo $TCID: May be CONFIG_ION is not set >&2
41 exit $ksft_skip
45 main_function()
47 check_device
48 check_root
50 # ION_SYSTEM_HEAP TEST
51 run_test 0
52 # ION_SYSTEM_CONTIG_HEAP TEST
53 run_test 1
56 main_function
57 echo "$TCID: done"
58 exit $errcode