Commit 2e5ab151 authored by Jérome Perrin's avatar Jérome Perrin

test: remove TestWaitForFilesInotifyError

This "simple" approach of using LD_PRELOAD to inject errors when using
inotify no longer works on glibc 2.34 and it's now much more complicated,
as we can see in discussions from https://stackoverflow.com/questions/15599026/how-can-i-intercept-dlsym-calls-using-ld-preload
or code from https://gitlab.com/torkel104/libstrangle/-/commit/720f0ba2ce4423ce5f3e7ebe135e126007365bac

This test was for reproduction of a very specific problem that does not
happen so much on modern linux which has a much higher limit of inotify
watches, the easiest is to remove this test now.
parent c961ba45
Pipeline #29695 failed with stage
...@@ -221,49 +221,6 @@ class TestWaitForFiles(WrapperTestCase): ...@@ -221,49 +221,6 @@ class TestWaitForFiles(WrapperTestCase):
self.fail('process did not start after file was created') self.fail('process did not start after file was created')
@unittest.skipUnless(sys.platform.startswith("linux"), "Inotify is linux only")
class TestWaitForFilesInotifyError(TestWaitForFiles):
def setUp(self):
super(TestWaitForFilesInotifyError, self).setUp()
# use LD_PRELOAD to inject errors into inotify_add_watch calls
inotify_mock_c = self.getTempPath('inotify_mock.c')
inotify_mock_o = self.getTempPath('inotify_mock.o')
inotify_mock_so = self.getTempPath('inotify_mock.so')
with open(inotify_mock_c, 'w') as f:
f.write('''
#include <sys/inotify.h>
#include <string.h>
#include <errno.h>
int inotify_add_watch(int fd, const char *pathname, uint32_t mask) {
errno = ENOSPC;
return -1;
}
/* This is a bit tricky because inotify_simple calls
inotify_add_watch with ctypes.CDLL("libc.so"), which uses
dlopen("libc.so") and dlsym("inotify_add_watch"), so we first
override dlsym to return our own inotify_add_watch.
https://github.com/chrisjbillington/inotify_simple/blob/55737898/inotify_simple.py#L110
*/
extern void *__libc_dlsym (void *, const char *);
void *dlsym(void *handle, const char *symbol) {
if (strcmp(symbol, "inotify_add_watch") == 0) {
return (void *)inotify_add_watch;
}
return (void *)__libc_dlsym(handle, symbol);
}
''')
subprocess.check_call(['gcc', '-c', '-fPIC', '-o', inotify_mock_o, inotify_mock_c])
subprocess.check_call(['gcc', '-shared', '-o', inotify_mock_so, inotify_mock_o])
self.env = dict(
os.environ,
PYTHONUNBUFFERED='1',
LD_PRELOAD=inotify_mock_so)
expected_output = 'Error using inotify, falling back to polling\ndone\n'
class TestPrivateTmpFS(WrapperTestCase): class TestPrivateTmpFS(WrapperTestCase):
def getOptions(self): def getOptions(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment