pike.git / src / modules / Inotify / testsuite.in

version» Context lines:

pike.git/src/modules/Inotify/testsuite.in:1: - // Only do the following tests if we have System.Inotify. - cond([[ master()->resolv("System")["Inotify"] ]], [[ + START_MARKER    -  + cond_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));
pike.git/src/modules/Inotify/testsuite.in:25:   test_true(intp(System.Inotify.IN_Q_OVERFLOW));   test_true(intp(System.Inotify.IN_UNMOUNT));   test_any([[ // 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; -  if (mkdir(testdir)) { +  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(); -  object file = Stdio.File(); -  file->assign(i->fd()); +  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"); -  array a = System.Inotify.parse_event(file->read(4096, 1)); -  +  i->poll();    return a[3] == "conftest" && a[1] == System.Inotify.IN_CREATE;   ]], 1) - test_do(add_constant("testdir")) +  + test_true(rm(testfile))   test_do(add_constant("testfile"))      ]]) // System.Inotify -  +  + ifefun(testdir, + [[ +  test_true(rm(testdir)); +  test_do(add_constant("testdir")); + ]]) +  + END_MARKER