1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*
* Copyright (C) 2011-2013 Karlsruhe Institute of Technology
*
* This file is part of Ufo.
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string.h>
#include <ufo.h>
#include <zmq.h>
#include "test-suite.h"
typedef struct {
UfoDaemon *daemon;
UfoConfig *config;
UfoRemoteNode *remote_node;
} Fixture;
static void
setup (Fixture *fixture, gconstpointer data)
{
gchar *addr = g_strdup ("tcp://127.0.0.1:5555");
fixture->config = ufo_config_new ();
fixture->daemon = ufo_daemon_new (fixture->config, addr);
ufo_daemon_start (fixture->daemon);
fixture->remote_node = (UfoRemoteNode *) ufo_remote_node_new (addr);
}
static void
teardown (Fixture *fixture, gconstpointer data)
{
g_object_unref (fixture->remote_node);
ufo_daemon_stop (fixture->daemon);
g_object_unref (fixture->daemon);
}
static void
test_remote_node_get_num_cpus (Fixture *fixture,
gconstpointer unused)
{
guint n_gpus = ufo_remote_node_get_num_gpus (fixture->remote_node);
g_debug ("Found %d number of GPUs at remotenode", n_gpus);
g_assert (n_gpus > 0);
}
void
test_add_remote_node (void)
{
g_test_add ("/remotenode/get_num_cpus",
Fixture, NULL,
setup, test_remote_node_get_num_cpus, teardown);
}
|