|
cond([[ master()->resolv("System")["Inotify"] ]], [[ |
|
test_true(functionp(System.Inotify.parse_event)); |
test_true(programp(System.Inotify._Instance)); |
test_true(programp(System.Inotify.Instance)); |
test_true(intp(System.Inotify.IN_CREATE)); |
test_true(intp(System.Inotify.IN_ATTRIB)); |
test_true(intp(System.Inotify.IN_CLOSE_WRITE)); |
test_true(intp(System.Inotify.IN_CLOSE_NOWRITE)); |
test_true(intp(System.Inotify.IN_DELETE)); |
test_true(intp(System.Inotify.IN_DELETE_SELF)); |
test_true(intp(System.Inotify.IN_MODIFY)); |
test_true(intp(System.Inotify.IN_MOVE_SELF)); |
test_true(intp(System.Inotify.IN_MOVED_FROM)); |
test_true(intp(System.Inotify.IN_MOVED_TO)); |
test_true(intp(System.Inotify.IN_OPEN)); |
test_true(intp(System.Inotify.IN_MOVE)); |
test_true(intp(System.Inotify.IN_CLOSE)); |
test_true(intp(System.Inotify.IN_DONT_FOLLOW)); |
test_true(intp(System.Inotify.IN_ONESHOT)); |
test_true(intp(System.Inotify.IN_ONLYDIR)); |
test_true(intp(System.Inotify.IN_IGNORED)); |
test_true(intp(System.Inotify.IN_ISDIR)); |
test_true(intp(System.Inotify.IN_Q_OVERFLOW)); |
test_true(intp(System.Inotify.IN_UNMOUNT)); |
test_any([[ |
Stdio.Stat st = file_stat("/tmp"); |
string prefix = (st && st->isdir)?"/tmp/":""; |
int pid = getpid(); |
int i; |
prefix += "conftest_pike_dir_"; |
for(i = 0; i < 32; i++) { |
string testdir = prefix + i; |
rm(testdir); |
if (mkdir(testdir) || rm(testdir + "/conftest")) { |
add_constant("testdir", testdir + "/"); |
add_constant("testfile", testdir + "/conftest"); |
return 1; |
} |
} |
add_constant("testfile", "conftest"); |
return 0; |
]], 1) |
|
test_any([[ |
object i = System.Inotify._Instance(); |
array a; |
i->set_event_callback(lambda(mixed ... args) { a = args; }); |
#if constant(testdir) |
i->add_watch(testdir, System.Inotify.IN_CREATE); |
#else |
i->add_watch(".", System.Inotify.IN_CREATE); |
#endif |
Stdio.write_file(testfile, "test"); |
i->poll(); |
return a[3] == "conftest" && a[1] == System.Inotify.IN_CREATE; |
]], 1) |
|
test_true(rm(testfile)) |
test_do(add_constant("testfile")) |
|
]]) |
|
cond([[ all_constants()->testdir ]], |
[[ |
test_true(rm(testdir)); |
test_do(add_constant("testdir")); |
]]) |
|
|