Add tests for tmpfs usage
[pykickstart.git] / tests / command_usage.py
blob6c1191041423a495a32e872d61cc52688acdb707
1 from tests.baseclass import CommandSequenceTest
4 class AutopartUsage_TestCase(CommandSequenceTest):
5 """Test autopart command usage
7 Autopart can't be used together with any of the part/partition, raid,
8 logvol and volgroup command in the same kickstart file.
9 This test case is used to check if parsing of such kickstarts correctly
10 raises a parsing error.
11 """
13 def runTest(self):
14 # first just parse some correct sequences to
15 # check if the parsing itself works correctly
16 correct_command_sequences = [
17 "part / --size=2048",
18 "partition / --size=2048",
19 "autopart",
20 "raid / --level=1 --device=md0 raid.01",
21 "logvol / --vgname=foo --size=2000 --name=bar",
22 "volgroup foo pv.01"
24 for sequence in correct_command_sequences:
25 self.assert_parse(sequence)
27 # then check various incorrect sequences
28 incorrect_command_sequences = [
29 "part / --size=2048\nautopart",
30 "autopart\npart / --size=2048",
31 "partition / --size=2048\nautopart",
32 "autopart\npartition / --size=2048",
33 "raid / --level=1 --device=md0 raid.01\nautopart",
34 "autopart\nraid / --level=1 --device=md0 raid.01",
35 "logvol / --vgname=foo --size=2000 --name=bar\nautopart",
36 "autopart\nlogvol / --vgname=foo --size=2000 --name=bar",
37 "volgroup foo pv.01\nautopart",
38 "autopart\nvolgroup foo pv.01"
41 for sequence in incorrect_command_sequences:
42 self.assert_parse_error(sequence)
44 # also test all the commands being used at once
46 long_incorrect_sequence = """
47 part / --size=2048
48 partition /opt --size=2048
49 autopart
50 raid / --level=1 --device=md0 raid.01
51 logvol / --vgname=foo --size=2000 --name=bar
52 volgroup foo pv.01
53 """
54 self.assert_parse_error(long_incorrect_sequence)
57 class TmpfsUsage_TestCase(CommandSequenceTest):
58 """Test tmpfs usage with the partition command"""
60 def runTest(self):
61 # the tmpfs filesystem supports the size and fsopt options
62 self.assert_parse('part /foo --size=100 --fstype=tmpfs --fsoptions="noexec"')
63 self.assert_parse('part /ham --fstype=tmpfs --fsoptions="size=250%"')
64 self.assert_parse('part /tmp --size=20000 --fstype=tmpfs')
66 # the tmpfs filesystem dos not support the --grow and --maxsize
67 # options
68 self.assert_parse_error("part --fstype=tmpfs /tmp --grow")
69 self.assert_parse_error("part --fstype=tmpfs /tmp --grow --maxsize=1000")
70 self.assert_parse_error("part --fstype=tmpfs /tmp --maxsize=1000")