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); }
long hgTracksRandom(char *url) /* hgTracksRandom - Time default view for random position. */ /* The URL can include position. */ { long startTime, endTime; struct htmlPage *rootPage; startTime = clock1000(); rootPage = htmlPageGet(url); endTime = clock1000(); htmlPageValidateOrAbort(rootPage); if (rootPage->status->status != 200) errAbort("%s returned with status code %d", url, rootPage->status->status); return endTime - startTime; }
struct qaStatus *qaPageGet(char *url, struct htmlPage **retPage) /* Get info on given url, (and return page if retPage non-null). */ { struct errCatch *errCatch = errCatchNew(); struct qaStatus *qs; struct htmlPage *page = NULL; long startTime = clock1000(); if (errCatchStart(errCatch)) { page = htmlPageGet(url); htmlPageValidateOrAbort(page); } else { htmlPageFree(&page); } errCatchEnd(errCatch); qs = qaStatusOnPage(errCatch, page, startTime, retPage); errCatchFree(&errCatch); return qs; }
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); }
struct qaStatus *qaPageFromForm(struct htmlPage *origPage, struct htmlForm *form, char *buttonName, char *buttonVal, struct htmlPage **retPage) /* Get update to form based on pressing a button. */ { struct errCatch *errCatch = errCatchNew(); struct qaStatus *qs; struct htmlPage *page = NULL; long startTime = clock1000(); if (errCatchStart(errCatch)) { page = htmlPageFromForm(origPage, form, buttonName, buttonVal); htmlPageValidateOrAbort(page); } else { htmlPageFree(&page); } errCatchEnd(errCatch); qs = qaStatusOnPage(errCatch, page, startTime, retPage); errCatchFree(&errCatch); return qs; }