|
| 1 | +From 2d8dcdfb3ac67389b61f46130c27815b47c0e7e7 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Brad House < [email protected]> |
| 3 | +Date: Sun, 6 Jul 2025 16:42:00 -0400 |
| 4 | +Subject: [PATCH] tests: test_iffeature_state crash fix |
| 5 | + |
| 6 | +As observed on Debian Trixie RC2, test_iffeature_state crashes due |
| 7 | +to an internal pointer being invalidated. This invalidation appears |
| 8 | +to be due to a call to lys_set_implemented() possibly causing a |
| 9 | +full recompile of the ctx. |
| 10 | + |
| 11 | +This simply reorders the caching of the path pointers so they are |
| 12 | +not invalidated when used. |
| 13 | + |
| 14 | +Signed-off-by: Brad House < [email protected]> |
| 15 | +--- |
| 16 | + tests/test_schema.py | 19 ++++++++----------- |
| 17 | + 1 file changed, 8 insertions(+), 11 deletions(-) |
| 18 | + |
| 19 | +diff --git a/tests/test_schema.py b/tests/test_schema.py |
| 20 | +index a310aad..4578f84 100644 |
| 21 | +--- a/tests/test_schema.py |
| 22 | ++++ b/tests/test_schema.py |
| 23 | +@@ -197,18 +197,8 @@ def feature_disable_only(feature): |
| 24 | + continue |
| 25 | + self.mod.feature_enable(f.name()) |
| 26 | + |
| 27 | +- leaf_simple = next(self.ctx.find_path("/yolo-system:conf/yolo-system:speed")) |
| 28 | +- |
| 29 | +- self.mod.feature_disable_all() |
| 30 | +- leaf_not = next(self.ctx.find_path("/yolo-system:conf/yolo-system:offline")) |
| 31 | +- self.mod.feature_enable_all() |
| 32 | +- |
| 33 | +- leaf_and = next(self.ctx.find_path("/yolo-system:conf/yolo-system:full")) |
| 34 | +- leaf_or = next( |
| 35 | +- self.ctx.find_path("/yolo-system:conf/yolo-system:isolation-level") |
| 36 | +- ) |
| 37 | +- |
| 38 | + # if-feature is just a feature |
| 39 | ++ leaf_simple = next(self.ctx.find_path("/yolo-system:conf/yolo-system:speed")) |
| 40 | + tree = next(leaf_simple.if_features()).tree() |
| 41 | + self.mod.feature_enable_all() |
| 42 | + self.assertEqual(tree.state(), True) |
| 43 | +@@ -216,6 +206,8 @@ def feature_disable_only(feature): |
| 44 | + self.assertEqual(tree.state(), False) |
| 45 | + |
| 46 | + # if-feature is "NOT networking" |
| 47 | ++ self.mod.feature_disable_all() |
| 48 | ++ leaf_not = next(self.ctx.find_path("/yolo-system:conf/yolo-system:offline")) |
| 49 | + tree = next(leaf_not.if_features()).tree() |
| 50 | + self.mod.feature_enable_all() |
| 51 | + self.assertEqual(tree.state(), False) |
| 52 | +@@ -223,6 +215,8 @@ def feature_disable_only(feature): |
| 53 | + self.assertEqual(tree.state(), True) |
| 54 | + |
| 55 | + # if-feature is "turbo-boost AND networking" |
| 56 | ++ self.mod.feature_enable_all() |
| 57 | ++ leaf_and = next(self.ctx.find_path("/yolo-system:conf/yolo-system:full")) |
| 58 | + tree = next(leaf_and.if_features()).tree() |
| 59 | + self.mod.feature_enable_all() |
| 60 | + self.assertEqual(tree.state(), True) |
| 61 | +@@ -234,6 +228,9 @@ def feature_disable_only(feature): |
| 62 | + self.assertEqual(tree.state(), False) |
| 63 | + |
| 64 | + # if-feature is "turbo-boost OR networking" |
| 65 | ++ leaf_or = next( |
| 66 | ++ self.ctx.find_path("/yolo-system:conf/yolo-system:isolation-level") |
| 67 | ++ ) |
| 68 | + tree = next(leaf_or.if_features()).tree() |
| 69 | + self.mod.feature_enable_all() |
| 70 | + self.assertEqual(tree.state(), True) |
0 commit comments