File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 44from zenlib .logging import loggify
55
66
7+ def bad_function (self ):
8+ """A function that should not be called."""
9+ return "exit 1"
10+
11+
712@loggify
813class TestUGRD (TestCase ):
914 def test_fullauto (self ):
@@ -16,6 +21,20 @@ def test_bad_config(self):
1621 with self .assertRaises (ValueError ):
1722 InitramfsGenerator (logger = self .logger , config = "tests/bad_config.toml" )
1823
24+ def test_bad_mask (self ):
25+ """Test that masking a critical function raises an error."""
26+ generator = InitramfsGenerator (logger = self .logger , config = "tests/fullauto.toml" )
27+ generator ["masks" ] = {"init_final" : "do_switch_root" }
28+ with self .assertRaises (RuntimeError ):
29+ generator .build ()
30+
31+ def test_good_mask (self ):
32+ """ Tests that masking a broken function resolves a boot issue. """
33+ generator = InitramfsGenerator (logger = self .logger , config = "tests/fullauto.toml" )
34+ generator ["imports" ]["init_main" ] += bad_function
35+ generator ["masks" ] = {"init_main" : "bad_function" }
36+ generator .build ()
37+
1938 def test_no_root (self ):
2039 """Test without a rootfs which can be found, should cause the initramfs to restart."""
2140 generator = InitramfsGenerator (
You can’t perform that action at this time.
0 commit comments