fusefs: fix intermittency in the interrupt tests
* In the fatal_signal test, wait for the daemon to receive FUSE_INTERRUPT before exiting. * Explicitly disable restarting syscalls after SIGUSR2. This fixes intermittency in the priority test. I don't know why, but sometimes that test's mkdir would be restarted, and sometimes it would return EINTR. ERESTART should be the default. * Remove a useless copy/pasted sleep in the priority test. Sponsored by: The FreeBSD Foundation
This commit is contained in:
parent
99cf7bff46
commit
a81776c270
@ -163,6 +163,7 @@ void SetUp() {
|
||||
mprot, mflags, -1, 0);
|
||||
ASSERT_NE(MAP_FAILED, blocked_semaphore) << strerror(errno);
|
||||
ASSERT_EQ(0, sem_init(blocked_semaphore, 1, 0)) << strerror(errno);
|
||||
ASSERT_EQ(0, siginterrupt(SIGUSR2, 1));
|
||||
|
||||
FuseTest::SetUp();
|
||||
}
|
||||
@ -357,7 +358,9 @@ TEST_F(Interrupt, fatal_signal)
|
||||
int status;
|
||||
pthread_t self;
|
||||
uint64_t mkdir_unique;
|
||||
sem_t sem;
|
||||
|
||||
ASSERT_EQ(0, sem_init(&sem, 0, 0)) << strerror(errno);
|
||||
self = pthread_self();
|
||||
|
||||
EXPECT_LOOKUP(1, RELDIRPATH0).WillOnce(Invoke(ReturnErrno(ENOENT)));
|
||||
@ -369,6 +372,7 @@ TEST_F(Interrupt, fatal_signal)
|
||||
}, Eq(true)),
|
||||
_)
|
||||
).WillOnce(Invoke([&](auto in __unused, auto &out __unused) {
|
||||
sem_post(&sem);
|
||||
/* Don't respond. The process should exit anyway */
|
||||
}));
|
||||
|
||||
@ -398,6 +402,9 @@ TEST_F(Interrupt, fatal_signal)
|
||||
return 1;
|
||||
});
|
||||
ASSERT_EQ(SIGUSR2, WTERMSIG(status));
|
||||
|
||||
EXPECT_EQ(0, sem_wait(&sem)) << strerror(errno);
|
||||
sem_destroy(&sem);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -715,9 +722,6 @@ TEST_F(Interrupt, priority)
|
||||
setup_interruptor(th0, true);
|
||||
ASSERT_EQ(0, mkdir(FULLDIRPATH1, MODE)) << strerror(errno);
|
||||
|
||||
/* Wait awhile to make sure the signal generates no FUSE_INTERRUPT */
|
||||
nap();
|
||||
|
||||
pthread_join(th0, NULL);
|
||||
sem_destroy(&sem1);
|
||||
sem_destroy(&sem0);
|
||||
|
Loading…
Reference in New Issue
Block a user