2 # hacked together by bsharma@netscape.com and phillip@netscape.com
6 #some vars that depend on the location of apprunner.
7 #apprunner_bin should be the only thing you need to change to get this to work...
8 $apprunner_bin = '/u/phillip/seamonkey/linux/package';
9 #$apprunner_bin = '/build/mozilla/dist/bin';
11 $apprunner = "$apprunner_bin/apprunner";
12 $apprunner_samples = "$apprunner_bin/res/samples";
13 $apprunner_log = '/tmp/apprunnerlog.txt';
14 $mail_log = '/tmp/maillog.txt';
15 $test_duration = 30; # seconds
17 # we fork and launch apprunner in a few spots around here, so let's define
19 $ENV{'MOZILLA_FIVE_HOME'}="$apprunner_bin";
20 $ENV{'LD_LIBRARY_PATH'}="/usr/lib:/lib:$apprunner_bin";
21 # here are a few subroutines we use:
22 # get_build_date - look through navigator.xul for the build id (1999-04-18-08)
24 # get_date - returns a preformatted string containing the date and time
25 # launch_apprunner - takes a parameter (or the null string)
29 open (REPORT_FILE
, '>report.html');
30 REPORT_FILE
->autoflush();
31 print (REPORT_FILE
"<HTML><HEAD><TITLE>Smoke Test Report File </TITLE></HEAD>\n");
32 print (REPORT_FILE
"<BODY>\n");
33 print (REPORT_FILE
"<H1><CENTER> Seamonkey Build Smoke Tests Report\n");
34 print (REPORT_FILE
"<BR>Linux</CENTER></H1><B><CENTER>\n");
35 print (REPORT_FILE
"<BR>\n");
36 print (REPORT_FILE
&get_date
);
37 print (REPORT_FILE
"</B></CENTER>\n <BR>\n <B><CENTER>\n Build Number: " . &get_build_date
. " </CENTER></B>\n <BR>\n <HR>\n");
42 # pessimistically assume that this will fail
43 # just look for the string loaded successfully in the log file
45 open (APP_LOG_FILE
, "< $apprunner_log");
46 while (<APP_LOG_FILE
>)
49 if (/loaded successfully/)
50 { #since the start page was loaded successfully,
51 #we can say that Apprunner loaded successfully
57 print (REPORT_FILE
"<B><Center>\n");
58 # load_result tells you if the test failed
59 print (REPORT_FILE
"Apprunner $load_result Loaded Successfully");
61 print (REPORT_FILE
"</B></Center>\n");
62 print (REPORT_FILE
"<BR>\n");
64 print (REPORT_FILE
"<HR>\n");
65 print (REPORT_FILE
"<B><CENTER><font size=+2>\n");
66 print (REPORT_FILE
"Loading Sites Results");
67 print (REPORT_FILE
"</font></CENTER></B>\n");
69 @url_list = ("http://www.yahoo.com",
70 "http://www.netscape.com",
71 "http://www.excite.com",
72 "http://www.microsoft.com",
73 "http://www.city.net",
74 "http://www.mirabilis.com",
75 "http://www.pathfinder.com/welcome",
76 "http://www.warnerbros.com/home_moz3_day.html",
78 "http://www.usatoday.com",
79 "http://www.disney.go.com",
80 "http://www.hotwired.com",
81 "http://www.hotbot.com",
82 "http://slip/projects/marvin/bft/browser/bft_frame_index.html",
83 "file://$apprunner_samples/test6.html",
84 "http://slip/projects/marvin/bft/browser/bft_browser_applet.html",
85 "http://www.abcnews.com",
86 "http://slip/projects/marvin/bft/browser/bft_browser_imagemap.html",
87 "file://$apprunner_samples/test2.html",
88 "file://$apprunner_samples/test13.html",
89 "file://$apprunner_samples/test13.html",
90 "file://$apprunner_samples/test2.html",
91 "http://slip/projects/marvin/bft/browser/bft_browser_html_mix3.html",
92 "http://slip/projects/marvin/bft/browser/bft_browser_link.html");
97 # launch apprunner once for every browser test in the url_list
98 ################################################################################
99 for ($i = 0; $i < $#url_list; $i ++)
101 print " @url_list[$i]\n";
102 &launch_apprunner
(@url_list[$i]);
103 $load_result = "NOT";
104 open (APP_LOG_FILE
, "< $apprunner_log");
105 while (<APP_LOG_FILE
>)
108 #if (/@url_list[$i]/ and /loaded successfully/)
109 if (/loaded successfully/)
114 # print in red if there's a failure
115 if ( $load_result eq "NOT" ) {
116 $style = "style='color: red;'";
117 } else { $style = ""; }
118 print (REPORT_FILE
"<B $style>\n<a href=\"@url_list[$i]\">@url_list[$i]</a> $load_result Loaded Successfully</B>\n<BR>\n");
120 close (APP_LOG_FILE
);
122 # now it's time to check mail
124 ################################################################################
126 #open (LOG_FILE, "< $mail_log");
130 # $load_result = "NOT";
131 # if (/Mailbox Done/){
134 # print (REPORT_FILE "<B>\n$load_result</B>\n<BR>\n");
137 # close the report, and we're done!
138 ################################################################################
139 print (REPORT_FILE
"<HR>\n<BR>\n<BR>\n<B><CENTER>\n");
140 print (REPORT_FILE
&get_date
());
141 print (REPORT_FILE
"</CENTER></B>\n");
142 print (REPORT_FILE
"<BR>\n<BR>\n<HR>\n<BR>\n<BR>\n");
143 print (REPORT_FILE
"</BODY>\n");
144 print (REPORT_FILE
"</HTML>\n");
148 ################################################################################
149 ################################################################################
150 ##### Subroutines go here . . . ################################################
151 ################################################################################
152 ################################################################################
154 open (XUL_FILE
, "< $apprunner_samples/navigator.xul");
162 @LineList = split / /;
163 $BuildNo = $LineList[4];
171 sub launch_apprunner
{
172 my $url = shift || "";
174 # parent will wait $test_duration seconds, then kill kid.
175 sleep ( $test_duration );
176 system("killall -9 apprunner");
179 #child runs aprrunner to see if it even launches.
180 print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
182 exec "$apprunner > $apprunner_log 2>&1";
184 exec "$apprunner -url $url > $apprunner_log 2>&1";
186 print "exec error: this line of code should never be reached\n" and die;
191 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)= localtime;
202 return sprintf "%s %02d/%02d/19%02d %02d:%02d:%02d" ,$weekday{$wday},$mon,$mday,$year,$hour,$min,$sec;