> > To facilitate this, seems to me that a couple of test-cases, dealing > > with directory-links and non-directory-links, would help. I have > > candidates, and a patch for testing.c to allow it to do linking. > > Does this list have a policy on mailing attachments ? > > no problem, use attachments to avoid scrambling by the MTA For your review, attached test-cases 13 and 14 each include various tests for links to dirs and files/non-dirs, respectively. The corresponding results files have my best guess of what they should be. Haven't been able to achieve those results, with any server backend that works on linux. Nor have I got around to figuring out FAM. The link-test patch provides for making links, and changing their ownership (to get around prohibitions on changing link permissions). Incidentally, it adds a test for more-reports-than-expected, which shows up one or two of the existing basic test-cases, but not fatally so. And it no longer stops the test when the no. of events is wrong. That occasionally caused havoc when thing(s) created in a test were not cleaned up at the end of the test. BTW, my test-case 12 (not attached) relates to monitoring cascaded dirs. I haven't been able to pass that, either. Regards Tom
Attachment:
13
Description: Binary data
Attachment:
13.tst
Description: Binary data
Attachment:
14
Description: Binary data
Attachment:
14.tst
Description: Binary data
diff -BbU 2 testing.c-cvs testing.c (10484)
--- testing.c-cvs 2005-08-09 12:32:38.000000000 +1000
+++ testing.c 2005-08-26 18:28:58.000000000 +1000
@@ -366,4 +366,22 @@
}
printf("chmod %s to %s\n", arg, arg2);
+ } else if (!strcmp(command, "chown")) {
+ if (args != 3) {
+ fprintf(stderr, "chown line %d: lacks path and owner\n", no);
+ return (-1);
+ }
+ struct stat sb;
+ if (!lstat (arg, &sb)) {
+ ret = (S_ISLNK (sb.st_mode)) ?
+ lchown(arg, strtol(arg2, NULL, 10), -1) :
+ chown(arg, strtol(arg2, NULL, 10), -1);
+ } else
+ ret=-1;
+ if (ret < 0) {
+ fprintf(stderr, "chown line %d: failed to chown %s to %s\n", no,
+ arg, arg2);
+ return (-1);
+ }
+ printf("chown %s to %s\n", arg, arg2);
} else if (!strcmp(command, "mkfile")) {
if (args != 2) {
@@ -429,4 +447,14 @@
}
printf("move %s %s\n", arg, arg2);
+ } else if (!strcmp(command, "link")) {
+ if (args != 3) {
+ fprintf(stderr, "link line %d: lacks target and name\n", no); return (-1);
+ }
+ ret = symlink(arg, arg2);
+ if (ret < 0) {
+ fprintf(stderr, "link line %d: failed to link to %s\n", no, arg);
+ return (-1);
+ }
+ printf("link %s to %s\n", arg2, arg);
} else if (!strcmp(command, "event")) {
printEvent(no);
@@ -449,7 +477,7 @@
}
/*
- * wait at most 3 secs before declaring failure
+ * wait 3 secs, to check for too-many events
*/
- while ((delay < 30) && (testState.nb_events < nb_events + count)) {
+ while (delay < 30) {
debugLoop(100);
@@ -457,9 +485,11 @@
delay++;
}
- if (testState.nb_events < nb_events + count) {
+ if (testState.nb_events < nb_events + count)
printf("expect line %d: got %d of %d expected events\n",
no, testState.nb_events - nb_events, count);
- return (-1);
- }
+/* return (-1); don't abort in this case, we may need to clean up */
+ else if (testState.nb_events > nb_events + count)
+ printf("expect line %d: expected %d events but got %d\n",
+ no, count, testState.nb_events - nb_events);
} else if (!strcmp(command, "sleep")) {
int i;