48
48
#include <error.h> /* error() */
49
49
#include <sysexits.h> /* EX_USAGE, EX_OSERR, EX_OSFILE */
50
50
#include <errno.h> /* errno, error_t, EACCES,
51
ENAMETOOLONG, ENOENT, EEXIST,
52
ECHILD, EPERM, ENOMEM, EAGAIN,
53
EINTR, ENOBUFS, EADDRINUSE,
51
ENAMETOOLONG, ENOENT, ENOTDIR,
52
EEXIST, ECHILD, EPERM, ENOMEM,
53
EAGAIN, EINTR, ENOBUFS, EADDRINUSE,
54
54
ECONNREFUSED, ECONNRESET,
55
55
ETOOMANYREFS, EMSGSIZE, EBADF,
83
83
#include <sys/mman.h> /* munlock(), mlock() */
84
84
#include <fcntl.h> /* O_CLOEXEC, O_NONBLOCK, fcntl(),
85
85
F_GETFD, F_GETFL, FD_CLOEXEC,
86
open(), O_WRONLY, O_RDONLY */
86
open(), O_WRONLY, O_NOCTTY,
87
O_RDONLY, O_NOFOLLOW */
87
88
#include <sys/wait.h> /* waitpid(), WNOHANG, WIFEXITED(),
89
90
#include <limits.h> /* PIPE_BUF, NAME_MAX, INT_MAX */
90
91
#include <sys/inotify.h> /* inotify_init1(), IN_NONBLOCK,
91
92
IN_CLOEXEC, inotify_add_watch(),
92
93
IN_CLOSE_WRITE, IN_MOVED_TO,
93
IN_DELETE, struct inotify_event */
94
IN_MOVED_FROM, IN_DELETE,
95
IN_EXCL_UNLINK, IN_ONLYDIR,
96
struct inotify_event */
94
97
#include <fnmatch.h> /* fnmatch(), FNM_FILE_NAME */
95
98
#include <stdio.h> /* asprintf(), FILE, fopen(),
96
99
getline(), sscanf(), feof(),
1071
1076
/* "sufficient to read at least one event." - inotify(7) */
1072
1077
const size_t ievent_size = (sizeof(struct inotify_event)
1073
1078
+ NAME_MAX + 1);
1074
char ievent_buffer[sizeof(struct inotify_event) + NAME_MAX + 1];
1075
struct inotify_event *ievent = ((struct inotify_event *)
1080
struct inotify_event event;
1081
char name_buffer[NAME_MAX + 1];
1083
struct inotify_event *const ievent = &ievent_buffer.event;
1078
1085
const ssize_t read_length = read(fd, ievent, ievent_size);
1079
1086
if(read_length == 0){ /* EOF */
3450
3459
g_assert_cmpuint((unsigned int)queue->length, ==, 0);
3462
static void test_add_inotify_dir_watch_nondir(__attribute__((unused))
3463
test_fixture *fixture,
3464
__attribute__((unused))
3467
__attribute__((cleanup(cleanup_close)))
3468
const int epoll_fd = epoll_create1(EPOLL_CLOEXEC);
3469
g_assert_cmpint(epoll_fd, >=, 0);
3470
__attribute__((cleanup(cleanup_queue)))
3471
task_queue *queue = create_queue();
3472
g_assert_nonnull(queue);
3473
__attribute__((cleanup(string_set_clear)))
3474
string_set cancelled_filenames = {};
3475
const mono_microsecs current_time = 0;
3477
bool quit_now = false;
3478
buffer password = {};
3479
bool mandos_client_exited = false;
3480
bool password_is_read = false;
3482
const char not_a_directory[] = "/dev/tty";
3484
FILE *real_stderr = stderr;
3485
FILE *devnull = fopen("/dev/null", "we");
3486
g_assert_nonnull(devnull);
3488
g_assert_false(add_inotify_dir_watch(queue, epoll_fd, &quit_now,
3489
&password, not_a_directory,
3490
&cancelled_filenames,
3492
&mandos_client_exited,
3493
&password_is_read));
3494
stderr = real_stderr;
3495
g_assert_cmpint(fclose(devnull), ==, 0);
3497
g_assert_cmpuint((unsigned int)queue->length, ==, 0);
3453
3500
static void test_add_inotify_dir_watch_EAGAIN(__attribute__((unused))
3454
3501
test_fixture *fixture,
3455
3502
__attribute__((unused))
3720
void test_add_inotify_dir_watch_IN_MOVED_FROM(__attribute__((unused))
3721
test_fixture *fixture,
3722
__attribute__((unused))
3725
__attribute__((cleanup(cleanup_close)))
3726
const int epoll_fd = epoll_create1(EPOLL_CLOEXEC);
3727
g_assert_cmpint(epoll_fd, >=, 0);
3728
__attribute__((cleanup(cleanup_queue)))
3729
task_queue *queue = create_queue();
3730
g_assert_nonnull(queue);
3731
__attribute__((cleanup(string_set_clear)))
3732
string_set cancelled_filenames = {};
3733
const mono_microsecs current_time = 0;
3735
bool quit_now = false;
3736
buffer password = {};
3737
bool mandos_client_exited = false;
3738
bool password_is_read = false;
3740
__attribute__((cleanup(cleanup_string)))
3741
char *tempdir = make_temporary_directory();
3742
g_assert_nonnull(tempdir);
3744
__attribute__((cleanup(cleanup_string)))
3745
char *tempfilename = make_temporary_file_in_directory(tempdir);
3746
g_assert_nonnull(tempfilename);
3748
__attribute__((cleanup(cleanup_string)))
3749
char *targetdir = make_temporary_directory();
3750
g_assert_nonnull(targetdir);
3752
__attribute__((cleanup(cleanup_string)))
3753
char *targetfilename = NULL;
3754
g_assert_cmpint(asprintf(&targetfilename, "%s/%s", targetdir,
3755
basename(tempfilename)), >, 0);
3756
g_assert_nonnull(targetfilename);
3758
g_assert_true(add_inotify_dir_watch(queue, epoll_fd, &quit_now,
3760
&cancelled_filenames,
3762
&mandos_client_exited,
3763
&password_is_read));
3765
g_assert_cmpint(rename(tempfilename, targetfilename), ==, 0);
3767
const task_context *const added_read_task
3768
= find_matching_task(queue,
3769
(task_context){ .func=read_inotify_event });
3770
g_assert_nonnull(added_read_task);
3772
/* "sufficient to read at least one event." - inotify(7) */
3773
const size_t ievent_size = (sizeof(struct inotify_event)
3775
struct inotify_event *ievent = malloc(ievent_size);
3776
g_assert_nonnull(ievent);
3778
ssize_t read_size = read(added_read_task->fd, ievent, ievent_size);
3780
g_assert_cmpint((int)read_size, >, 0);
3781
g_assert_true(ievent->mask & IN_MOVED_FROM);
3782
g_assert_cmpstr(ievent->name, ==, basename(tempfilename));
3786
g_assert_cmpint(unlink(targetfilename), ==, 0);
3787
g_assert_cmpint(rmdir(targetdir), ==, 0);
3788
g_assert_cmpint(rmdir(tempdir), ==, 0);
3673
3792
void test_add_inotify_dir_watch_IN_DELETE(__attribute__((unused))
3674
3793
test_fixture *fixture,
3675
3794
__attribute__((unused))
3733
3852
g_assert_cmpint(rmdir(tempdir), ==, 0);
3856
void test_add_inotify_dir_watch_IN_EXCL_UNLINK(__attribute__((unused))
3857
test_fixture *fixture,
3858
__attribute__((unused))
3861
__attribute__((cleanup(cleanup_close)))
3862
const int epoll_fd = epoll_create1(EPOLL_CLOEXEC);
3863
g_assert_cmpint(epoll_fd, >=, 0);
3864
__attribute__((cleanup(cleanup_queue)))
3865
task_queue *queue = create_queue();
3866
g_assert_nonnull(queue);
3867
__attribute__((cleanup(string_set_clear)))
3868
string_set cancelled_filenames = {};
3869
const mono_microsecs current_time = 0;
3871
bool quit_now = false;
3872
buffer password = {};
3873
bool mandos_client_exited = false;
3874
bool password_is_read = false;
3876
__attribute__((cleanup(cleanup_string)))
3877
char *tempdir = make_temporary_directory();
3878
g_assert_nonnull(tempdir);
3880
__attribute__((cleanup(cleanup_string)))
3881
char *tempfile = make_temporary_file_in_directory(tempdir);
3882
g_assert_nonnull(tempfile);
3883
int tempfile_fd = open(tempfile, O_WRONLY | O_CLOEXEC | O_NOCTTY
3885
g_assert_cmpint(tempfile_fd, >, 2);
3887
g_assert_true(add_inotify_dir_watch(queue, epoll_fd, &quit_now,
3889
&cancelled_filenames,
3891
&mandos_client_exited,
3892
&password_is_read));
3893
g_assert_cmpint(unlink(tempfile), ==, 0);
3895
g_assert_cmpuint((unsigned int)queue->length, >, 0);
3897
const task_context *const added_read_task
3898
= find_matching_task(queue,
3899
(task_context){ .func=read_inotify_event });
3900
g_assert_nonnull(added_read_task);
3902
g_assert_cmpint(added_read_task->fd, >, 2);
3903
g_assert_true(fd_has_cloexec_and_nonblock(added_read_task->fd));
3905
/* "sufficient to read at least one event." - inotify(7) */
3906
const size_t ievent_size = (sizeof(struct inotify_event)
3908
struct inotify_event *ievent = malloc(ievent_size);
3909
g_assert_nonnull(ievent);
3911
ssize_t read_size = 0;
3912
read_size = read(added_read_task->fd, ievent, ievent_size);
3914
g_assert_cmpint((int)read_size, >, 0);
3915
g_assert_true(ievent->mask & IN_DELETE);
3916
g_assert_cmpstr(ievent->name, ==, basename(tempfile));
3918
g_assert_cmpint(close(tempfile_fd), ==, 0);
3920
/* IN_EXCL_UNLINK should make the closing of the previously unlinked
3921
file not appear as an ievent, so we should not see it now. */
3922
read_size = read(added_read_task->fd, ievent, ievent_size);
3923
g_assert_cmpint((int)read_size, ==, -1);
3924
g_assert_true(errno == EAGAIN);
3928
g_assert_cmpint(rmdir(tempdir), ==, 0);
3736
3931
static void test_read_inotify_event_readerror(__attribute__((unused))
3737
3932
test_fixture *fixture,
3738
3933
__attribute__((unused))
3929
4125
const size_t ievent_max_size = (sizeof(struct inotify_event)
3930
4126
+ NAME_MAX + 1);
3931
4127
g_assert_cmpint(ievent_max_size, <=, PIPE_BUF);
3932
char ievent_buffer[sizeof(struct inotify_event) + NAME_MAX + 1];
3933
struct inotify_event *ievent = ((struct inotify_event *)
4129
struct inotify_event event;
4130
char name_buffer[NAME_MAX + 1];
4132
struct inotify_event *const ievent = &ievent_buffer.event;
3936
4134
const char dummy_file_name[] = "ask.dummy_file_name";
3937
4135
ievent->mask = IN_CLOSE_WRITE;
3939
4137
memcpy(ievent->name, dummy_file_name, sizeof(dummy_file_name));
3940
4138
const size_t ievent_size = (sizeof(struct inotify_event)
3941
4139
+ sizeof(dummy_file_name));
3942
g_assert_cmpint(write(pipefds[1], ievent_buffer, ievent_size),
4140
g_assert_cmpint(write(pipefds[1], (char *)ievent, ievent_size),
3943
4141
==, ievent_size);
3944
4142
g_assert_cmpint(close(pipefds[1]), ==, 0);
4022
4220
const size_t ievent_max_size = (sizeof(struct inotify_event)
4023
4221
+ NAME_MAX + 1);
4024
4222
g_assert_cmpint(ievent_max_size, <=, PIPE_BUF);
4025
char ievent_buffer[sizeof(struct inotify_event) + NAME_MAX + 1];
4026
struct inotify_event *ievent = ((struct inotify_event *)
4224
struct inotify_event event;
4225
char name_buffer[NAME_MAX + 1];
4227
struct inotify_event *const ievent = &ievent_buffer.event;
4029
4229
const char dummy_file_name[] = "ask.dummy_file_name";
4030
4230
ievent->mask = IN_MOVED_TO;
4032
4232
memcpy(ievent->name, dummy_file_name, sizeof(dummy_file_name));
4033
4233
const size_t ievent_size = (sizeof(struct inotify_event)
4034
4234
+ sizeof(dummy_file_name));
4035
g_assert_cmpint(write(pipefds[1], ievent_buffer, ievent_size),
4235
g_assert_cmpint(write(pipefds[1], (char *)ievent, ievent_size),
4036
4236
==, ievent_size);
4037
4237
g_assert_cmpint(close(pipefds[1]), ==, 0);
4302
void test_read_inotify_event_IN_MOVED_FROM(__attribute__((unused))
4303
test_fixture *fixture,
4304
__attribute__((unused))
4305
gconstpointer user_data){
4306
__attribute__((cleanup(cleanup_close)))
4307
const int epoll_fd = epoll_create1(EPOLL_CLOEXEC);
4308
g_assert_cmpint(epoll_fd, >=, 0);
4309
__attribute__((cleanup(string_set_clear)))
4310
string_set cancelled_filenames = {};
4311
const mono_microsecs current_time = 0;
4314
g_assert_cmpint(pipe2(pipefds, O_CLOEXEC | O_NONBLOCK), ==, 0);
4316
/* "sufficient to read at least one event." - inotify(7) */
4317
const size_t ievent_max_size = (sizeof(struct inotify_event)
4319
g_assert_cmpint(ievent_max_size, <=, PIPE_BUF);
4321
struct inotify_event event;
4322
char name_buffer[NAME_MAX + 1];
4324
struct inotify_event *const ievent = &ievent_buffer.event;
4326
const char dummy_file_name[] = "ask.dummy_file_name";
4327
ievent->mask = IN_MOVED_FROM;
4328
ievent->len = sizeof(dummy_file_name);
4329
memcpy(ievent->name, dummy_file_name, sizeof(dummy_file_name));
4330
const size_t ievent_size = (sizeof(struct inotify_event)
4331
+ sizeof(dummy_file_name));
4332
g_assert_cmpint(write(pipefds[1], (char *)ievent, ievent_size),
4334
g_assert_cmpint(close(pipefds[1]), ==, 0);
4336
bool quit_now = false;
4337
buffer password = {};
4338
bool mandos_client_exited = false;
4339
bool password_is_read = false;
4340
__attribute__((cleanup(cleanup_queue)))
4341
task_queue *queue = create_queue();
4342
g_assert_nonnull(queue);
4344
task_context task = {
4345
.func=read_inotify_event,
4348
.quit_now=&quit_now,
4349
.password=&password,
4350
.filename=strdup("/nonexistent"),
4351
.cancelled_filenames=&cancelled_filenames,
4352
.current_time=¤t_time,
4353
.mandos_client_exited=&mandos_client_exited,
4354
.password_is_read=&password_is_read,
4356
task.func(task, queue);
4357
g_assert_false(quit_now);
4358
g_assert_true(queue->next_run == 0);
4359
g_assert_cmpuint((unsigned int)queue->length, ==, 1);
4361
g_assert_nonnull(find_matching_task(queue, (task_context){
4362
.func=read_inotify_event,
4365
.quit_now=&quit_now,
4366
.password=&password,
4367
.filename=task.filename,
4368
.cancelled_filenames=&cancelled_filenames,
4369
.current_time=¤t_time,
4370
.mandos_client_exited=&mandos_client_exited,
4371
.password_is_read=&password_is_read,
4374
g_assert_true(epoll_set_contains(epoll_fd, pipefds[0],
4375
EPOLLIN | EPOLLRDHUP));
4377
__attribute__((cleanup(cleanup_string)))
4378
char *filename = NULL;
4379
g_assert_cmpint(asprintf(&filename, "%s/%s", task.filename,
4380
dummy_file_name), >, 0);
4381
g_assert_nonnull(filename);
4382
g_assert_true(string_set_contains(*task.cancelled_filenames,
4101
4386
static void test_read_inotify_event_IN_DELETE(__attribute__((unused))
4102
4387
test_fixture *fixture,
4103
4388
__attribute__((unused))
4117
4402
const size_t ievent_max_size = (sizeof(struct inotify_event)
4118
4403
+ NAME_MAX + 1);
4119
4404
g_assert_cmpint(ievent_max_size, <=, PIPE_BUF);
4120
char ievent_buffer[sizeof(struct inotify_event) + NAME_MAX + 1];
4121
struct inotify_event *ievent = ((struct inotify_event *)
4406
struct inotify_event event;
4407
char name_buffer[NAME_MAX + 1];
4409
struct inotify_event *const ievent = &ievent_buffer.event;
4124
4411
const char dummy_file_name[] = "ask.dummy_file_name";
4125
4412
ievent->mask = IN_DELETE;
4127
4414
memcpy(ievent->name, dummy_file_name, sizeof(dummy_file_name));
4128
4415
const size_t ievent_size = (sizeof(struct inotify_event)
4129
4416
+ sizeof(dummy_file_name));
4130
g_assert_cmpint(write(pipefds[1], ievent_buffer, ievent_size),
4417
g_assert_cmpint(write(pipefds[1], (char *)ievent, ievent_size),
4131
4418
==, ievent_size);
4132
4419
g_assert_cmpint(close(pipefds[1]), ==, 0);
4199
4486
const size_t ievent_max_size = (sizeof(struct inotify_event)
4200
4487
+ NAME_MAX + 1);
4201
4488
g_assert_cmpint(ievent_max_size, <=, PIPE_BUF);
4202
char ievent_buffer[sizeof(struct inotify_event) + NAME_MAX + 1];
4203
struct inotify_event *ievent = ((struct inotify_event *)
4490
struct inotify_event event;
4491
char name_buffer[NAME_MAX + 1];
4493
struct inotify_event *const ievent = &ievent_buffer.event;
4206
4495
const char dummy_file_name[] = "ignored.dummy_file_name";
4207
4496
ievent->mask = IN_CLOSE_WRITE;
4209
4498
memcpy(ievent->name, dummy_file_name, sizeof(dummy_file_name));
4210
4499
const size_t ievent_size = (sizeof(struct inotify_event)
4211
4500
+ sizeof(dummy_file_name));
4212
g_assert_cmpint(write(pipefds[1], ievent_buffer, ievent_size),
4501
g_assert_cmpint(write(pipefds[1], (char *)ievent, ievent_size),
4213
4502
==, ievent_size);
4214
4503
g_assert_cmpint(close(pipefds[1]), ==, 0);
4273
4562
const size_t ievent_max_size = (sizeof(struct inotify_event)
4274
4563
+ NAME_MAX + 1);
4275
4564
g_assert_cmpint(ievent_max_size, <=, PIPE_BUF);
4276
char ievent_buffer[sizeof(struct inotify_event) + NAME_MAX + 1];
4277
struct inotify_event *ievent = ((struct inotify_event *)
4566
struct inotify_event event;
4567
char name_buffer[NAME_MAX + 1];
4569
struct inotify_event *const ievent = &ievent_buffer.event;
4280
4571
const char dummy_file_name[] = "ignored.dummy_file_name";
4281
4572
ievent->mask = IN_MOVED_TO;
4283
4574
memcpy(ievent->name, dummy_file_name, sizeof(dummy_file_name));
4284
4575
const size_t ievent_size = (sizeof(struct inotify_event)
4285
4576
+ sizeof(dummy_file_name));
4286
g_assert_cmpint(write(pipefds[1], ievent_buffer, ievent_size),
4577
g_assert_cmpint(write(pipefds[1], (char *)ievent, ievent_size),
4287
4578
==, ievent_size);
4288
4579
g_assert_cmpint(close(pipefds[1]), ==, 0);
4330
4621
EPOLLIN | EPOLLRDHUP));
4625
test_read_inotify_event_IN_MOVED_FROM_badname(__attribute__((unused))
4626
test_fixture *fixture,
4627
__attribute__((unused))
4630
__attribute__((cleanup(cleanup_close)))
4631
const int epoll_fd = epoll_create1(EPOLL_CLOEXEC);
4632
g_assert_cmpint(epoll_fd, >=, 0);
4633
__attribute__((cleanup(string_set_clear)))
4634
string_set cancelled_filenames = {};
4635
const mono_microsecs current_time = 0;
4638
g_assert_cmpint(pipe2(pipefds, O_CLOEXEC | O_NONBLOCK), ==, 0);
4640
/* "sufficient to read at least one event." - inotify(7) */
4641
const size_t ievent_max_size = (sizeof(struct inotify_event)
4643
g_assert_cmpint(ievent_max_size, <=, PIPE_BUF);
4645
struct inotify_event event;
4646
char name_buffer[NAME_MAX + 1];
4648
struct inotify_event *const ievent = &ievent_buffer.event;
4650
const char dummy_file_name[] = "ignored.dummy_file_name";
4651
ievent->mask = IN_MOVED_FROM;
4652
ievent->len = sizeof(dummy_file_name);
4653
memcpy(ievent->name, dummy_file_name, sizeof(dummy_file_name));
4654
const size_t ievent_size = (sizeof(struct inotify_event)
4655
+ sizeof(dummy_file_name));
4656
g_assert_cmpint(write(pipefds[1], (char *)ievent, ievent_size),
4658
g_assert_cmpint(close(pipefds[1]), ==, 0);
4660
bool quit_now = false;
4661
buffer password = {};
4662
bool mandos_client_exited = false;
4663
bool password_is_read = false;
4664
__attribute__((cleanup(cleanup_queue)))
4665
task_queue *queue = create_queue();
4666
g_assert_nonnull(queue);
4668
task_context task = {
4669
.func=read_inotify_event,
4672
.quit_now=&quit_now,
4673
.password=&password,
4674
.filename=strdup("/nonexistent"),
4675
.cancelled_filenames=&cancelled_filenames,
4676
.current_time=¤t_time,
4677
.mandos_client_exited=&mandos_client_exited,
4678
.password_is_read=&password_is_read,
4680
task.func(task, queue);
4681
g_assert_false(quit_now);
4682
g_assert_true(queue->next_run == 0);
4683
g_assert_cmpuint((unsigned int)queue->length, ==, 1);
4685
g_assert_nonnull(find_matching_task(queue, (task_context){
4686
.func=read_inotify_event,
4689
.quit_now=&quit_now,
4690
.password=&password,
4691
.filename=task.filename,
4692
.cancelled_filenames=&cancelled_filenames,
4693
.current_time=¤t_time,
4694
.mandos_client_exited=&mandos_client_exited,
4695
.password_is_read=&password_is_read,
4698
g_assert_true(epoll_set_contains(epoll_fd, pipefds[0],
4699
EPOLLIN | EPOLLRDHUP));
4701
__attribute__((cleanup(cleanup_string)))
4702
char *filename = NULL;
4703
g_assert_cmpint(asprintf(&filename, "%s/%s", task.filename,
4704
dummy_file_name), >, 0);
4705
g_assert_nonnull(filename);
4706
g_assert_false(string_set_contains(cancelled_filenames, filename));
4334
4710
void test_read_inotify_event_IN_DELETE_badname(__attribute__((unused))
4335
4711
test_fixture *fixture,
4350
4726
const size_t ievent_max_size = (sizeof(struct inotify_event)
4351
4727
+ NAME_MAX + 1);
4352
4728
g_assert_cmpint(ievent_max_size, <=, PIPE_BUF);
4353
char ievent_buffer[sizeof(struct inotify_event) + NAME_MAX + 1];
4354
struct inotify_event *ievent = ((struct inotify_event *)
4730
struct inotify_event event;
4731
char name_buffer[NAME_MAX + 1];
4733
struct inotify_event *const ievent = &ievent_buffer.event;
4357
4735
const char dummy_file_name[] = "ignored.dummy_file_name";
4358
4736
ievent->mask = IN_DELETE;
4360
4738
memcpy(ievent->name, dummy_file_name, sizeof(dummy_file_name));
4361
4739
const size_t ievent_size = (sizeof(struct inotify_event)
4362
4740
+ sizeof(dummy_file_name));
4363
g_assert_cmpint(write(pipefds[1], ievent_buffer, ievent_size),
4741
g_assert_cmpint(write(pipefds[1], (char *)ievent, ievent_size),
4364
4742
==, ievent_size);
4365
4743
g_assert_cmpint(close(pipefds[1]), ==, 0);
7573
7954
test_add_inotify_dir_watch);
7574
7955
test_add_st("/task-creators/add_inotify_dir_watch/fail",
7575
7956
test_add_inotify_dir_watch_fail);
7957
test_add_st("/task-creators/add_inotify_dir_watch/not-a-directory",
7958
test_add_inotify_dir_watch_nondir);
7576
7959
test_add_st("/task-creators/add_inotify_dir_watch/EAGAIN",
7577
7960
test_add_inotify_dir_watch_EAGAIN);
7578
7961
test_add_st("/task-creators/add_inotify_dir_watch/IN_CLOSE_WRITE",
7579
7962
test_add_inotify_dir_watch_IN_CLOSE_WRITE);
7580
7963
test_add_st("/task-creators/add_inotify_dir_watch/IN_MOVED_TO",
7581
7964
test_add_inotify_dir_watch_IN_MOVED_TO);
7965
test_add_st("/task-creators/add_inotify_dir_watch/IN_MOVED_FROM",
7966
test_add_inotify_dir_watch_IN_MOVED_FROM);
7967
test_add_st("/task-creators/add_inotify_dir_watch/IN_EXCL_UNLINK",
7968
test_add_inotify_dir_watch_IN_EXCL_UNLINK);
7582
7969
test_add_st("/task-creators/add_inotify_dir_watch/IN_DELETE",
7583
7970
test_add_inotify_dir_watch_IN_DELETE);
7584
7971
test_add_st("/task/read_inotify_event/readerror",
7593
7980
test_read_inotify_event_IN_CLOSE_WRITE);
7594
7981
test_add_st("/task/read_inotify_event/IN_MOVED_TO",
7595
7982
test_read_inotify_event_IN_MOVED_TO);
7983
test_add_st("/task/read_inotify_event/IN_MOVED_FROM",
7984
test_read_inotify_event_IN_MOVED_FROM);
7596
7985
test_add_st("/task/read_inotify_event/IN_DELETE",
7597
7986
test_read_inotify_event_IN_DELETE);
7598
7987
test_add_st("/task/read_inotify_event/IN_CLOSE_WRITE/badname",
7599
7988
test_read_inotify_event_IN_CLOSE_WRITE_badname);
7600
7989
test_add_st("/task/read_inotify_event/IN_MOVED_TO/badname",
7601
7990
test_read_inotify_event_IN_MOVED_TO_badname);
7991
test_add_st("/task/read_inotify_event/IN_MOVED_FROM/badname",
7992
test_read_inotify_event_IN_MOVED_FROM_badname);
7602
7993
test_add_st("/task/read_inotify_event/IN_DELETE/badname",
7603
7994
test_read_inotify_event_IN_DELETE_badname);
7604
7995
test_add_st("/task/open_and_parse_question/ENOENT",
7701
8092
g_option_context_set_help_enabled(context, FALSE);
7702
8093
g_option_context_set_ignore_unknown_options(context, TRUE);
7704
gboolean run_tests = FALSE;
8095
gboolean should_run_tests = FALSE;
7705
8096
GOptionEntry entries[] = {
7706
8097
{ "test", 0, 0, G_OPTION_ARG_NONE,
7707
&run_tests, "Run tests", NULL },
8098
&should_run_tests, "Run tests", NULL },
7710
8101
g_option_context_add_main_entries(context, entries, NULL);