summaryrefslogtreecommitdiff
path: root/src/module_helper/tests
blob: f4d31139b0f969c7327ef6bd0007f685a3ea9b49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
SUCCEED () {
	LINES=`"$@" 2>&1 | wc -l`
	case $LINES in
	1) echo "Test OK: $@" ;;
	*) echo "*** TEST FAILED ***"
	   echo "Test:    $@"
	   echo "Output:"
	   "$@" 2>&1 ;;
	esac
}

FAIL () {
	LINES=`"$@" 2>&1 | wc -l`
	case $LINES in
	1) echo "*** TEST FAILED ***"
	   echo "Test:    $@"
	   echo "Output:"
	   "$@" 2>&1 ;;
	*) echo "Test OK: $@" ;;
	esac
}

# These should succeed
SUCCEED ./linuxcnc_module_helper insert /lib/modules/rtapi.ko
SUCCEED ./linuxcnc_module_helper insert /lib/modules/cheese/rtapi.o

SUCCEED ./linuxcnc_module_helper remove rtapi

# These should fail
FAIL ./linuxcnc_module_helper insert /lib/modules/../../rtapi.ko
FAIL ./linuxcnc_module_helper insert /lib/modules/rtapi.ok
FAIL ./linuxcnc_module_helper insert /lib/modules/rtapi.oo
FAIL ./linuxcnc_module_helper insert /lib/modules/rtapicheese.ko
FAIL ./linuxcnc_module_helper insert /lib/modules/r.ko
FAIL ./linuxcnc_module_helper insert /lib/modules/rtapi.cheese.ko
FAIL ./linuxcnc_module_helper insert /lib/modules/.cheese.ko
FAIL ./linuxcnc_module_helper insert /lib/modules/.ko

FAIL ./linuxcnc_module_helper remove rtapicheese
FAIL ./linuxcnc_module_helper remove r
FAIL ./linuxcnc_module_helper remove rtapi.cheese