# HG changeset patch # User rosfran # Date 1177945460 -3600 # Node ID fb0bf39636d6261382e910555ee1dbbb8eec95cd # Parent 22964d32dcdb09852d0b2821aeb872b280f267f3 [svn r610] Changed some INCLUDES in the test scripts, added another test case. diff -r 22964d32dcdb -r fb0bf39636d6 gmyth/tests/Makefile.am --- a/gmyth/tests/Makefile.am Fri Apr 27 19:39:11 2007 +0100 +++ b/gmyth/tests/Makefile.am Mon Apr 30 16:04:20 2007 +0100 @@ -1,14 +1,14 @@ -INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src - LDADD = \ $(top_srcdir)/src/.libs/libgmyth.la -LDFLAGS = \ +AM_LDFLAGS = \ @GLIB_LIBS@ @GOBJECT_LIBS@ @GTHREAD_LIBS@ @LIBCURL_LIBS@ INCLUDES = \ -I$(top_srcdir) \ + -I$(top_builddir) \ -I$(top_srcdir)/src \ + -I$(top_builddir)/src \ $(MYSQL_CFLAGS) \ $(GLIB_CFLAGS) \ $(GOBJECT_CFLAGS) \ @@ -25,7 +25,8 @@ gmyth_test_vlc \ gmyth_test_livetv \ gmyth_test_http \ - gmyth_test_filetransfer + gmyth_test_filetransfer \ + gmyth_test_filelocal TESTS = \ test \ @@ -39,6 +40,7 @@ test_livetv.py \ test_http.py \ test_filetransfer.py \ + test_filelocal.py \ coverage.py TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) @@ -73,3 +75,6 @@ gmyth_test_filetransfer_SOURCES = \ gmyth_test_filetransfer.c +gmyth_test_filelocal_SOURCES = \ + gmyth_test_filelocal.c + diff -r 22964d32dcdb -r fb0bf39636d6 gmyth/tests/coverage.py --- a/gmyth/tests/coverage.py Fri Apr 27 19:39:11 2007 +0100 +++ b/gmyth/tests/coverage.py Mon Apr 30 16:04:20 2007 +0100 @@ -9,6 +9,7 @@ def build_dir(exe): t = get_gcda(exe) a = re.search("(/.*)/tests/*" ,t) + print "Tests build directory - %s" % a.groups()[0] return a.groups()[0] def gen_cov_info(build_dir): diff -r 22964d32dcdb -r fb0bf39636d6 gmyth/tests/gmyth_test_filelocal.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmyth/tests/gmyth_test_filelocal.c Mon Apr 30 16:04:20 2007 +0100 @@ -0,0 +1,91 @@ +#include + +#include "common.h" + +#include "gmyth_uri.h" +#include "gmyth_backendinfo.h" +#include "gmyth_file.h" +#include "gmyth_file_local.h" +#include "gmyth_common.h" + +#define URI_FILE_LOCAL_DEFAULT "myth://192.168.3.165:6543/" + +static gboolean +test_file_local_setup( gchar *uri ) { + GMythFileLocal *file = NULL; + gboolean ret = TRUE; + + if ( NULL == uri) + uri = g_strdup( URI_FILE_LOCAL_DEFAULT ); + + GMythURI *gmyth_uri = gmyth_uri_new_with_value( uri); + + GMythBackendInfo* backend_info = gmyth_backend_info_new_with_uri(uri); + + /* Check if the file is local to this specific client renderer, and tries to open + * a local connection + */ + if ( gmyth_uri_is_local_file(gmyth_uri)) { + g_debug( "Opening local file connection to download..."); + file = gmyth_file_local_new(backend_info); + ret = gmyth_file_local_open( file ); + } else { + g_debug("FileLocal object specified is not local to the current machine!"); + ret = FALSE; + goto init_failed; + } + + if (NULL == file) { + g_debug("File is NULL"); + ret = FALSE; + goto init_failed; + } + + g_debug( "uri = %s", uri); + + if (ret == FALSE) { + g_debug("MythTV FileLocal request failed when setting up socket connection!"); + goto init_failed; + } + + g_debug( "MythTV FileLocal filesize = %lld", + gmyth_file_get_filesize( GMYTH_FILE(file) ) ); + + init_failed: + + if ( file != NULL) + g_object_unref(file); + + if ( gmyth_uri != NULL) + g_object_unref( gmyth_uri); + + if ( backend_info != NULL) + g_object_unref( backend_info); + + return ret; + +} + +gint +main(gint args, const gchar **argv) { + gboolean ret = FALSE; + + g_type_init(); + + g_thread_init(NULL); + + fprintf(stdout, SYNC_STRING); + fflush(NULL); + getchar(); + + if ( args > 1) + ret = test_file_local_setup( argv[1]); + + if ( !ret) + g_debug("Error when running FileLocal setup test script!"); + else + g_debug("FileLocal setup test script finished with success."); + + return (0); +} + diff -r 22964d32dcdb -r fb0bf39636d6 gmyth/tests/test_filelocal.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gmyth/tests/test_filelocal.py Mon Apr 30 16:04:20 2007 +0100 @@ -0,0 +1,10 @@ +#!/usr/bin/python + +#doc: test gmyth_file_local_* methods + +from testing_tools import start, finish +import sys + +p = start('gmyth_test_filelocal', ['myth://192.168.3.165:6543/1000_20070330144500.nuv']) + +sys.exit(finish(p))