[svn r382] Change scripts to compile tests trunk
authormorphbr
Mon Feb 26 17:00:38 2007 +0000 (2007-02-26)
branchtrunk
changeset 37758e22260f1af
parent 376 39189137071e
child 378 8ec23602c4ea
[svn r382] Change scripts to compile tests
gmyth/tests/compile
gmyth/tests/compile_test_http
gmyth/tests/gmyth_test_transcode.c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gmyth/tests/compile	Mon Feb 26 17:00:38 2007 +0000
     1.3 @@ -0,0 +1,4 @@
     1.4 +#!/bin/bash
     1.5 +
     1.6 +gcc -g $1 -o $2 `pkg-config --cflags --libs gmyth-0.1`
     1.7 +
     2.1 --- a/gmyth/tests/compile_test_http	Fri Feb 23 23:19:27 2007 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,2 +0,0 @@
     2.4 -gcc -g -o http gmyth_test_http.c `pkg-config --cflags --libs gmyth-0.1`
     2.5 -
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/gmyth/tests/gmyth_test_transcode.c	Mon Feb 26 17:00:38 2007 +0000
     3.3 @@ -0,0 +1,86 @@
     3.4 +#include <glib-object.h>
     3.5 +
     3.6 +#include "gmyth_uri.h"
     3.7 +#include "gmyth_backendinfo.h"
     3.8 +#include "gmyth_socket.h"
     3.9 +#include "gmyth_query.h"
    3.10 +
    3.11 +static gboolean
    3.12 +backend_connect (GMythBackendInfo *backend_info)
    3.13 +{
    3.14 +    GMythSocket *socket = gmyth_socket_new ();
    3.15 +    if (gmyth_socket_connect_to_backend (socket,
    3.16 +	    gmyth_backend_info_get_hostname (backend_info),
    3.17 +	    gmyth_backend_info_get_port (backend_info), TRUE) == TRUE) {
    3.18 +
    3.19 +		    
    3.20 +	g_debug ("Backend socket connection success");
    3.21 +	return TRUE;
    3.22 +    } else {
    3.23 +	g_debug ("Connection failed");
    3.24 +	return FALSE;
    3.25 +    }
    3.26 +}
    3.27 +
    3.28 +static gboolean
    3.29 +test_mysql_connection1 (GMythBackendInfo *backend_info)
    3.30 +{
    3.31 +    GMythQuery *query = gmyth_query_new ();
    3.32 +
    3.33 +    if (gmyth_query_connect_with_timeout (query, backend_info, 3) == TRUE) {
    3.34 +	g_debug ("Mysql connection success");
    3.35 +	return TRUE;
    3.36 +    } else {
    3.37 +	g_debug ("Mysql connection failed");
    3.38 +	return FALSE;
    3.39 +    }
    3.40 +       
    3.41 +}
    3.42 +
    3.43 +
    3.44 +int
    3.45 +main (int args, const char **argv)
    3.46 +{
    3.47 +    GMythBackendInfo *backend_info;
    3.48 +    g_type_init ();
    3.49 +    //g_thread_init (NULL);
    3.50 +
    3.51 +   
    3.52 +    backend_info = gmyth_backend_info_new ();
    3.53 +    gmyth_backend_info_set_hostname (backend_info, "192.168.3.165");
    3.54 +    gmyth_backend_info_set_port (backend_info, 6543);
    3.55 +    gmyth_backend_info_set_status_port (backend_info, 6544);
    3.56 +
    3.57 +
    3.58 +    GMythSocket *socket = gmyth_socket_new ();
    3.59 +    if (gmyth_socket_connect_to_backend (socket,
    3.60 +            gmyth_backend_info_get_hostname (backend_info),
    3.61 +            gmyth_backend_info_get_port (backend_info), TRUE) == TRUE) {
    3.62 +
    3.63 +
    3.64 +        g_debug ("Backend socket connection success");
    3.65 +    } else {
    3.66 +        g_debug ("Connection failed");
    3.67 +    }
    3.68 +
    3.69 +
    3.70 +    GString *base_str = g_string_new ("");
    3.71 +    GMythStringList *strlist = gmyth_string_list_new();
    3.72 +
    3.73 +    g_string_printf( base_str, "JOBQUEUE ADD JOB_TRANSCODE 1000 2006-12-07T12:30:00 JOB_USE_CUTLIST High Quality");
    3.74 +    gmyth_string_list_append_string (strlist, base_str );
    3.75 +    gmyth_socket_write_stringlist (socket, strlist );
    3.76 +
    3.77 +    gmyth_socket_read_stringlist (socket, strlist );
    3.78 +
    3.79 +    g_string_printf( base_str, "JOBQUEUE STOP JOB_TRANSCODE 1000 2006-12-07T12:30:00");
    3.80 +    gmyth_string_list_append_string (strlist, base_str );
    3.81 +    gmyth_socket_write_stringlist (socket, strlist );
    3.82 +
    3.83 +    gmyth_socket_read_stringlist (socket, strlist );
    3.84 +
    3.85 +}
    3.86 +
    3.87 +
    3.88 +
    3.89 +