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