]> err.no Git - varnish/commitdiff
When an -expect fails in varnishtest, loop for up to a second since stats sometimes...
authortfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 18 Aug 2008 08:00:21 +0000 (08:00 +0000)
committertfheen <tfheen@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 18 Aug 2008 08:00:21 +0000 (08:00 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3097 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/vtc_varnish.c

index f6fcfcff7cf459b5c209cf5acf1cb2783f3b5ab9..5dd253b38b9f7845f1dd91a434aa008f70fbf1aa 100644 (file)
@@ -416,29 +416,36 @@ varnish_expect(struct varnish *v, char * const *av) {
        uint64_t        val, ref;
        int good;
        char *p;
+       int i;
+
+       good = 0;
+
+       for (i = 0; i < 10; i++, usleep(100000)) {
 
 #define MAC_STAT(n, t, f, d)                                   \
-       if (!strcmp(av[0], #n)) {                               \
-               val = v->stats->n;                              \
-       } else 
+               if (!strcmp(av[0], #n)) {                       \
+                       val = v->stats->n;                      \
+               } else
 #include "stat_field.h"
 #undef MAC_STAT
                {
-               vtc_log(v->vl, 0, "stats field %s unknown", av[0]);
-       }
+                       vtc_log(v->vl, 0, "stats field %s unknown", av[0]);
+               }
 
-       ref = strtoumax(av[2], &p, 0);
-       if (ref == UINTMAX_MAX || *p) 
-               vtc_log(v->vl, 0, "Syntax error in number (%s)", av[2]);
-       good = 0;
-       if      (!strcmp(av[1], "==")) { if (val == ref) good = 1; }
-       else if (!strcmp(av[1], "!=")) { if (val != ref) good = 1; }
-       else if (!strcmp(av[1], ">"))  { if (val > ref)  good = 1; }
-       else if (!strcmp(av[1], "<"))  { if (val < ref)  good = 1; }
-       else if (!strcmp(av[1], ">=")) { if (val >= ref) good = 1; }
-       else if (!strcmp(av[1], "<=")) { if (val <= ref) good = 1; }
-       else {
-               vtc_log(v->vl, 0, "comparison %s unknown", av[1]);
+               ref = strtoumax(av[2], &p, 0);
+               if (ref == UINTMAX_MAX || *p)
+                       vtc_log(v->vl, 0, "Syntax error in number (%s)", av[2]);
+               if      (!strcmp(av[1], "==")) { if (val == ref) good = 1; }
+               else if (!strcmp(av[1], "!=")) { if (val != ref) good = 1; }
+               else if (!strcmp(av[1], ">"))  { if (val > ref)  good = 1; }
+               else if (!strcmp(av[1], "<"))  { if (val < ref)  good = 1; }
+               else if (!strcmp(av[1], ">=")) { if (val >= ref) good = 1; }
+               else if (!strcmp(av[1], "<=")) { if (val <= ref) good = 1; }
+               else {
+                       vtc_log(v->vl, 0, "comparison %s unknown", av[1]);
+               }
+               if (good)
+                       break;
        }
        if (good)
                vtc_log(v->vl, 2, "as expected: %s (%ju) %s %s",