Пример #1
0
void testOrg(struct htmlPage *rootPage, struct htmlForm *rootForm, char *org)
/* Test on organism.  */
{
struct htmlPage *orgPage;
struct htmlForm *mainForm;
struct htmlFormVar *dbVar;
struct slName *db;
int dbIx;

/* Get page with little selected beyond organism.  This page
 * will get whacked around a little by testDb, so set range
 * position and db to something safe each time through. */
htmlPageSetVar(rootPage, rootForm, "org", org);
htmlPageSetVar(rootPage, NULL, "db", NULL); 
htmlPageSetVar(rootPage, NULL, hgtaRegionType, NULL); 
htmlPageSetVar(rootPage, NULL, "position", NULL); 
orgPage = htmlPageFromForm(rootPage, rootPage->forms, "submit", "Go");
if ((mainForm = htmlFormGet(orgPage, "mainForm")) == NULL)
    {
    errAbort("Couldn't get main form on orgPage");
    }
if ((dbVar = htmlFormVarGet(mainForm, "db")) == NULL)
    errAbort("Couldn't get org var");
for (db = dbVar->values, dbIx=0; db != NULL && dbIx < clDbs; 
	db = db->next, ++dbIx)
    {
    testDb(orgPage, org, db->name);
    }
htmlPageFree(&orgPage);
}
Пример #2
0
void testOneGroup(struct htmlPage *dbPage, char *org, char *db, char *group, 
	int maxTracks)
/* Test a little something on up to maxTracks in one group */
{
struct htmlPage *groupPage = quickSubmit(dbPage, org, db, group, NULL, NULL,
	"selectGroup", hgtaGroup, group);
struct htmlForm *mainForm;
struct htmlFormVar *trackVar;
struct slName *track;
int trackIx;

if ((mainForm = htmlFormGet(groupPage, "mainForm")) == NULL)
    errAbort("Couldn't get main form on groupPage");
if ((trackVar = htmlFormVarGet(mainForm, hgtaTrack)) == NULL)
    errAbort("Can't find track var");
for (track = trackVar->values, trackIx = 0; 
	track != NULL && trackIx < maxTracks; 
	track = track->next, ++trackIx)
    {
    if (clTrack == NULL || sameString(track->name, clTrack))
	testOneTrack(groupPage, org, db, group, track->name, clTables);
    }

/* Clean up. */
htmlPageFree(&groupPage);
}
Пример #3
0
void testOneTrack(struct htmlPage *groupPage, char *org, char *db,
	char *group, char *track, int maxTables)
