3 mkdir
-p tests
/tmp
/proc
6 echo 'foo_bar 100 1' > tests
/tmp
/proc
/modules
8 [ "`./rmmod foo_bar 2>&1`" = "ERROR: Module foo_bar is in use" ]
9 [ "`./rmmod foo-bar 2>&1`" = "ERROR: Module foo_bar is in use" ]
11 # Old style with dependencies
12 echo 'foo_bar 100 1 dep1' > tests
/tmp
/proc
/modules
14 [ "`./rmmod foo_bar 2>&1`" = "ERROR: Module foo_bar is in use by dep1" ]
15 [ "`./rmmod foo-bar 2>&1`" = "ERROR: Module foo_bar is in use by dep1" ]
17 echo 'foo_bar 100 1 dep1 dep2' > tests
/tmp
/proc
/modules
19 [ "`./rmmod foo_bar 2>&1`" = "ERROR: Module foo_bar is in use by dep1 dep2" ]
20 [ "`./rmmod foo-bar 2>&1`" = "ERROR: Module foo_bar is in use by dep1 dep2" ]
23 echo 'foo_bar 100 1 -' > tests
/tmp
/proc
/modules
25 [ "`./rmmod foo_bar 2>&1`" = "ERROR: Module foo_bar is in use" ]
26 [ "`./rmmod foo-bar 2>&1`" = "ERROR: Module foo_bar is in use" ]
28 echo 'foo_bar 100 1 a,' > tests
/tmp
/proc
/modules
30 [ "`./rmmod foo_bar 2>&1`" = "ERROR: Module foo_bar is in use by a" ]
31 [ "`./rmmod foo-bar 2>&1`" = "ERROR: Module foo_bar is in use by a" ]
33 echo 'foo_bar 100 1 a,b,' > tests
/tmp
/proc
/modules
35 [ "`./rmmod foo_bar 2>&1`" = "ERROR: Module foo_bar is in use by a,b" ]
36 [ "`./rmmod foo-bar 2>&1`" = "ERROR: Module foo_bar is in use by a,b" ]
38 echo 'foo_bar 100 1 a,b, newoption' > tests
/tmp
/proc
/modules
40 [ "`./rmmod foo_bar 2>&1`" = "ERROR: Module foo_bar is in use by a,b" ]
41 [ "`./rmmod foo-bar 2>&1`" = "ERROR: Module foo_bar is in use by a,b" ]
43 # Not in use (newstyle)
44 echo 'foo_bar 100 0 -' > tests
/tmp
/proc
/modules
45 [ "`./rmmod foo_bar`" = "DELETE_MODULE: foo_bar EXCL NONBLOCK " ]
46 [ "`./rmmod foo-bar`" = "DELETE_MODULE: foo_bar EXCL NONBLOCK " ]
48 echo 'foo_bar 100 0 - newoption' > tests
/tmp
/proc
/modules
49 [ "`./rmmod foo_bar`" = "DELETE_MODULE: foo_bar EXCL NONBLOCK " ]
50 [ "`./rmmod foo-bar`" = "DELETE_MODULE: foo_bar EXCL NONBLOCK " ]