Re: [gamin] monitoring of links
- From: TomPh <tpgww onepost net>
- To: veillard redhat com
- Cc: gamin-list gnome org
- Subject: Re: [gamin] monitoring of links
- Date: Fri, 2 Sep 2005 11:26:17 +1000
> > > > The link-test patch provides for making links, and changing
> > > > their ownership (to get around prohibitions on changing link
> > > > permissions).
See attached patch which relates to those only.
Incidentally, it adds a test for
> > > > more-reports-than-expected,
See attached patch which relates to that only.
> > With that check in effect and running 'make tests', here I see extra
> > reports for basic test 10 only, as follows:
> >
> > running test 10
> > *** ../tests/result/10 2005-05-12 21:38:22.000000000 +1000
> > --- result.10 2005-08-26 23:00:07.000000000 +1000
> > ***************
> > *** 6,14 ****
> > --- 6,16 ----
> > 1: /tmp/test_gamin Exists: NULL
> > 1: subdir Exists: NULL
> > 1: /tmp/test_gamin EndExist: NULL
> > + expect line 7: expected 2 events but got 3
> > monfile /tmp/test_gamin/subdir/foo 1
> > 2: /tmp/test_gamin/subdir/foo Exists: NULL
> > 2: /tmp/test_gamin/subdir/foo EndExist: NULL
> > + expect line 10: expected 1 events but got 2
> > cancel 0 2
> > 1: /tmp/test_gamin Acknowledge: NULL
> > append /tmp/test_gamin/subdir/foo
> >
> > Both of those extra reports look to me like they are right, and
> > indicate a problem with the results file, not with gamin's
> > performance. So fix the results file ...
See attached patch for that only - expect 1 extra report, in 2 places
Regards
Tom
diff -BbU 2 10.tst-cvs 10.tst (5585)
--- 10.tst-cvs 2005-05-12 21:38:22.000000000 +1000
+++ 10.tst 2005-09-02 09:20:31.000000000 +1000
@@ -5,8 +5,8 @@
mondir /tmp/test_gamin
wait
-expect 2
+expect 3
monfile /tmp/test_gamin/subdir/foo
wait
-expect 1
+expect 2
cancel 0
expect 1
diff -BbU 2 testing.c-cvs testing.c (5982)
--- testing.c-cvs 2005-08-09 12:32:38.000000000 +1000
+++ testing.c 2005-08-27 08:00:50.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);
diff -BbU 2 testing.c-cvs testing.c (5982)
--- testing.c-cvs 2005-08-09 12:32:38.000000000 +1000
+++ testing.c 2005-08-27 08:00:50.000000000 +1000
@@ -460,5 +488,15 @@
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 {
+ /* ok sofar, now wait 2 secs to see whether we get too many reports */
+ delay = 0;
+ while (delay < 20) {
+ debugLoop(100);
+ delay++;
+ }
+ 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")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]