/* Test a little something on up to maxTables in one track. */
{
struct htmlPage *trackPage = quickSubmit(groupPage, org, db, group, 
	track, NULL, "selectTrack", hgtaTrack, track);
struct htmlForm *mainForm;
struct htmlFormVar *tableVar;
struct slName *table;
int tableIx;

if (trackPage == NULL)
    errAbort("Couldn't select track %s", track);
if ((mainForm = htmlFormGet(trackPage, "mainForm")) == NULL)
    errAbort("Couldn't get main form on trackPage");
if ((tableVar = htmlFormVarGet(mainForm, hgtaTable)) == NULL)
    errAbort("Can't find table var");
for (table = tableVar->values, tableIx = 0; 
	table != NULL && tableIx < maxTables; 
	table = table->next, ++tableIx)
    {
    if (clTable == NULL || sameString(clTable, table->name))
	testOneTable(trackPage, org, db, group, track, table->name);
    }
/* Clean up. */
htmlPageFree(&trackPage);
}
Пример #4
0
void hgTablesTest(char *url, char *logName)
/* hgTablesTest - Test hgTables web page. */
{
/* Get default page, and open log. */
struct htmlPage *rootPage = htmlPageGet(url);
if (appendLog)
    logFile = mustOpen(logName, "a");
else
    logFile = mustOpen(logName, "w");
if (! endsWith(url, "hgTables"))
    warn("Warning: first argument should be a complete URL to hgTables, "
	 "but doesn't look like one (%s)", url);
htmlPageValidateOrAbort(rootPage);

/* Go test what they've specified in command line. */
if (clDb != NULL)
    {
    testDb(rootPage, NULL, clDb);
    }
else
    {
    struct htmlForm *mainForm;
    struct htmlFormVar *orgVar;
    if ((mainForm = htmlFormGet(rootPage, "mainForm")) == NULL)
	errAbort("Couldn't get main form");
    if ((orgVar = htmlFormVarGet(mainForm, "org")) == NULL)
	errAbort("Couldn't get org var");
    if (clOrg != NULL)
	testOrg(rootPage, mainForm, clOrg);
    else
	{
	struct slName *org;
	int orgIx;
	for (org = orgVar->values, orgIx=0; org != NULL && orgIx < clOrgs; 
		org = org->next, ++orgIx)
	    {
	    testOrg(rootPage, mainForm, org->name);
	    }
	}
    }

/* Do some more complex tests on uniProt. */
testJoining(rootPage);
testFilter(rootPage);
testIdentifier(rootPage);

/* Clean up and report. */
htmlPageFree(&rootPage);
slReverse(&tablesTestList);
reportSummary(tablesTestList, stdout);
reportAll(tablesTestList, logFile);
fprintf(logFile, "---------------------------------------------\n");
reportSummary(tablesTestList, logFile);
}
void hgNearTest(char *url, char *log)
/* hgNearTest - Test hgNear web page. */
{
struct htmlPage *rootPage = htmlPageGet(url);

struct htmlForm *mainForm;
struct htmlFormVar *orgVar;
FILE *f = mustOpen(log, "w");

htmlPageValidateOrAbort(rootPage);
htmlPageSetVar(rootPage, NULL, orderVarName, "geneDistance");
htmlPageSetVar(rootPage, NULL, countVarName, "25");
if ((mainForm = htmlFormGet(rootPage, "mainForm")) == NULL)
    errAbort("Couldn't get main form");
if ((orgVar = htmlFormVarGet(mainForm, "org")) == NULL)
    errAbort("Couldn't get org var");
if (clOrg != NULL)
    testOrg(rootPage, mainForm, clOrg, clDb);
else
    {
    struct slName *org;
    for (org = orgVar->values; org != NULL; org = org->next)
        {
	testOrg(rootPage, mainForm, org->name, clDb);
	}
    }

htmlPageFree(&rootPage);

slReverse(&nearTestList);

reportSummary(nearTestList, stdout);
fprintf(f,"seed=%d\n",seed);
reportAll(nearTestList, f);
fprintf(f, "---------------------------------------------\n");
reportSummary(nearTestList, f);
slFreeList(&nearTestList);
carefulClose(&f);
}
void testOrg(struct htmlPage *rootPage, struct htmlForm *rootForm, char *org, char *forceDb)
/* Test on organism.  If forceDb is non-null, only test on
 * given database. */
{
struct htmlPage *orgPage;
struct htmlForm *mainForm;
struct htmlFormVar *dbVar;
struct slName *db;
htmlPageSetVar(rootPage, rootForm, "org", org);
htmlPageSetVar(rootPage, rootForm, "db", NULL);
htmlPageSetVar(rootPage, rootForm, searchVarName, "");
orgPage = htmlPageFromForm(rootPage, rootPage->forms, "submit", "Go");
if ((mainForm = htmlFormGet(orgPage, "mainForm")) == NULL)
    errAbort("Couldn't get main form on orgPage");
if ((dbVar = htmlFormVarGet(mainForm, "db")) == NULL)
    errAbort("Couldn't get org var");
for (db = dbVar->values; db != NULL; db = db->next)
    {
    if (forceDb == NULL || sameString(forceDb, db->name))
	testDb(orgPage, org, db->name);
    }
htmlPageFree(&orgPage);
}
Пример #7
0
void testGroups(struct htmlPage *dbPage, char *org, char *db, int maxGroups)
/* Test a little something in all groups for dbPage. */
{
struct htmlForm *mainForm;
struct htmlFormVar *groupVar;
struct slName *group;
int groupIx;

if ((mainForm = htmlFormGet(dbPage, "mainForm")) == NULL)
    errAbort("Couldn't get main form on dbPage");
if ((groupVar = htmlFormVarGet(mainForm, hgtaGroup)) == NULL)
    errAbort("Can't find group var");
for (group = groupVar->values, groupIx=0; 
	group != NULL && groupIx < maxGroups; 
	group = group->next, ++groupIx)
    {
    if (!sameString("allTables", group->name))
	{
	if (clGroup == NULL || sameString(clGroup, group->name))
	    testOneGroup(dbPage, org, db, group->name, clTracks);
	}
    }
}
Пример #8
0
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;

    hashAdd(uniqHash, fullName, NULL);
    verbose(1, "Testing %s %s %s %s %s\n", naForNull(org), db, group, track, table);
    tablePage = quickSubmit(trackPage, org, db, group, 
	    track, table, "selectTable", hgtaTable, table);
    if (!isObsolete(table) && tablePage != NULL)
	{
	if ((mainForm = htmlFormGet(tablePage, "mainForm")) == NULL)
	    {
	    qaStatusSoftError(tablesTestList->status, 
		    "Couldn't get main form on tablePage for %s %s %s %s", db, group, track, table);
	    }
	else
	    {
	    testSchema(tablePage, mainForm, org, db, group, track, table);
	    testSummaryStats(tablePage, mainForm, org, db, group, track, table);
	    if (outTypeAvailable(mainForm, "bed")) 
		{
		if (outTypeAvailable(mainForm, "primaryTable"))
		    {
		    int rowCount;
		    rowCount = testAllFields(tablePage, mainForm, org, db, group, track, table);
		    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 if (outTypeAvailable(mainForm, "primaryTable"))
		{
		/* 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. */
		if (tableSize(db, table) < 500000)
		    {
		    int rowCount;
		    rowCount = testAllFields(tablePage, mainForm, org, db, group, track, table);
		    testOneField(tablePage, mainForm, org, db, group, track, table, rowCount);
		    }
		}
	    }
	htmlPageFree(&tablePage);
	}
    carefulCheckHeap();
    }
}