1
/* Gearman server and library
2
* Copyright (C) 2008 Brian Aker, Eric Day
5
* Use and distribution licensed under the BSD license. See
6
* the COPYING file in the parent directory for full text.
10
#include <libtest/test.hpp>
12
using namespace libtest;
20
#include <libgearman/gearman.h>
22
#include <tests/basic.h>
23
#include <tests/context.h>
25
#include <tests/ports.h>
27
#ifndef __INTEL_COMPILER
28
#pragma GCC diagnostic ignored "-Wold-style-cast"
31
static test_return_t gearmand_basic_option_test(void *)
33
const char *args[]= { "--check-args",
34
"--queue=libtokyocabinet",
35
"--libtokyocabinet-file=var/tmp/gearman_basic.tcb",
36
"--libtokyocabinet-optimize",
39
unlink("var/tmp/gearman.tcb");
40
test_compare(EXIT_SUCCESS, exec_cmdline(gearmand_binary(), args, true));
45
static test_return_t collection_init(void *object)
47
const char *argv[]= { "test_gearmand",
48
"--libtokyocabinet-file=var/tmp/gearman.tcb",
49
"--queue-type=libtokyocabinet",
52
unlink("var/tmp/gearman.tcb");
54
Context *test= (Context *)object;
57
test_truth(test->initialize(3, argv));
62
static test_return_t collection_cleanup(void *object)
64
Context *test= (Context *)object;
66
unlink("var/tmp/gearman.tcb");
72
static void *world_create(server_startup_st& servers, test_return_t& error)
74
if (HAVE_LIBTOKYOCABINET == 0)
80
Context *test= new Context(TOKYOCABINET_TEST_PORT, servers);
83
error= TEST_MEMORY_ALLOCATION_FAILURE;
86
unlink("var/tmp/gearman.tcb");
91
static bool world_destroy(void *object)
93
Context *test= (Context *)object;
95
unlink("var/tmp/gearman.tcb");
101
test_st gearmand_basic_option_tests[] ={
102
{"--libtokyocabinet-file=var/tmp/gearman_basic.tcb --libtokyocabinet-optimize", 0, gearmand_basic_option_test },
108
{"gearman_client_echo()", 0, client_echo_test },
109
{"gearman_client_echo() fail", 0, client_echo_fail_test },
110
{"gearman_worker_echo()", 0, worker_echo_test },
111
{"clean", 0, queue_clean },
112
{"add", 0, queue_add },
113
{"worker", 0, queue_worker },
117
collection_st collection[] ={
118
{"gearmand options", 0, 0, gearmand_basic_option_tests},
119
{"tokyocabinet queue", collection_init, collection_cleanup, tests},
123
void get_world(Framework *world)
125
world->collections= collection;
126
world->_create= world_create;
127
world->_destroy= world_destroy;