~ubuntu-branches/ubuntu/raring/gdis/raring-proposed

« back to all changes in this revision

Viewing changes to test.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Leidert (dale)
  • Date: 2009-04-06 17:12:18 UTC
  • mfrom: (3.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090406171218-uizoe126jrq09ytt
Tags: 0.90-1
* New upstream release 0.90.
* Acknowledge NMU (closes: #492994). Thanks to Neil Williams.

* makefile.debian: Upstream doesn't provide a Makefile to edit - so created
  our own.
* debian/compat: Added and set to be 5.
* debian/control: Added Homepage, Vcs* and DM-Upload-Allowed fields.
  (Maintainer): Set to the debichem team with approval by Noèl.
  (Uploaders): Added myself.
  (Build-Depends): Increased debhelper version to 5. Removed glutg3-dev.
  Added dpatch.
  (Standards-Version): Bumped to 3.8.1.
  (Description): Removed homepage. Fixed a typo.
* debian/copyright: Updated, completed and adjusted.
* debian/dirs: Dropped useless file.
* debian/docs: Renamed to debian/gdis.docs.
* debian/menu: Renamed to debian/gdis.menu.
  (section): Fixed accordingly to policy.
* debian/gdis.1: Just some formatting changes.
* debian/gdis.desktop: Added file (with small fixes) provided by Phill Bull
  (LP: #111353).
* debian/gdis.install: Added.
* debian/rules: Cleaned. Installation is now done by dh_install. Make sure,
  the CVS directory is not copied. Added dh_desktop call.
* debian/source.lintian-overrides: makefile.debian is created for Debian but
  lives outside debian/.
* debian/watch: Added.
* debian/README.build: Dropped.
* debian/README.source: Added to be compliant to the policy v3.8.
* debian/patches/Debian_make.dpatch: Added.
  - gdis.h (ELEM_FILE): Moved fix for gdis.elemts path (#399132) to this
    patch.
* debian/patches/00list: Added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (C) 2003 by Sean David Fleming
 
3
 
 
4
sean@ivec.org
 
5
 
 
6
This program is free software; you can redistribute it and/or
 
7
modify it under the terms of the GNU General Public License
 
8
as published by the Free Software Foundation; either version 2
 
9
of the License, or (at your option) any later version.
 
10
 
 
11
This program is distributed in the hope that it will be useful,
 
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
GNU General Public License for more details.
 
15
 
 
16
You should have received a copy of the GNU General Public License
 
17
along with this program; if not, write to the Free Software
 
18
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
19
 
 
20
The GNU GPL can also be found at http://www.gnu.org
 
21
*/
 
22
 
 
23
#include <stdio.h>
 
24
#include <stdlib.h>
 
25
 
 
26
#include "gdis.h"
 
27
#include "grid.h"
 
28
#include "parse.h"
 
29
#ifdef WITH_GRISU
 
30
#include "grisu_client.h"
 
31
#endif
 
32
 
 
33
/************************************************/
 
34
/* print list consisting of pointers to strings */
 
35
/************************************************/
 
36
void test_print_text_list(GSList *list)
 
37
{
 
38
GSList *item;
 
39
 
 
40
for (item=list ; item ; item=g_slist_next(item))
 
41
  {
 
42
  printf("[%s]\n", (gchar *) item->data);
 
43
  }
 
44
}
 
45
 
 
46
/*******************************/
 
47
/* run tests on grisu WS calls */
 
48
/*******************************/
 
49
void test_grisu(void)
 
50
{
 
51
#ifdef WITH_GRISU
 
52
gint passed=0, total=0;
 
53
GSList *list;
 
54
gchar *password, *name;
 
55
gchar *contents;
 
56
gsize length;
 
57
gchar *username, buff[999];
 
58
gchar *dir;
 
59
 
 
60
printf("testing grisu ...\n");
 
61
 
 
62
grisu_job_names();
 
63
 
 
64
//printf("\nTEST - EXPERIMENTAL\n");
 
65
 
 
66
//grisu_df();
 
67
//grisu_file_list("gsiftp://ngdata.ivec.org/store/ng03/grid-admin/C_AU_O_APACGrid_OU_iVEC_CN_Sean_Fleming/");
 
68
 
 
69
/* NEW - uploading & downloading works */
 
70
/* TODO - stress testing / binary content */
 
71
//grisu_file_download("gsiftp://ngdata.ivec.org/store/ng03/grid-admin/C_AU_O_APACGrid_OU_iVEC_CN_Sean_Fleming/gibb_best3.got", "/home/sean/prog/gdis/gotcha.got");
 
72
 
 
73
 
 
74
//grisu_file_upload("/home/sean/prog/gdis/gdis_manual.txt", "gsiftp://ngdata.ivec.org/store/ng03/grid-admin/C_AU_O_APACGrid_OU_iVEC_CN_Sean_Fleming/upload.txt");
 
75
//grisu_file_download("gsiftp://ngdata.ivec.org/store/ng03/grid-admin/C_AU_O_APACGrid_OU_iVEC_CN_Sean_Fleming/upload.txt", "TODO_use_this");
 
76
 
 
77
/*
 
78
printf("URL for directory listing: ");
 
79
if (fgets(buff, sizeof(buff), stdin) != NULL)
 
80
  dir = parse_strip_newline(buff);
 
81
else
 
82
  {
 
83
  printf("Input error.\n");
 
84
  return;
 
85
  }
 
86
grisu_file_list(dir);
 
87
*/
 
88
 
 
89
/* NEW - job submission now works!!! */
 
90
/*
 
91
if (g_file_get_contents("test.xml", &contents, &length, NULL))
 
92
  {
 
93
grisu_auth_set(TRUE);
 
94
name = grisu_job_submit(contents);
 
95
  }
 
96
else
 
97
  {
 
98
printf("Failed to open sample job description XML file in cwd.\n");
 
99
name = NULL;
 
100
  }
 
101
 
 
102
if (name)
 
103
  printf("submitted [%s] : success!\n", name);
 
104
else
 
105
  printf("failed.\n");
 
106
 
 
107
grisu_ps();
 
108
*/
 
109
 
 
110
return;
 
111
 
 
112
 
 
113
grisu_auth_set(FALSE);
 
114
total++;
 
115
printf("\nTEST 1 - Submit location query (no auth)\n");
 
116
list = grisu_submit_find("mrbayes");
 
117
if (list)
 
118
  {
 
119
  test_print_text_list(list);
 
120
  passed++;
 
121
  }
 
122
 
 
123
total++;
 
124
printf("\nTEST 2 - Submit location query (with auth)\n");
 
125
grisu_auth_set(TRUE);
 
126
list = grisu_submit_find("mrbayes");
 
127
if (list)
 
128
  {
 
129
  test_print_text_list(list);
 
130
  passed++;
 
131
  }
 
132
 
 
133
total++;
 
134
printf("\nTEST 3 - Retrieve available VOs\n");
 
135
grisu_auth_set(TRUE);
 
136
list = grisu_fqans_get();
 
137
if (list)
 
138
  {
 
139
  test_print_text_list(list);
 
140
  passed++;
 
141
  }
 
142
 
 
143
/* TODO - upload/download file */
 
144
/*
 
145
grisu_auth_set(TRUE);
 
146
name = grisu_job_submit("rubbish");
 
147
*/
 
148
 
 
149
/*
 
150
grisu_auth_set(TRUE);
 
151
grisu_absolute_job_dir("gok", "ng2.ivec.org", "/ARCS/Startup");
 
152
*/
 
153
 
 
154
/* TODO - submit job */
 
155
/*
 
156
grisu_upload("home/sean/prog/gdis/README.grisu", "grisu-jobs-dir/gok/test.txt");
 
157
*/
 
158
 
 
159
printf("grisu tests passed: %d/%d\n", passed, total);
 
160
 
 
161
#else
 
162
printf("grisu component not compiled.\n");
 
163
#endif
 
164
}
 
165
 
 
166
void test_run(gchar *name)
 
167
{
 
168
 
 
169
#ifdef WITH_GRISU
 
170
if (g_ascii_strncasecmp(name, "gri", 3) == 0)
 
171
  {
 
172
/* DEBUG - re-use existing (already uploaded) proxy */
 
173
/*
 
174
printf("Enter your MYPROXY credential username: ");
 
175
if (fgets(buff, sizeof(buff), stdin) != NULL)
 
176
  {
 
177
  username = parse_strip_newline(buff);
 
178
  }
 
179
else
 
180
  {
 
181
  printf("Input error.\n");
 
182
  return;
 
183
  }
 
184
printf("Enter your MYPROXY credential password: ");
 
185
password = parse_getline_hidden();
 
186
grisu_keypair_set(username, password);
 
187
*/
 
188
 
 
189
grisu_keypair_set("someguy", "qetuo135");
 
190
grid_setup();
 
191
 
 
192
/* cmd line prompt for passwd ... */
 
193
/*
 
194
printf("Please enter your GRID passphrase: ");
 
195
password = parse_getline_hidden();
 
196
grisu_keypair_set(NULL, password);
 
197
grid_connect(GRID_LOCALPROXY);
 
198
g_free(password);
 
199
*/
 
200
 
 
201
  test_grisu();
 
202
  grisu_stop();
 
203
  }
 
204
#endif
 
205
 
 
206
}
 
207
 
 
208