michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: [ ] michael@0: [ ] use 'property.inc' michael@0: [ ] michael@0: [-] testcase LoadURL () appstate none michael@0: [ ] // The first few constants are to be changed according to how your machine is setup michael@0: [ ] // - strPerfToolsDrive is the drive letter corresponding to the script directory michael@0: [ ] // - strViewerDrive is the drive letter where the Viewer.exe is installed michael@0: [ ] // - strURLPath is the full path to the file that has the URLs to process michael@0: [ ] // - strPerfToolsDir is the directory where the perf tools are installed michael@0: [ ] // (no drive, no trailing '\') michael@0: [ ] // - strBuildBaseDir is the directory which contains the bin-directory where viewer.exe is installed michael@0: [ ] // (no drive, no trailing '\') i.e. \Mozilla\dist\Win32_o.obj for a build-tree michael@0: [ ] // - strMilestoneOrPull is the milestone or date of source pull if not a milestone michael@0: [ ] // (this is the text put into the header of the HTML table: i.e. 'Milestone M13' or 'Pulled: 1/31/00') michael@0: [ ] // - numSlashes is the number of '/' characters in the URL up to the site name michael@0: [ ] // (should not change unless you move the WebSites folder) michael@0: [ ] // michael@0: [ ] STRING strPerfToolsDrive = "s:" michael@0: [ ] STRING strViewerDrive = "d:" michael@0: [ ] STRING strURLPath = "s:\Mozilla\Tools\performance\layout\40-url.txt" michael@0: [ ] STRING strPerfToolsDir = "\Mozilla\Tools\Performance\layout" michael@0: [ ] STRING strBuildBaseDir = "\Moz-0225" michael@0: [ ] STRING strMilestoneOrPull = "Daily:022500 " michael@0: [ ] INTEGER numSlashes = 10 michael@0: [ ] INTEGER sleepBetweenSites = 5 michael@0: [ ] michael@0: [ ] STRING strViewerDir = strBuildBaseDir + "\bin" michael@0: [ ] HFILE inputFile michael@0: [ ] STRING sLine michael@0: [ ] STRING quotedURL michael@0: [ ] STRING logFile = "" michael@0: [ ] STRING site michael@0: [ ] INTEGER NumOfSites = 0 michael@0: [ ] STRING strPerfToolsDriveCmd = strPerfToolsDrive + " " michael@0: [ ] STRING strViewerDriveCmd = strViewerDrive + " " michael@0: [ ] STRING strBuildIDBase = strViewerDrive + strBuildBaseDir michael@0: [ ] STRING strLogPath = strPerfToolsDrive + strPerfToolsDir + "\logs" michael@0: [ ] michael@0: [ ] // make the logs directory (in case it does note exist already) michael@0: [+] if ( !SYS_DirExists( strLogPath ) ) michael@0: [ ] SYS_MakeDir( strLogPath ) michael@0: [ ] // remove any ABORT.TXT file that may be around michael@0: [+] if ( SYS_FileExists( strPerfToolsDrive + strPerfToolsDir + "\abort.txt" ) ) michael@0: [ ] SYS_RemoveFile( strPerfToolsDrive + strPerfToolsDir + "\abort.txt" ) michael@0: [ ] // Copy the history file in case there are problems michael@0: [-] if( SYS_FileExists( strPerfToolsDrive + strPerfToolsDir + "\history.txt" ) ) michael@0: [ ] SYS_CopyFile( strPerfToolsDrive + strPerfToolsDir + "\History.txt", strPerfToolsDrive + strPerfToolsDir + "\History_prev.txt" ) michael@0: [ ] // michael@0: [ ] // Start processing michael@0: [ ] // michael@0: [ ] inputFile = FileOpen (strURLPath, FM_READ) michael@0: [ ] CommandPrompt.Invoke () michael@0: [ ] sleep (2) michael@0: [ ] // move to the PerfTools directory michael@0: [ ] CommandPrompt.TypeKeys (strPerfToolsDriveCmd) michael@0: [ ] CommandPrompt.TypeKeys ("cd " + strPerfToolsDir + " ") michael@0: [ ] // process the page-header michael@0: [ ] CommandPrompt.TypeKeys ("perl " + strPerfToolsDrive + strPerfToolsDir +"\Header.pl {strBuildIDBase} {strMilestoneOrPull} ") michael@0: [ ] sleep (1) michael@0: [ ] // go through each URI and process it michael@0: [-] while (FileReadLine (inputFile, sLine)) michael@0: [ ] CommandPrompt.SetActive () michael@0: [ ] site = GetField (sLine, '/', numSlashes) michael@0: [ ] logFile = site + "-log.txt" michael@0: [ ] logFile = strLogPath + "\" + logFile michael@0: [ ] CommandPrompt.TypeKeys (strViewerDrive + strViewerDir + "\viewer > {logFile}") michael@0: [ ] sleep (5) michael@0: [ ] Raptor.SetActive () michael@0: [ ] Raptor.TextField1.SetText (sLine) michael@0: [ ] Raptor.TextField1.TypeKeys ("") michael@0: [ ] sleep (sleepBetweenSites) michael@0: [-] if Raptor.Exists () michael@0: [ ] Raptor.SetActive () michael@0: [ ] Raptor.Close () michael@0: [+] if RaptorSecondWindow.Exists () michael@0: [ ] RaptorSecondWindow.SetActive () michael@0: [ ] RaptorSecondWindow.Close () michael@0: [ ] CommandPrompt.SetActive () michael@0: [ ] CommandPrompt.TypeKeys( "" ) michael@0: [ ] NumOfSites = NumOfSites + 1 michael@0: [ ] quotedURL = """" + sLine + """" michael@0: [ ] CommandPrompt.TypeKeys ("perl "+ strPerfToolsDrive + strPerfToolsDir + "\AverageTable2.pl {site} {logFile} {NumOfSites} {strBuildIDBase} {quotedURL} ") michael@0: [ ] sleep (2) michael@0: [-] if ( SYS_FileExists( strPerfToolsDrive + strPerfToolsDir + "\abort.txt" ) ) michael@0: [ ] break michael@0: [ ] CommandPrompt.TypeKeys ("perl "+ strPerfToolsDrive + strPerfToolsDir + "\Footer.pl {strBuildIDBase} {strMilestoneOrPull} ") michael@0: [ ] sleep (1) michael@0: [ ] CommandPrompt.Close()