Ticket #308: qp-skip-for-poor-timer-granularity2.patch

File qp-skip-for-poor-timer-granularity2.patch, 2.0 KB (added by Olly Betts, 16 years ago)

updated patch

  • queryparsertest.cc

     
    17961796    // Allow a factor of 2 difference, to cover random variation.
    17971797    // First, we test a simple query.
    17981798    time1 = time_query_parse(db, q1, repetitions, defflags);
     1799    if (time1 == 0.0) {
     1800        // The first test completed before the timer ticked at all!
     1801        SKIP_TEST("Timer granularity is too coarse");
     1802    }
    17991803    time2 = time_query_parse(db, q2, 1, defflags);
    18001804    tout << "defflags: small=" << time1 << "s, large=" << time2 << "s\n";
    18011805    TEST_LESSER(time2, time1 * 2);
     
    18031807    // If synonyms are enabled, a different code-path is followed.
    18041808    // Test a query which has no synonyms.
    18051809    time1 = time_query_parse(db, q1b, repetitions, synflags);
     1810    if (time1 == 0.0) {
     1811        // The first test completed before the timer ticked at all!
     1812        SKIP_TEST("Timer granularity is too coarse");
     1813    }
    18061814    time2 = time_query_parse(db, q2b, 1, synflags);
    18071815    tout << "synflags: small=" << time1 << "s, large=" << time2 << "s\n";
    18081816    TEST_LESSER(time2, time1 * 2);
    18091817
    18101818    // Test a query which has short synonyms.
    18111819    time1 = time_query_parse(db, q1, repetitions, synflags);
     1820    if (time1 == 0.0) {
     1821        // The first test completed before the timer ticked at all!
     1822        SKIP_TEST("Timer granularity is too coarse");
     1823    }
    18121824    time2 = time_query_parse(db, q2, 1, synflags);
    18131825    tout << "synflags: small=" << time1 << "s, large=" << time2 << "s\n";
    18141826    TEST_LESSER(time2, time1 * 2);
     
    18181830    db.flush();
    18191831
    18201832    time1 = time_query_parse(db, q1, repetitions, synflags);
     1833    if (time1 == 0.0) {
     1834        // The first test completed before the timer ticked at all!
     1835        SKIP_TEST("Timer granularity is too coarse");
     1836    }
    18211837    time2 = time_query_parse(db, q2, 1, synflags);
    18221838    tout << "synflags2: small=" << time1 << "s, large=" << time2 << "s\n";
    18231839    TEST_LESSER(time2, time1 * 2);