• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3heapsize=4096
4TCID="ion_test.sh"
5errcode=0
6
7# Kselftest framework requirement - SKIP code is 4.
8ksft_skip=4
9
10run_test()
11{
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]"
21	fi
22	sleep 1
23	echo ""
24}
25
26check_root()
27{
28	uid=$(id -u)
29	if [ $uid -ne 0 ]; then
30		echo $TCID: must be run as root >&2
31		exit $ksft_skip
32	fi
33}
34
35check_device()
36{
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
42	fi
43}
44
45main_function()
46{
47	check_device
48	check_root
49
50	# ION_SYSTEM_HEAP TEST
51	run_test 0
52	# ION_SYSTEM_CONTIG_HEAP TEST
53	run_test 1
54}
55
56main_function
57echo "$TCID: done"
58exit $errcode
59