Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / tests / test_modprobe.aug
1 module Test_modprobe =
2
3 (* Based on 04config.sh from module-init-tools *)
4
5 let conf = "# Various aliases
6 alias alias_to_foo foo
7 alias alias_to_bar bar
8 alias alias_to_export_dep-$BITNESS export_dep-$BITNESS
9
10 # Various options, including options to aliases.
11 options alias_to_export_dep-$BITNESS I am alias to export_dep
12 options alias_to_noexport_nodep-$BITNESS_with_tabbed_options index=0 id=\"Thinkpad\" isapnp=0 \\
13 \tport=0x530 cport=0x538 fm_port=0x388 \\
14 \tmpu_port=-1 mpu_irq=-1 \\
15 \tirq=9 dma1=1 dma2=3 \\
16 \tenable=1 isapnp=0
17
18 # Blacklist
19 blacklist watchdog_drivers  \t
20
21 # Install commands
22 install bar echo Installing bar
23 install foo echo Installing foo
24 install export_nodep-$BITNESS echo Installing export_nodep
25
26 # Remove commands
27 remove bar echo Removing bar
28 remove foo echo Removing foo
29 remove export_nodep-$BITNESS echo Removing export_nodep
30
31 # Softdep
32 softdep uhci-hcd post: foo
33 softdep uhci-hcd pre: ehci-hcd foo
34 softdep uhci-hcd pre: ehci-hcd foo post: foo
35 "
36
37 test Modprobe.lns get conf =
38   { "#comment" = "Various aliases" }
39   { "alias" = "alias_to_foo"
40     { "modulename" = "foo" }
41   }
42   { "alias" = "alias_to_bar"
43     { "modulename" = "bar" }
44   }
45   { "alias" = "alias_to_export_dep-$BITNESS"
46     { "modulename" = "export_dep-$BITNESS" }
47   }
48   {  }
49   { "#comment" = "Various options, including options to aliases." }
50   { "options" = "alias_to_export_dep-$BITNESS"
51     { "I" }
52     { "am" }
53     { "alias" }
54     { "to" }
55     { "export_dep" }
56   }
57   { "options" = "alias_to_noexport_nodep-$BITNESS_with_tabbed_options"
58     { "index" = "0" }
59     { "id" = "\"Thinkpad\"" }
60     { "isapnp" = "0" }
61     { "port" = "0x530" }
62     { "cport" = "0x538" }
63     { "fm_port" = "0x388" }
64     { "mpu_port" = "-1" }
65     { "mpu_irq" = "-1" }
66     { "irq" = "9" }
67     { "dma1" = "1" }
68     { "dma2" = "3" }
69     { "enable" = "1" }
70     { "isapnp" = "0" }
71   }
72   {  }
73   { "#comment" = "Blacklist" }
74   { "blacklist" = "watchdog_drivers" }
75   {  }
76   { "#comment" = "Install commands" }
77   { "install" = "bar"
78     { "command" = "echo Installing bar" }
79   }
80   { "install" = "foo"
81     { "command" = "echo Installing foo" }
82   }
83   { "install" = "export_nodep-$BITNESS"
84     { "command" = "echo Installing export_nodep" }
85   }
86   {  }
87   { "#comment" = "Remove commands" }
88   { "remove" = "bar"
89     { "command" = "echo Removing bar" }
90   }
91   { "remove" = "foo"
92     { "command" = "echo Removing foo" }
93   }
94   { "remove" = "export_nodep-$BITNESS"
95     { "command" = "echo Removing export_nodep" }
96   }
97   {  }
98   { "#comment" = "Softdep" }
99   { "softdep" = "uhci-hcd"
100     { "post" = "foo" }
101   }
102   { "softdep" = "uhci-hcd"
103     { "pre" = "ehci-hcd" }
104     { "pre" = "foo" }
105   }
106   { "softdep" = "uhci-hcd"
107     { "pre" = "ehci-hcd" }
108     { "pre" = "foo" }
109     { "post" = "foo" }
110   }
111
112
113 (* eol-comments *)
114 test Modprobe.lns get "blacklist brokenmodule # never worked\n" =
115   { "blacklist" = "brokenmodule"
116     { "#comment" = "never worked" } }
117
118
119 (* Ticket 108 *)
120 let options_space_quote = "options name attr1=\"val\" attr2=\"val2 val3\"\n"
121
122 test Modprobe.entry get options_space_quote =
123   { "options" = "name"
124     { "attr1" = "\"val\"" }
125     { "attr2" = "\"val2 val3\"" }
126   }
127
128 (* Allow spaces around the '=', BZ 826752 *)
129 test Modprobe.entry get "options ipv6 disable = 1\n" =
130   { "options" = "ipv6"
131     { "disable" = "1" } }
132
133 (* Support multiline split commands, Ubuntu bug #1054306 *)
134 test Modprobe.lns get "# /etc/modprobe.d/iwlwifi.conf
135 # iwlwifi will dyamically load either iwldvm or iwlmvm depending on the
136 # microcode file installed on the system. When removing iwlwifi, first
137 # remove the iwl?vm module and then iwlwifi.
138 remove iwlwifi \
139 (/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \
140 && /sbin/modprobe -r mac80211\n" =
141   { "#comment" = "/etc/modprobe.d/iwlwifi.conf" }
142   { "#comment" = "iwlwifi will dyamically load either iwldvm or iwlmvm depending on the" }
143   { "#comment" = "microcode file installed on the system. When removing iwlwifi, first" }
144   { "#comment" = "remove the iwl?vm module and then iwlwifi." }
145   { "remove" = "iwlwifi"
146     { "command" = "(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \\\n&& /sbin/modprobe -r mac80211" }
147   }