*** empty log message ***

svn path=/trunk/boinc/; revision=2241
This commit is contained in:
David Anderson 2003-09-03 23:54:11 +00:00
parent ca0f1cdc25
commit d81ec92e31
5 changed files with 51 additions and 22 deletions

View File

@ -26,8 +26,7 @@ function lookup_user_auth($auth) {
}
}
function join_query_string($s1, $s2)
{
function join_query_string($s1, $s2) {
if ($s1) {
if ($s2) {
return "$s1&s2";
@ -120,8 +119,7 @@ class SqlQueryString {
}
}
function build_sql_query()
{
function build_sql_query() {
$q = new SqlQueryString();
$q->addeq('id');
@ -151,8 +149,7 @@ function link_results($n, $mq, $query) {
}
}
function show_result_summary()
{
function show_result_summary() {
$server_state = array();
$outcome = array();
$client_state = array();
@ -175,6 +172,11 @@ function show_result_summary()
echo "<p>Query: <b>$main_query</b><p>\n";
$result = mysql_query($main_query);
$ntotal =0; // TODO: how to count $result?
$nvalid = 0; // for SUCCESS results
$ninvalid = 0;
$nfile_deleted = 0;
while ($res = mysql_fetch_object($result)) {
$server_state[$res->server_state] += 1;
$ntotal += 1;
@ -183,6 +185,17 @@ function show_result_summary()
if ($res->outcome == 3) {
$client_state[$res->client_state] += 1;
}
if ($res->outcome == 1) {
if ($res->validate_state == 1) {
$nvalid += 1;
}
if ($res->validate_state == 2) {
$ninvalid += 1;
}
if ($res->file_delete_state >= 1) {
$nfile_deleted +=1;
}
}
}
}
mysql_free_result($result);
@ -192,6 +205,7 @@ function show_result_summary()
echo "<td><h2>" . link_results("$ntotal results", $urlquery, '') . "</h2></td>";
echo "<td><h2>" . link_results("'Over' results", $urlquery, "server_state=5") . "</h2></td>";
echo "<td><h2>" . link_results("'Client error' results", $urlquery, "outcome=3") . "</h2></td>";
echo "<td><h2>Success results</h2></td>";
echo "</tr>";
echo "<tr valign=top>";
echo "<td><table border=2 cellpadding=4\n";
@ -206,7 +220,8 @@ function show_result_summary()
echo "<tr><th>Outcome</th><th># results</th></tr>\n";
for ($ro=0; $ro<6; $ro++) {
c_row2($outcome[$ro]?outcome_color($ro):'white', outcome_string($ro),
link_results($outcome[$ro], $urlquery, "outcome=$ro"));
link_results($outcome[$ro], $urlquery, "outcome=$ro")
);
}
echo "</table></td>";
@ -214,10 +229,17 @@ function show_result_summary()
echo "<tr><th>Client state</th><th># results</th></tr>\n";
for ($cs=1; $cs<6; $cs++) {
row2(client_state_string($cs),
link_results($client_state[$cs], $urlquery, "client_state=$cs"));
link_results($client_state[$cs], $urlquery, "client_state=$cs")
);
}
print "</td></table>";
print "</table>";
echo "</td></table>";
echo "<td>";
start_table();
row2("Valid", link_results($nvalid, $urlquery, "validate_state=1"));
row2("Invalid", link_results($ninvalid, $urlquery, "validate_state=2"));
row2("Files deleted", link_results($ninvalid, $urlquery, "file_delete_state= 1 or file_delete_state=2"));
end_table();
echo "</table>";
}

View File

@ -102,7 +102,7 @@ int scan_hex_data(FILE* f, DATA_BLOCK& x) {
// same, but read from buffer
//
int sscan_hex_data(char* p, DATA_BLOCK& x) {
static int sscan_hex_data(char* p, DATA_BLOCK& x) {
int m, n, nleft=x.len;
x.len = 0;
@ -113,7 +113,7 @@ int sscan_hex_data(char* p, DATA_BLOCK& x) {
nleft--;
if (nleft<0) {
fprintf(stderr, "sscan_hex_data: buffer overflow\n");
exit(1);
return ERR_BAD_HEX_FORMAT;
}
p += 2;
if (*p == '\n') p++;
@ -291,7 +291,8 @@ int verify_file2(
}
signature.data = signature_buf;
signature.len = sizeof(signature_buf);
sscan_hex_data(signature_text, signature);
retval = sscan_hex_data(signature_text, signature);
if (retval) return retval;
return verify_file(path, key, signature, answer);
}
@ -311,7 +312,8 @@ int verify_string(
n = strlen(md5_buf);
signature.data = signature_buf;
signature.len = sizeof(signature_buf);
sscan_hex_data(signature_text, signature);
retval = sscan_hex_data(signature_text, signature);
if (retval) return retval;
clear_signature.data = (unsigned char*)clear_buf;
clear_signature.len = 256;
retval = decrypt_public(key, signature, clear_signature);

View File

@ -67,3 +67,5 @@
#define ERR_GETRUSAGE -132
// getrusage failed
#define ERR_BENCHMARK_FAILED -133
#define ERR_BAD_HEX_FORMAT -134
// hex-format key data is bad

View File

@ -80,7 +80,7 @@ char* user_friendly_name=0;
char* exec_dir=0, *exec_files[10], *signature_files[10];
char *email_addr=0, *user_name=0, *authenticator=0;
char *global_prefs_file=0, *download_dir, *download_url;
char* code_sign_keyfile=0;
char code_sign_keyfile[256];
char *message=0, *message_priority=0;
void add_project() {
@ -357,10 +357,10 @@ int main(int argc, char** argv) {
if (retval) {
printf("no config file found\n");
} else {
strcpy(db_name, config.db_name);
strcpy(db_passwd, config.db_passwd);
strcpy(download_url, config.download_url);
strcpy(download_dir, config.download_dir);
db_name = config.db_name;
db_passwd = config.db_passwd;
download_url = config.download_url;
download_dir = config.download_dir;
sprintf(code_sign_keyfile, "%s/code_sign_private", config.key_dir);
}
@ -423,7 +423,7 @@ int main(int argc, char** argv) {
} else if (!strcmp(argv[i], "-message_priority")) {
message_priority = argv[++i];
} else if (!strcmp(argv[i], "-code_sign_keyfile")) {
code_sign_keyfile = argv[++i];
strcpy(code_sign_keyfile, argv[++i]);
}
}
retval = boinc_db_open(db_name, db_passwd);

View File

@ -53,10 +53,13 @@ add.py result (TODO) '''
import sys, os, getopt, md5, time
sys.path.append('../py/')
import database, db_mid
sys.path.append('../sched')
import database, db_mid, boinc_config
from util import *
database._connectp('quarl_test_upper_case','','')
config = boinc_config.BoincConfig('../../projects/client_test/config.xml').read()
database._connectp('boinc_client_test','','')
CREATE_TIME = ['?create_time', int(time.time())]