xref: /netbsd-src/external/gpl3/gcc.old/dist/contrib/regression/GCC_Regression_Tester.wdgt/widget.html (revision 36ac495d2b3ea2b9d96377b2143ebfedac224b92)
1*36ac495dSmrg<!-- Get and update the GCC regression tester's web page.
2*36ac495dSmrg     Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
3*36ac495dSmrg
4*36ac495dSmrgThis file is part of GCC.
5*36ac495dSmrg
6*36ac495dSmrgGCC is free software; you can redistribute it and/or modify it under
7*36ac495dSmrgthe terms of the GNU General Public License as published by the Free
8*36ac495dSmrgSoftware Foundation; either version 3, or (at your option) any later
9*36ac495dSmrgversion.
10*36ac495dSmrg
11*36ac495dSmrgGCC is distributed in the hope that it will be useful, but WITHOUT ANY
12*36ac495dSmrgWARRANTY; without even the implied warranty of MERCHANTABILITY or
13*36ac495dSmrgFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14*36ac495dSmrgfor more details.
15*36ac495dSmrg
16*36ac495dSmrgYou should have received a copy of the GNU General Public License
17*36ac495dSmrgalong with GCC; see the file COPYING3.  If not see
18*36ac495dSmrg<http://www.gnu.org/licenses/>.  -->
19*36ac495dSmrg<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
20*36ac495dSmrg        "http://www.w3.org/TR/html4/strict.dtd">
21*36ac495dSmrg<head>
22*36ac495dSmrg<meta http-equiv="Content-Script-Type" content="text/javascript">
23*36ac495dSmrg<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
24*36ac495dSmrg<title>Regression Tester Status</title>
25*36ac495dSmrg<style type='text/css'>
26*36ac495dSmrgbody {
27*36ac495dSmrg	margin: 0px;
28*36ac495dSmrg	padding: 0px;
29*36ac495dSmrg}
30*36ac495dSmrgpre {
31*36ac495dSmrg	font-family: Monaco;
32*36ac495dSmrg	font-size: 9px;
33*36ac495dSmrg	margin: 0px;
34*36ac495dSmrg	padding: 1px 2px 1px 2px;
35*36ac495dSmrg	color: black;
36*36ac495dSmrg	background-color: white;
37*36ac495dSmrg	opacity: 0.8;
38*36ac495dSmrg}
39*36ac495dSmrg</style>
40*36ac495dSmrg<script type='text/javascript' defer>
41*36ac495dSmrg// A string representing NUM, with a leading zero if it would be 1 digit long
42*36ac495dSmrgfunction dig2 (num)
43*36ac495dSmrg{
44*36ac495dSmrg    var result = num.toString();
45*36ac495dSmrg    if (result.length == 1)
46*36ac495dSmrg	return '0' + result;
47*36ac495dSmrg    else
48*36ac495dSmrg	return result;
49*36ac495dSmrg}
50*36ac495dSmrg
51*36ac495dSmrg// Get DATE as a string in standard ISO format in UTC
52*36ac495dSmrgfunction getISO (date)
53*36ac495dSmrg{
54*36ac495dSmrg    return (date.getUTCFullYear().toString() + '-'
55*36ac495dSmrg	    + dig2 (date.getUTCMonth() + 1) + '-'
56*36ac495dSmrg	    + dig2 (date.getUTCDate()) + 'T'
57*36ac495dSmrg	    + dig2 (date.getUTCHours()) + ':'
58*36ac495dSmrg	    + dig2 (date.getUTCMinutes()) + 'Z');
59*36ac495dSmrg}
60*36ac495dSmrg
61*36ac495dSmrg// STR is a bunch of lines of the form '<key>: <date>' where <date> is in
62*36ac495dSmrg// standard ISO UTC format.  Return a Date object corresponding to KEY, or null
63*36ac495dSmrg// if none is found.
64*36ac495dSmrgfunction fromISO (str, key)
65*36ac495dSmrg{
66*36ac495dSmrg    var rx = new RegExp (key + ": (\\d+)-(\\d+)-(\\d+)T(\\d+):(\\d+):(\\d+)Z");
67*36ac495dSmrg    var match = rx.exec (str);
68*36ac495dSmrg    if (match == null || match.length != 7)
69*36ac495dSmrg	return null;
70*36ac495dSmrg    var date = new Date(0);
71*36ac495dSmrg    date.setUTCFullYear (match[1], match[2] - 1, match[3]);
72*36ac495dSmrg    date.setUTCHours (match[4], match[5], match[6], 0);
73*36ac495dSmrg    return date;
74*36ac495dSmrg}
75*36ac495dSmrg
76*36ac495dSmrg// Update the data
77*36ac495dSmrgfunction updateContents () {
78*36ac495dSmrg    var url = 'http://gcc.gnu.org/regtest/HEAD/status.txt';
79*36ac495dSmrg    if (document.URL && document.URL.substring (0,5) == 'http:') {
80*36ac495dSmrg	url = document.URL.replace ('widget.html','status.txt');
81*36ac495dSmrg    }
82*36ac495dSmrg    var xml_request = new XMLHttpRequest();
83*36ac495dSmrg
84*36ac495dSmrg    xml_request.onload = function(e)
85*36ac495dSmrg	{
86*36ac495dSmrg	    gotContents(e, xml_request);
87*36ac495dSmrg	}
88*36ac495dSmrg    xml_request.open("GET", url);
89*36ac495dSmrg    xml_request.setRequestHeader("Cache-Control", "max-age=30");
90*36ac495dSmrg    xml_request.send(null);
91*36ac495dSmrg}
92*36ac495dSmrg
93*36ac495dSmrgfunction gotContents (event, request) {
94*36ac495dSmrg    if (request.status != 200)
95*36ac495dSmrg        return;
96*36ac495dSmrg
97*36ac495dSmrg    if (! request.responseText)
98*36ac495dSmrg	return;
99*36ac495dSmrg
100*36ac495dSmrg    var txt = request.responseText;
101*36ac495dSmrg    var today = new Date();
102*36ac495dSmrg    var date_r = fromISO (txt, "Date");
103*36ac495dSmrg    var completed_r = fromISO (txt, "Test-Completed");
104*36ac495dSmrg    var now_test_r = fromISO (txt, "Now-Testing");
105*36ac495dSmrg    var eta = "";
106*36ac495dSmrg
107*36ac495dSmrg    if (date_r != null && completed_r != null && now_test_r != null)
108*36ac495dSmrg	{
109*36ac495dSmrg	    var eta_r = new Date (now_test_r.getTime()
110*36ac495dSmrg				  + completed_r.getTime() - date_r.getTime());
111*36ac495dSmrg	    eta = "ETA: " + getISO (eta_r) + '\n';
112*36ac495dSmrg	}
113*36ac495dSmrg
114*36ac495dSmrg    var val = txt + "Now: " + getISO (today) + '\n' + eta;
115*36ac495dSmrg    var contEl = document.getElementById ("contents");
116*36ac495dSmrg    contEl.removeChild(contEl.firstChild);
117*36ac495dSmrg    contEl.appendChild (document.createTextNode (val));
118*36ac495dSmrg}
119*36ac495dSmrg
120*36ac495dSmrgvar mainTimer = null;
121*36ac495dSmrg
122*36ac495dSmrgfunction myOnShow ()
123*36ac495dSmrg{
124*36ac495dSmrg    if (! mainTimer) {
125*36ac495dSmrg	mainTimer = setInterval (updateContents, 60000);
126*36ac495dSmrg    }
127*36ac495dSmrg    updateContents();
128*36ac495dSmrg}
129*36ac495dSmrg
130*36ac495dSmrgfunction myOnHide ()
131*36ac495dSmrg{
132*36ac495dSmrg    if (mainTimer) {
133*36ac495dSmrg	clearInterval (mainTimer);
134*36ac495dSmrg	mainTimer = null;
135*36ac495dSmrg    }
136*36ac495dSmrg}
137*36ac495dSmrg
138*36ac495dSmrgfunction myOnLoad ()
139*36ac495dSmrg{
140*36ac495dSmrg    if ( window.widget ) {
141*36ac495dSmrg	widget.onshow = myOnShow;
142*36ac495dSmrg	widget.onhide = myOnHide;
143*36ac495dSmrg    }
144*36ac495dSmrg    myOnShow();
145*36ac495dSmrg}
146*36ac495dSmrg</script>
147*36ac495dSmrg</head>
148*36ac495dSmrg
149*36ac495dSmrg<body onLoad='myOnLoad();'>
150*36ac495dSmrg<pre id="contents">Loading...</pre>
151*36ac495dSmrg</body>
152*36ac495dSmrg</html>
153