a60d7f2015-11-16Martin Nilsson START_MARKER cond_resolv(System.Inotify, [[
0b17372011-03-24Henrik Grubbström (Grubba) 
3b86e22011-01-21Arne Goedeke 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([[ dnl stole this from pikes Stdio.File testsuite. 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;
601fdb2015-05-30Henrik Grubbström (Grubba)  rm(testdir); if (mkdir(testdir) || rm(testdir + "/conftest")) {
3b86e22011-01-21Arne Goedeke  add_constant("testdir", testdir + "/"); add_constant("testfile", testdir + "/conftest"); return 1; } } add_constant("testfile", "conftest"); return 0; ]], 1)
910a342015-05-30Henrik Grubbström (Grubba) 
3b86e22011-01-21Arne Goedeke test_any([[ object i = System.Inotify._Instance();
16802f2015-10-14Henrik Grubbström (Grubba)  array a; i->set_event_callback(lambda(mixed ... args) { a = args; });
910a342015-05-30Henrik Grubbström (Grubba) #if constant(testdir)
3b86e22011-01-21Arne Goedeke  i->add_watch(testdir, System.Inotify.IN_CREATE);
910a342015-05-30Henrik Grubbström (Grubba) #else i->add_watch(".", System.Inotify.IN_CREATE); #endif
3b86e22011-01-21Arne Goedeke  Stdio.write_file(testfile, "test");
16802f2015-10-14Henrik Grubbström (Grubba)  i->poll();
3b86e22011-01-21Arne Goedeke  return a[3] == "conftest" && a[1] == System.Inotify.IN_CREATE; ]], 1)
0b17372011-03-24Henrik Grubbström (Grubba) 
c8ebbe2015-05-30Henrik Grubbström (Grubba) test_true(rm(testfile)) test_do(add_constant("testfile"))
4b3f9d2015-06-03Henrik Grubbström (Grubba) ]]) dnl System.Inotify
a60d7f2015-11-16Martin Nilsson ifefun(testdir,
c8ebbe2015-05-30Henrik Grubbström (Grubba) [[ test_true(rm(testdir)); test_do(add_constant("testdir")); ]])
a60d7f2015-11-16Martin Nilsson  END_MARKER