Merge branch 'testing_header' into release-1.0GA
This commit is contained in:
@ -25,6 +25,7 @@ configure_file(${CMAKE_SOURCE_DIR}/server/include/version.h.in ${CMAKE_BINARY_DI
|
|||||||
configure_file(${CMAKE_SOURCE_DIR}/maxscale.conf.in ${CMAKE_BINARY_DIR}/maxscale.conf.prep @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/maxscale.conf.in ${CMAKE_BINARY_DIR}/maxscale.conf.prep @ONLY)
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/etc/init.d/maxscale.in ${CMAKE_BINARY_DIR}/etc/init.d/maxscale.prep @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/etc/init.d/maxscale.in ${CMAKE_BINARY_DIR}/etc/init.d/maxscale.prep @ONLY)
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/etc/ubuntu/init.d/maxscale.in ${CMAKE_BINARY_DIR}/etc/ubuntu/init.d/maxscale.prep @ONLY)
|
configure_file(${CMAKE_SOURCE_DIR}/etc/ubuntu/init.d/maxscale.in ${CMAKE_BINARY_DIR}/etc/ubuntu/init.d/maxscale.prep @ONLY)
|
||||||
|
configure_file(${CMAKE_SOURCE_DIR}/server/test/maxscale_test.h.in ${CMAKE_BINARY_DIR}/server/include/maxscale_test.h)
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-Wall -fPIC")
|
set(CMAKE_C_FLAGS "-Wall -fPIC")
|
||||||
|
|||||||
@ -117,7 +117,7 @@ int skygw_log_rotate(logfile_id_t id);
|
|||||||
int skygw_log_write_flush(logfile_id_t id, const char* format, ...);
|
int skygw_log_write_flush(logfile_id_t id, const char* format, ...);
|
||||||
int skygw_log_enable(logfile_id_t id);
|
int skygw_log_enable(logfile_id_t id);
|
||||||
int skygw_log_disable(logfile_id_t id);
|
int skygw_log_disable(logfile_id_t id);
|
||||||
|
void skygw_log_sync_all(void);
|
||||||
|
|
||||||
EXTERN_C_BLOCK_END
|
EXTERN_C_BLOCK_END
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ add_test(TestBuffer test_buffer)
|
|||||||
add_test(TestDCB test_dcb)
|
add_test(TestDCB test_dcb)
|
||||||
add_test(TestModutil test_modutil)
|
add_test(TestModutil test_modutil)
|
||||||
add_test(TestPoll test_poll)
|
add_test(TestPoll test_poll)
|
||||||
add_test(TestService test_service)
|
add_test(TestService /bin/sh -c " MAXSCALE_HOME=${CMAKE_BINARY_DIR} && ${CMAKE_CURRENT_BINAR_DIR}/test_service")
|
||||||
add_test(TestServer test_server)
|
add_test(TestServer test_server)
|
||||||
add_test(TestUsers test_users)
|
add_test(TestUsers test_users)
|
||||||
add_test(TestAdminUsers test_adminusers)
|
add_test(TestAdminUsers test_adminusers)
|
||||||
|
|||||||
@ -51,7 +51,7 @@ int result;
|
|||||||
"testpoll : Initialise the polling system.");
|
"testpoll : Initialise the polling system.");
|
||||||
poll_init();
|
poll_init();
|
||||||
ss_dfprintf(stderr, "\t..done\nAdd a DCB");
|
ss_dfprintf(stderr, "\t..done\nAdd a DCB");
|
||||||
dcb = dcb_alloc(DCB_ROLE_SERVICE_LISTENER);
|
dcb = dcb_alloc(DCB_ROLE_REQUEST_HANDLER);
|
||||||
|
|
||||||
if(dcb == NULL){
|
if(dcb == NULL){
|
||||||
ss_dfprintf(stderr, "\nError on function call: dcb_alloc() returned NULL.\n");
|
ss_dfprintf(stderr, "\nError on function call: dcb_alloc() returned NULL.\n");
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <maxscale_test.h>
|
||||||
#include <service.h>
|
#include <service.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,15 +42,27 @@ test1()
|
|||||||
{
|
{
|
||||||
SERVICE *service;
|
SERVICE *service;
|
||||||
int result;
|
int result;
|
||||||
|
int argc = 3;
|
||||||
|
char buffer[1024];
|
||||||
|
sprintf(buffer,"%s",TEST_LOG_DIR);
|
||||||
|
char* argv[] = {
|
||||||
|
"log_manager",
|
||||||
|
"-j",
|
||||||
|
buffer,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
skygw_logmanager_init(argc,argv);
|
||||||
|
|
||||||
/* Service tests */
|
/* Service tests */
|
||||||
ss_dfprintf(stderr,
|
ss_dfprintf(stderr,
|
||||||
"testservice : creating service called MyService with router nonexistent");
|
"testservice : creating service called MyService with router nonexistent");
|
||||||
service = service_alloc("MyService", "non-existent");
|
service = service_alloc("MyService", "non-existent");
|
||||||
|
skygw_log_sync_all();
|
||||||
ss_info_dassert(NULL == service, "New service with invalid router should be null");
|
ss_info_dassert(NULL == service, "New service with invalid router should be null");
|
||||||
ss_info_dassert(0 == service_isvalid(service), "Service must not be valid after incorrect creation");
|
ss_info_dassert(0 == service_isvalid(service), "Service must not be valid after incorrect creation");
|
||||||
ss_dfprintf(stderr, "\t..done\nValid service creation, router testroute.");
|
ss_dfprintf(stderr, "\t..done\nValid service creation, router testroute.");
|
||||||
service = service_alloc("MyService", "testroute");
|
service = service_alloc("MyService", "testroute");
|
||||||
|
skygw_log_sync_all();
|
||||||
ss_info_dassert(NULL != service, "New service with valid router must not be null");
|
ss_info_dassert(NULL != service, "New service with valid router must not be null");
|
||||||
ss_info_dassert(0 != service_isvalid(service), "Service must be valid after creation");
|
ss_info_dassert(0 != service_isvalid(service), "Service must be valid after creation");
|
||||||
ss_info_dassert(0 == strcmp("MyService", service_get_name(service)), "Service must have given name");
|
ss_info_dassert(0 == strcmp("MyService", service_get_name(service)), "Service must have given name");
|
||||||
@ -58,12 +70,16 @@ int result;
|
|||||||
ss_info_dassert(0 != serviceAddProtocol(service, "HTTPD", "localhost", 9876), "Add Protocol should succeed");
|
ss_info_dassert(0 != serviceAddProtocol(service, "HTTPD", "localhost", 9876), "Add Protocol should succeed");
|
||||||
ss_info_dassert(0 != serviceHasProtocol(service, "HTTPD", 9876), "Service should have new protocol as requested");
|
ss_info_dassert(0 != serviceHasProtocol(service, "HTTPD", 9876), "Service should have new protocol as requested");
|
||||||
serviceStartProtocol(service, "HTTPD", 9876);
|
serviceStartProtocol(service, "HTTPD", 9876);
|
||||||
|
skygw_log_sync_all();
|
||||||
ss_dfprintf(stderr, "\t..done\nStarting Service.");
|
ss_dfprintf(stderr, "\t..done\nStarting Service.");
|
||||||
result = serviceStart(service);
|
result = serviceStart(service);
|
||||||
|
skygw_log_sync_all();
|
||||||
ss_info_dassert(0 != result, "Start should succeed");
|
ss_info_dassert(0 != result, "Start should succeed");
|
||||||
result = serviceStop(service);
|
result = serviceStop(service);
|
||||||
|
skygw_log_sync_all();
|
||||||
ss_info_dassert(0 != result, "Stop should succeed");
|
ss_info_dassert(0 != result, "Stop should succeed");
|
||||||
result = serviceStartAll();
|
result = serviceStartAll();
|
||||||
|
skygw_log_sync_all();
|
||||||
ss_info_dassert(0 != result, "Start all should succeed");
|
ss_info_dassert(0 != result, "Start all should succeed");
|
||||||
|
|
||||||
ss_dfprintf(stderr, "\t..done\nStopping Service.");
|
ss_dfprintf(stderr, "\t..done\nStopping Service.");
|
||||||
|
|||||||
9
server/test/maxscale_test.h.in
Normal file
9
server/test/maxscale_test.h.in
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef MAXSCALE_TEST_H
|
||||||
|
#define MAXSCALE_TEST_H
|
||||||
|
#define TEST_DIR "${CMAKE_BINARY_DIR}"
|
||||||
|
#define TEST_LOG_DIR "${CMAKE_BINARY_DIR}/log"
|
||||||
|
#define TEST_BIN_DIR "${CMAKE_BINARY_DIR}/bin"
|
||||||
|
#define TEST_MOD_DIR "${CMAKE_BINARY_DIR}/modules"
|
||||||
|
#define TEST_LIB_DIR "${CMAKE_BINARY_DIR}/lib"
|
||||||
|
#define TEST_ETC_DIR "${CMAKE_BINARY_DIR}/etc"
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user