Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
tests: test_iffeature_state crash fix
As observed on Debian Trixie RC2, test_iffeature_state crashes due
to an internal pointer being invalidated.  This invalidation appears
to be due to a call to lys_set_implemented() possibly causing a
full recompile of the ctx.

This simply reorders the caching of the path pointers so they are
not invalidated when used.

Signed-off-by: Brad House <brad@brad-house.com>
  • Loading branch information
bradh352 committed Jul 6, 2025
commit 2d8dcdfb3ac67389b61f46130c27815b47c0e7e7
19 changes: 8 additions & 11 deletions tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,32 +197,26 @@ def feature_disable_only(feature):
continue
self.mod.feature_enable(f.name())

leaf_simple = next(self.ctx.find_path("/yolo-system:conf/yolo-system:speed"))

self.mod.feature_disable_all()
leaf_not = next(self.ctx.find_path("/yolo-system:conf/yolo-system:offline"))
self.mod.feature_enable_all()

leaf_and = next(self.ctx.find_path("/yolo-system:conf/yolo-system:full"))
leaf_or = next(
self.ctx.find_path("/yolo-system:conf/yolo-system:isolation-level")
)

# if-feature is just a feature
leaf_simple = next(self.ctx.find_path("/yolo-system:conf/yolo-system:speed"))
tree = next(leaf_simple.if_features()).tree()
self.mod.feature_enable_all()
self.assertEqual(tree.state(), True)
self.mod.feature_disable_all()
self.assertEqual(tree.state(), False)

# if-feature is "NOT networking"
self.mod.feature_disable_all()
leaf_not = next(self.ctx.find_path("/yolo-system:conf/yolo-system:offline"))
tree = next(leaf_not.if_features()).tree()
self.mod.feature_enable_all()
self.assertEqual(tree.state(), False)
self.mod.feature_disable_all()
self.assertEqual(tree.state(), True)

# if-feature is "turbo-boost AND networking"
self.mod.feature_enable_all()
leaf_and = next(self.ctx.find_path("/yolo-system:conf/yolo-system:full"))
tree = next(leaf_and.if_features()).tree()
self.mod.feature_enable_all()
self.assertEqual(tree.state(), True)
Expand All @@ -234,6 +228,9 @@ def feature_disable_only(feature):
self.assertEqual(tree.state(), False)

# if-feature is "turbo-boost OR networking"
leaf_or = next(
self.ctx.find_path("/yolo-system:conf/yolo-system:isolation-level")
)
tree = next(leaf_or.if_features()).tree()
self.mod.feature_enable_all()
self.assertEqual(tree.state(), True)
Expand Down