# HG changeset patch # User morphbr # Date 1172509238 0 # Node ID 58e22260f1afa2c2eb89d0c49b9f57391fb6f6d7 # Parent 39189137071eec1648baed969e0dcbbfc394fb14 [svn r382] Change scripts to compile tests diff -r 39189137071e -r 58e22260f1af gmyth/tests/compile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmyth/tests/compile Mon Feb 26 17:00:38 2007 +0000 @@ -0,0 +1,4 @@ +#!/bin/bash + +gcc -g $1 -o $2 `pkg-config --cflags --libs gmyth-0.1` + diff -r 39189137071e -r 58e22260f1af gmyth/tests/compile_test_http --- a/gmyth/tests/compile_test_http Fri Feb 23 23:19:27 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2 +0,0 @@ -gcc -g -o http gmyth_test_http.c `pkg-config --cflags --libs gmyth-0.1` - diff -r 39189137071e -r 58e22260f1af gmyth/tests/gmyth_test_transcode.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmyth/tests/gmyth_test_transcode.c Mon Feb 26 17:00:38 2007 +0000 @@ -0,0 +1,86 @@ +#include + +#include "gmyth_uri.h" +#include "gmyth_backendinfo.h" +#include "gmyth_socket.h" +#include "gmyth_query.h" + +static gboolean +backend_connect (GMythBackendInfo *backend_info) +{ + GMythSocket *socket = gmyth_socket_new (); + if (gmyth_socket_connect_to_backend (socket, + gmyth_backend_info_get_hostname (backend_info), + gmyth_backend_info_get_port (backend_info), TRUE) == TRUE) { + + + g_debug ("Backend socket connection success"); + return TRUE; + } else { + g_debug ("Connection failed"); + return FALSE; + } +} + +static gboolean +test_mysql_connection1 (GMythBackendInfo *backend_info) +{ + GMythQuery *query = gmyth_query_new (); + + if (gmyth_query_connect_with_timeout (query, backend_info, 3) == TRUE) { + g_debug ("Mysql connection success"); + return TRUE; + } else { + g_debug ("Mysql connection failed"); + return FALSE; + } + +} + + +int +main (int args, const char **argv) +{ + GMythBackendInfo *backend_info; + g_type_init (); + //g_thread_init (NULL); + + + backend_info = gmyth_backend_info_new (); + gmyth_backend_info_set_hostname (backend_info, "192.168.3.165"); + gmyth_backend_info_set_port (backend_info, 6543); + gmyth_backend_info_set_status_port (backend_info, 6544); + + + GMythSocket *socket = gmyth_socket_new (); + if (gmyth_socket_connect_to_backend (socket, + gmyth_backend_info_get_hostname (backend_info), + gmyth_backend_info_get_port (backend_info), TRUE) == TRUE) { + + + g_debug ("Backend socket connection success"); + } else { + g_debug ("Connection failed"); + } + + + GString *base_str = g_string_new (""); + GMythStringList *strlist = gmyth_string_list_new(); + + g_string_printf( base_str, "JOBQUEUE ADD JOB_TRANSCODE 1000 2006-12-07T12:30:00 JOB_USE_CUTLIST High Quality"); + gmyth_string_list_append_string (strlist, base_str ); + gmyth_socket_write_stringlist (socket, strlist ); + + gmyth_socket_read_stringlist (socket, strlist ); + + g_string_printf( base_str, "JOBQUEUE STOP JOB_TRANSCODE 1000 2006-12-07T12:30:00"); + gmyth_string_list_append_string (strlist, base_str ); + gmyth_socket_write_stringlist (socket, strlist ); + + gmyth_socket_read_stringlist (socket, strlist ); + +} + + + +