90048b6df4aec62edab4c7f49f7a5084776db6a8 galt Wed Jun 29 11:23:00 2016 -0700 hgTablesTest, cleaned up. hgTablesTest now supports new options -seed=N and -noShuffle. diff --git src/hg/hgTablesTest/hgTablesTest.c src/hg/hgTablesTest/hgTablesTest.c index 4604f40..ed491f9 100644 --- src/hg/hgTablesTest/hgTablesTest.c +++ src/hg/hgTablesTest/hgTablesTest.c @@ -660,88 +660,30 @@ htmlPageFree(&outPage); } boolean isObsolete(char *table) /* Some old table types we can't handle. Just warn that * they are there and skip. */ { boolean obsolete = sameString(table, "wabaCbr"); if (obsolete) qaStatusSoftError(tablesTestList->status, "Skipping obsolete table %s", table); return obsolete; } - -int findExpectedIntersectingRows(char *db, char *table, struct htmlPage *tablePage) -/* Even when it can support intersections, some tables have way too many rows. - * Try to estimate how big the output will be using bin column. */ -{ -struct sqlConnection *conn = sqlConnect(db); -int size = -1; - -if (!sqlTableExists(conn, table)) - return -3; // not table found, might be a custom track or hub? - -// TODO add or call code to discover if this is a bigBed and if it is local? -// it should have 1 column called "fileName" -if (hHasField(db, table, "fileName") && (sqlCountColumnsInTable(conn,table) == 1)) - return -4; // bigBed (maybe bigWig)? - -if (!hIsBinned(db, table)) - return -1; // no bin column - -char *region = cloneString(htmlPageGetVar(tablePage, NULL, "position")->curVal); -char *chrom = region; -char *colon = strchr(region,':'); -char *dash = strchr(region,'-'); -*colon = 0; -*dash = 0; -int start = sqlUnsigned(colon+1); -int end = sqlUnsigned(dash+1); - -struct dyString *query = newDyString(256); -sqlDyStringPrintf(query, "select count(*) from %s where ", table); - -hAddBinToQuery(start, end, query); - -char *chromField = NULL; -if (hHasField(db, table, "chrom")) - chromField = "chrom"; -if (hHasField(db, table, "tName")) - chromField = "tName"; -if (hHasField(db, table, "genoName")) - chromField = "genoName"; -if (!chromField) // no chrom field found - { - verbose(1, "findExpectedIntersectingRows failed to find chrom column name in %s.%s\n", db, table); - fprintf(logFile, "findExpectedIntersectingRows failed to find chrom column name in %s.%s\n", db, table); - return -2; // no chrom name column - } - -sqlDyStringPrintfFrag(query, "%s = '%s'", chromField, chrom); - -verbose(2, "query=[%s]\n", query->string); - -size = sqlQuickNum(conn, dyStringCannibalize(&query)); - -sqlDisconnect(&conn); -return size; -} - - void testOneTable(struct htmlPage *trackPage, char *org, char *db, char *group, char *track, char *table) /* Test stuff on one table if we haven't already tested this table. */ { /* Why declared here and not globally? */ static struct hash *uniqHash = NULL; char fullName[256]; if (uniqHash == NULL) uniqHash = newHash(0); safef(fullName, sizeof(fullName), "%s.%s", db, table); if (!hashLookup(uniqHash, fullName)) { struct htmlPage *tablePage; struct htmlForm *mainForm; @@ -757,54 +699,42 @@ "Couldn't get main form on tablePage for %s %s %s %s", db, group, track, table); } else { verbose(3, "testOneTable testSchema() got here 1.1\n"); testSchema(tablePage, mainForm, org, db, group, track, table); verbose(3, "testOneTable testSummaryStats() got here 1.2\n"); testSummaryStats(tablePage, mainForm, org, db, group, track, table); verbose(3, "testOneTable got here 1.3\n"); if (outTypeAvailable(mainForm, "bed")) { verbose(3, "testOneTable bed output avail means can filter on position got here 2\n"); if (outTypeAvailable(mainForm, "primaryTable")) { verbose(3, "testOneTable got here 3\n"); - - int expectedSize = 0; // DEBUG RESTORE findExpectedIntersectingRows(db, table, tablePage); - // DEBUG RESTORE verbose(1, "%s.%s expectedSize=%d\n", db, table, expectedSize); - - if (expectedSize < 500000) - { int rowCount = testAllFields(tablePage, mainForm, org, db, group, track, table); if (rowCount >= 0) { testOneField(tablePage, mainForm, org, db, group, track, table, rowCount); testOutSequence(tablePage, mainForm, org, db, group, track, table, rowCount); testOutBed(tablePage, mainForm, org, db, group, track, table, rowCount); testOutHyperlink(tablePage, mainForm, org, db, group, track, table, rowCount); testOutGff(tablePage, mainForm, org, db, group, track, table); if (rowCount > 0) testOutCustomTrack(tablePage, mainForm, org, db, group, track, table); } } - else - { - verbose(1, "%s.%s expectedSize=%d, too large, skipping.\n", db, table, expectedSize); - fprintf(logFile, "%s.%s expectedSize=%d, too large, skipping.\n", db, table, expectedSize); - } - } } else if (outTypeAvailable(mainForm, "primaryTable")) { verbose(3, "testOneTable no bed output available, so no position filtering available. got here 4\n"); /* If BED type is not available then the region will be ignored, and * we'll end up scanning whole table. Make sure table is not huge * before proceeding. */ int tableRows = tableSize(db, table); if (tableRows < 500000) { int rowCount = testAllFields(tablePage, mainForm, org, db, group, track, table); if (rowCount >= 0) testOneField(tablePage, mainForm, org, db, group, track, table, rowCount); } else