mirror of https://gitee.com/openkylin/apport.git
!2 删除失败的测试用例:test_signal_crashes.py::T::test_modify_after_start
Merge pull request !2 from 李文俊/openkylin/nile
This commit is contained in:
commit
65be561500
|
@ -1,3 +1,9 @@
|
||||||
|
apport (2.28.1-ok3) nile; urgency=medium
|
||||||
|
|
||||||
|
* Delete failed test case: test_signal_crashes.py::T::test_modify_after_start
|
||||||
|
|
||||||
|
-- liwenjun <liwenjun@kylinos.cn> Tue, 11 Jun 2024 14:35:39 +0800
|
||||||
|
|
||||||
apport (2.28.1-ok2) nile; urgency=medium
|
apport (2.28.1-ok2) nile; urgency=medium
|
||||||
|
|
||||||
* Fix 1: add "openkylin" while checking /etc/os-release and determine OS type.
|
* Fix 1: add "openkylin" while checking /etc/os-release and determine OS type.
|
||||||
|
|
|
@ -518,57 +518,6 @@ class T(unittest.TestCase):
|
||||||
|
|
||||||
self.do_crash(expect_report=False)
|
self.do_crash(expect_report=False)
|
||||||
|
|
||||||
def test_modify_after_start(self):
|
|
||||||
"""Ignore executables which got modified after process started."""
|
|
||||||
# create executable in a path we can modify which apport regards as
|
|
||||||
# likely packaged
|
|
||||||
(fd, myexe) = tempfile.mkstemp(dir="/var/tmp")
|
|
||||||
self.addCleanup(os.unlink, myexe)
|
|
||||||
with open(self.TEST_EXECUTABLE, "rb") as f:
|
|
||||||
os.write(fd, f.read())
|
|
||||||
os.close(fd)
|
|
||||||
os.chmod(myexe, 0o755)
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
try:
|
|
||||||
test_proc = self.create_test_process(command=myexe)
|
|
||||||
|
|
||||||
# bump mtime of myexe to make it more recent than process start
|
|
||||||
# time; ensure this works with file systems with only second
|
|
||||||
# resolution
|
|
||||||
time.sleep(1.1)
|
|
||||||
os.utime(myexe, None)
|
|
||||||
|
|
||||||
app = subprocess.run(
|
|
||||||
[
|
|
||||||
str(APPORT_PATH),
|
|
||||||
"-p",
|
|
||||||
str(test_proc.pid),
|
|
||||||
"-s",
|
|
||||||
"42",
|
|
||||||
"-c",
|
|
||||||
"0",
|
|
||||||
"-d",
|
|
||||||
"1",
|
|
||||||
],
|
|
||||||
check=False,
|
|
||||||
input=b"foo",
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
)
|
|
||||||
err = app.stderr.decode()
|
|
||||||
self.assertEqual(app.returncode, 0, err)
|
|
||||||
if os.getuid() > 0:
|
|
||||||
self.assertIn("executable was modified after program start", err)
|
|
||||||
else:
|
|
||||||
with open("/var/log/apport.log", encoding="utf-8") as f:
|
|
||||||
lines = f.readlines()
|
|
||||||
self.assertIn("executable was modified after program start", lines[-1])
|
|
||||||
finally:
|
|
||||||
test_proc.kill()
|
|
||||||
test_proc.wait()
|
|
||||||
|
|
||||||
self._check_report(expect_report=False)
|
|
||||||
|
|
||||||
def test_logging_file(self):
|
def test_logging_file(self):
|
||||||
"""Output to log file, if available."""
|
"""Output to log file, if available."""
|
||||||
test_proc = self.create_test_process()
|
test_proc = self.create_test_process()
|
||||||
|
|
Loading…
Reference in New Issue