Add test for feat_req__lifecycle__shutdown_signal - #414
Add test for feat_req__lifecycle__shutdown_signal#414TimoSteuerwaldETAS wants to merge 9 commits into
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
| static constexpr char suffix[] = " in signal handler\n"; | ||
| static_cast<void>(write(STDERR_FILENO, prefix, sizeof(prefix) - 1)); | ||
| static_cast<void>(write(STDERR_FILENO, path.data(), path.size())); | ||
| static_cast<void>(write(STDERR_FILENO, suffix, sizeof(suffix) - 1)); |
There was a problem hiding this comment.
I think if we just exit it would fail the test and in the python you don't need to assert for this message. If we are in a case that open failed it's possible the write could also be flaky?
There was a problem hiding this comment.
See #414 (comment), it seems like exit is not enough.
However it is indeed possible that the write could also fail.
Perhaps, the python code should check whether the process is still running, rather than trying to have the process itself report whether it was killed.
There was a problem hiding this comment.
In Python code it is checked if file system error happened, which is a rare bad case. Everything else is verified in control_daemon.cpp.
If I understand you correctly you suggest to get rid of all the files and let Python check if the process is still there. Still we need to verify that sigterm has been received, so partly we would still stick to writing files. So for sigterm we would use file approach, but for sigkill Python.
This is why I would like to stick to the current solution. I fear searching for child process PID in Python code is a more complex solution and it would move a relevant part of the test to the python code, which would make it special compared to most of the other tests.
There was a problem hiding this comment.
What about, on SIGTERM, the process calls getpid and writes it to some file. After SIGKILL should have been sent, the test reads the file. If the file does not exist, the test fails, indicating that SIGTERM was not sent. Otherwise, it has an easy way to find the child process and verify that it is gone.
getpid, open and write are all signal safe. The PID can just be written as raw bytes, no need to encode it to a string.
it would move a relevant part of the test to the python code, which would make a difference compared to most of the other tests
It could also be done in control_daemon_mock.cpp instead of Python
Maybe it is too unlikely to actually matter. But I think it would be nice if the test cannot pass as the result of an error.
511086b to
99a6ec0
Compare
Part of #317
Test which verifies that the Launch Manager shuts a process down by sending a SIGTERM and, if the process does not terminate itself in time, escalates to a SIGKILL.