Bug 451504 js/src/jslock.cpp failed to compile on Solaris x86 r=igor
[wine-gecko.git] / tools / tests / SmokeTestLinux-1.pl
blob35a1f3ae8d2b2503150975a00ee2ad3cf9274625
1 #! /usr/bin/perl
2 # hacked together by bsharma@netscape.com and phillip@netscape.com
3 use Cwd;
4 use FileHandle;
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
18 # this just once:
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)
23 # returns the string
24 # get_date - returns a preformatted string containing the date and time
25 # launch_apprunner - takes a parameter (or the null string)
28 # so it begins
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");
40 &launch_apprunner();
42 # pessimistically assume that this will fail
43 # just look for the string loaded successfully in the log file
44 $load_result = "NOT";
45 open (APP_LOG_FILE, "< $apprunner_log");
46 while (<APP_LOG_FILE>)
48 chop;
49 if (/loaded successfully/)
50 { #since the start page was loaded successfully,
51 #we can say that Apprunner loaded successfully
52 $load_result = "";
55 close (APP_LOG_FILE);
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",
77 "http://www.cnn.com",
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");
94 my $i;
95 my $style;
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>)
107 chop;
108 #if (/@url_list[$i]/ and /loaded successfully/)
109 if (/loaded successfully/)
111 $load_result = "";
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
123 # not yet functional
124 ################################################################################
126 #open (LOG_FILE, "< $mail_log");
127 #while (<LOG_FILE>)
129 # chop;
130 # $load_result = "NOT";
131 # if (/Mailbox Done/){
132 # $load_result = "";
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");
145 close (REPORT_FILE);
148 ################################################################################
149 ################################################################################
150 ##### Subroutines go here . . . ################################################
151 ################################################################################
152 ################################################################################
153 sub get_build_date {
154 open (XUL_FILE, "< $apprunner_samples/navigator.xul");
155 $BuildNo = "";
156 $LineList;
157 while (<XUL_FILE>)
159 chop;
160 if (/Build ID/)
162 @LineList = split / /;
163 $BuildNo = $LineList[4];
166 close( XUL_FILE );
167 $BuildNo =~ s/"/ /g;
168 return $BuildNo;
171 sub launch_apprunner{
172 my $url = shift || "";
173 if ( $pid = fork ) {
174 # parent will wait $test_duration seconds, then kill kid.
175 sleep ( $test_duration );
176 system("killall -9 apprunner");
178 else {
179 #child runs aprrunner to see if it even launches.
180 print "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
181 if ( $url eq "" ){
182 exec "$apprunner > $apprunner_log 2>&1";
183 } else {
184 exec "$apprunner -url $url > $apprunner_log 2>&1";
186 print "exec error: this line of code should never be reached\n" and die;
190 sub get_date {
191 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst)= localtime;
192 %weekday= (
193 "1", "Monday",
194 '2', 'Tuesday',
195 '3', 'Wednesday',
196 '4', 'Thursday',
197 '5', 'Friday',
198 '6', 'Saturday',
199 '7', 'Sunday',
201 $mon += 1;
202 return sprintf "%s %02d/%02d/19%02d %02d:%02d:%02d" ,$weekday{$wday},$mon,$mday,$year,$hour,$min,$sec;