mirror of
https://github.com/troglobit/libite.git
synced 2026-11-14 19:03:05 +00:00
Update unit test for pidfile()
Add ocular verification step for mtime update when pidfile() is called more than once. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
148027674a
commit
975df87d6b
1 file changed
+9
@@ -142,6 +142,8 @@ static void sigalrm_handler(int signo)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
char cmd[80];
|
||||||
|
|
||||||
snprintf(PIDFILE, sizeof(PIDFILE), "%s%s.pid", _PATH_VARRUN, __progname);
|
snprintf(PIDFILE, sizeof(PIDFILE), "%s%s.pid", _PATH_VARRUN, __progname);
|
||||||
|
|
||||||
signal(SIGTERM, sigterm_handler);
|
signal(SIGTERM, sigterm_handler);
|
||||||
@@ -157,6 +159,13 @@ int main(void)
|
|||||||
printf("Reading pid file, should be %d ...\n", getpid());
|
printf("Reading pid file, should be %d ...\n", getpid());
|
||||||
printf("=> %d\n", pidfile_read(PIDFILE));
|
printf("=> %d\n", pidfile_read(PIDFILE));
|
||||||
|
|
||||||
|
/* Occular verification that calling pidfile() again updates mtime */
|
||||||
|
snprintf(cmd, sizeof(cmd), "ls -l --full-time %s", PIDFILE);
|
||||||
|
system(cmd);
|
||||||
|
printf("Before ^^ pidfile() vv after ...\n");
|
||||||
|
pidfile(NULL);
|
||||||
|
system(cmd);
|
||||||
|
|
||||||
printf("Signalling ourselves ...\n");
|
printf("Signalling ourselves ...\n");
|
||||||
|
|
||||||
return pidfile_signal(PIDFILE, SIGTERM);
|
return pidfile_signal(PIDFILE, SIGTERM);
|
||||||
|
|||||||
Reference in new issue
Block a user