Skip to content

main: add configurable fault injection interval#98

Open
nhitar wants to merge 1 commit into
linux-test-project:masterfrom
nhitar:fault_injection_interval
Open

main: add configurable fault injection interval#98
nhitar wants to merge 1 commit into
linux-test-project:masterfrom
nhitar:fault_injection_interval

Conversation

@nhitar
Copy link
Copy Markdown

@nhitar nhitar commented May 2, 2026

Adds a parameter to configure the fault injection interval, which is locked at default 100.

Can be used to make the fault injection probability checks more frequent. This would lead to a more thorough test of system stability.

@nhitar
Copy link
Copy Markdown
Author

nhitar commented May 10, 2026

@acerv hello, can you review these changes please?

@acerv
Copy link
Copy Markdown
Collaborator

acerv commented May 11, 2026

Hi, what's the point of having a probability bigger than 100 if the kernel threats any value above 100 as 100 ?

@nhitar
Copy link
Copy Markdown
Author

nhitar commented May 11, 2026

Can be used to make the fault injection probability checks more frequent.

Hi, what's the point of having a probability bigger than 100 if the kernel threats any value above 100 as 100 ?

The idea is to modify the interval between probability checks, rather than the probability itself. I haven't really changed the probability in code.

Right now 100% probability of failure grants that every 100th call will fail (interval=100). So, with different intervals, it is possible, for example, to have fails (or probability checks if below 100%) every 10th call (interval=10). Or, with an interval set to 1 and a probability to 10%, each call may fail with that probability.

docs:

/sys/kernel/debug/fail*/interval:

specifies the interval between failures, for calls to should_fail() that pass all the other tests.

Note that if you enable this, by setting interval>1, you will probably want to set probability=100.

@acerv
Copy link
Copy Markdown
Collaborator

acerv commented May 12, 2026

Of course, I was switching between reviews and messed up this one. Now it's clear thanks

Comment thread libkirk/main.py Outdated
except TypeError as err:
raise argparse.ArgumentTypeError("Invalid number") from err

return 100 if ret < 0 else ret
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit counterintuitive. If the value is below 1, we should default it to 1.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to return max(1, ret)

Comment thread libkirk/tests/test_main.py Outdated
Comment thread libkirk/tests/test_main.py Outdated
assert libkirk.main._finjection_config("-5") == 0

def test_finterval_config_empty(self):
assert libkirk.main._finterval_config("") == 100
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add a test for real values. Maybe we can create a parametric test passing them as following:

    @pytest.mark.parametrize("val", ("0", "20", "100", "2000"))
    def test_finterval_config(self, val):
        assert libkirk.main._finterval_config(val) == int(val)

Comment thread libkirk/main.py Outdated
exec_opts.add_argument(
"--fault-interval",
type=_finterval_config,
default=100,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default interval value is 1, according to documentation. This has to be changed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but thought of keeping the original value. Changed it now.

Comment thread libkirk/main.py Outdated
Comment thread libkirk/main.py Outdated
Comment thread libkirk/session.py Outdated
Comment thread libkirk/session.py Outdated
Comment thread libkirk/sut.py Outdated
Comment thread libkirk/tests/test_main.py Outdated
@nhitar nhitar force-pushed the fault_injection_interval branch from ad4b111 to 6c3b3bd Compare May 12, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants