# HG changeset patch
# User rosfran
# Date 1178118674 -3600
# Node ID 88001a25ab5a58143591edb2019ba6085ec02d74
# Parent  a76074f537437085d3b5a68faa641144ce9ca65d
[svn r624] Allows to use some new arguments in the lcov tool.

diff -r a76074f53743 -r 88001a25ab5a gmyth/configure.ac
--- a/gmyth/configure.ac	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/configure.ac	Wed May 02 16:11:14 2007 +0100
@@ -5,7 +5,7 @@
 
 AC_INIT([gmyth],[0.3])
 
-dnl AC_CONFIG_SRCDIR([src/mmyth_main.c])
+AC_CONFIG_SRCDIR([src/gmyth.h])
 AC_CONFIG_HEADER(config.h)
 
 dnl when going to/from release please set the nano (fourth number) right !
diff -r a76074f53743 -r 88001a25ab5a gmyth/src/Makefile.am
--- a/gmyth/src/Makefile.am	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/src/Makefile.am	Wed May 02 16:11:14 2007 +0100
@@ -97,4 +97,6 @@
 	gmyth_file.h				\
 	gmyth_file_local.h
 
-CLEANFILES = $(BUILT_SOURCES)
+CLEANFILES = $(BUILT_SOURCES) \
+	*.gcda \
+	*.gcno
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/Makefile.am
--- a/gmyth/tests/Makefile.am	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/Makefile.am	Wed May 02 16:11:14 2007 +0100
@@ -26,11 +26,12 @@
 	gmyth_test_livetv \
 	gmyth_test_http \
 	gmyth_test_filetransfer \
-	gmyth_test_filelocal
+	gmyth_test_filelocal \
+	gmyth_test_file_download
 
 TESTS = \
-	test \
 	relink.py \
+	test_main.py \
 	test_connection.py \
 	test_epg.py \
 	test_recorder.py \
@@ -41,6 +42,7 @@
 	test_http.py \
 	test_filetransfer.py \
 	test_filelocal.py \
+	test_file_download.py \
 	coverage.py
 
 TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir)
@@ -78,3 +80,10 @@
 gmyth_test_filelocal_SOURCES = \
 	gmyth_test_filelocal.c
 
+gmyth_test_file_download_SOURCES = \
+	gmyth_test_file_download.c
+
+CLEANFILES = $(BUILT_SOURCES) \
+	*.gcda \
+	*.gcno
+
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/README
--- a/gmyth/tests/README	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/README	Wed May 02 16:11:14 2007 +0100
@@ -33,7 +33,7 @@
 If the --enable-coverage option is used, the library and test programs
 are compiled with support for generating line coverage
 information. After running the tests, a summary will be available in
-tests/regression/covere/index.html.
+tests/coverage/index.html.
 
 If --enable-mudflap-debug is used, libmudflap is linked with
 gmyth. Libmudflap will test for and report some common memory
@@ -157,10 +157,10 @@
 --------------------------------------
 #!/usr/bin/python
 
-from test import start
+from testing_tools import start
 import sys
 
-p = start('gmyth_test_epg', 2)
+p = start('gmyth_test_livetv', 2)
 sys.exit(finish(p))
 ----------------------------------
 
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/coverage.py
--- a/gmyth/tests/coverage.py	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/coverage.py	Wed May 02 16:11:14 2007 +0100
@@ -8,21 +8,24 @@
 
 def build_dir(exe):
     t = get_gcda(exe)
-    a = re.search("(/.*)/tests/*" ,t)
-    print "Tests build directory - %s" % a.groups()[0]
+    a = re.search("(/.*)/tests/.*" ,t)
+    print "GMyth base build directory - %s" % a.groups()[0]
     return a.groups()[0]
 
 def gen_cov_info(build_dir):
     if os.path.exists('coverage'):
         shutil.rmtree('coverage')
     os.mkdir('coverage')
-    os.chdir('coverage')
-    base_dir = '../' + os.environ['top_srcdir'] + '/src'
-    os.system('lcov -d ' + build_dir + ' -b ' + base_dir + ' -z')
-    os.system('lcov -d ' + build_dir + ' -b ' + base_dir + ' -c -o gmyth.info')
-    os.system('genhtml gmyth.info')
+    #os.chdir('coverage')
+    #base_dir = '../' + os.environ['top_srcdir'] + '/src'
+    #base_dir = build_dir + '/tests'
+    os.system('lcov -d ' + build_dir + ' -b ../src -z')
+    os.system('lcov -d ' + build_dir + ' -b ../src -c -o gmyth.info')
+    #os.system('lcov -d ' + build_dir + ' -z')
+    #os.system('lcov -d ' + build_dir + ' -c -o gmyth.info')
+    os.system('genhtml -o ./coverage/ gmyth.info')
 
-exe = 'test'
+exe = 'gmyth_test_connection'
 exe = [ '.libs/' + exe ]
 if is_coverage(exe):
     bdir = build_dir(exe)
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/gmyth_test_connection.c
--- a/gmyth/tests/gmyth_test_connection.c	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/gmyth_test_connection.c	Wed May 02 16:11:14 2007 +0100
@@ -3,10 +3,10 @@
 #include <string.h>
 #include <stdio.h>
 
-#include "gmyth_uri.h"
-#include "gmyth_backendinfo.h"
-#include "gmyth_socket.h"
-#include "gmyth_query.h"
+#include <gmyth/gmyth_uri.h>
+#include <gmyth/gmyth_backendinfo.h>
+#include <gmyth/gmyth_socket.h>
+#include <gmyth/gmyth_query.h>
 
 #include "common.h"
 
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/gmyth_test_epg.c
--- a/gmyth/tests/gmyth_test_epg.c	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/gmyth_test_epg.c	Wed May 02 16:11:14 2007 +0100
@@ -1,6 +1,6 @@
 
-#include "gmyth_backendinfo.h"
-#include "gmyth_epg.h"
+#include <gmyth/gmyth_backendinfo.h>
+#include <gmyth/gmyth_epg.h>
 
 #include "common.h"
 
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/gmyth_test_filelocal.c
--- a/gmyth/tests/gmyth_test_filelocal.c	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/gmyth_test_filelocal.c	Wed May 02 16:11:14 2007 +0100
@@ -2,11 +2,11 @@
 
 #include "common.h"
 
-#include "gmyth_uri.h"
-#include "gmyth_backendinfo.h"
-#include "gmyth_file.h"
-#include "gmyth_file_local.h"
-#include "gmyth_common.h"
+#include <gmyth/gmyth_uri.h>
+#include <gmyth/gmyth_backendinfo.h>
+#include <gmyth/gmyth_file.h>
+#include <gmyth/gmyth_file_local.h>
+#include <gmyth/gmyth_common.h>
 
 #define URI_FILE_LOCAL_DEFAULT	"myth://192.168.3.165:6543/"
 
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/gmyth_test_filetransfer.c
--- a/gmyth/tests/gmyth_test_filetransfer.c	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/gmyth_test_filetransfer.c	Wed May 02 16:11:14 2007 +0100
@@ -2,23 +2,20 @@
 
 #include "common.h"
 
-#include "gmyth_uri.h"
-#include "gmyth_backendinfo.h"
-#include "gmyth_livetv.h"
-#include "gmyth_file.h"
-#include "gmyth_file_transfer.h"
-#include "gmyth_file_local.h"
-#include "gmyth_common.h"
+#include <gmyth/gmyth_uri.h>
+#include <gmyth/gmyth_backendinfo.h>
+#include <gmyth/gmyth_livetv.h>
+#include <gmyth/gmyth_file.h>
+#include <gmyth/gmyth_file_transfer.h>
+#include <gmyth/gmyth_file_local.h>
+#include <gmyth/gmyth_common.h>
 
 #define URI_FILE_TRANSFER_DEFAULT	"myth://192.168.3.165:6543/"
 
 static gboolean
 test_file_transfer_setup( gchar *uri ) {
-    GMythLiveTV *livetv = NULL;
     GMythFile *file = NULL;
-    gchar *channel_name = NULL;
     gboolean ret = TRUE;
-    gboolean live_tv = FALSE;
 
     if ( NULL == uri)
         uri = g_strdup( URI_FILE_TRANSFER_DEFAULT );
@@ -56,8 +53,7 @@
     g_debug( "MythTV FileTransfer filesize = %lld",
             gmyth_file_get_filesize( file));
 
-    init_failed: if ( livetv != NULL)
-        g_object_unref(livetv);
+    init_failed: 
 
     if ( file != NULL)
         g_object_unref(file);
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/gmyth_test_http.c
--- a/gmyth/tests/gmyth_test_http.c	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/gmyth_test_http.c	Wed May 02 16:11:14 2007 +0100
@@ -1,5 +1,5 @@
 #include <glib-object.h>
-#include "gmyth.h"
+#include <gmyth/gmyth.h>
 #include <glib.h>
 
 #include "common.h"
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/gmyth_test_livetv.c
--- a/gmyth/tests/gmyth_test_livetv.c	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/gmyth_test_livetv.c	Wed May 02 16:11:14 2007 +0100
@@ -2,13 +2,13 @@
 
 #include "common.h"
 
-#include "gmyth_uri.h"
-#include "gmyth_backendinfo.h"
-#include "gmyth_livetv.h"
-#include "gmyth_file.h"
-#include "gmyth_file_transfer.h"
-#include "gmyth_file_local.h"
-#include "gmyth_common.h"
+#include <gmyth/gmyth_uri.h>
+#include <gmyth/gmyth_backendinfo.h>
+#include <gmyth/gmyth_livetv.h>
+#include <gmyth/gmyth_file.h>
+#include <gmyth/gmyth_file_transfer.h>
+#include <gmyth/gmyth_file_local.h>
+#include <gmyth/gmyth_common.h>
 
 #define URI_DEFAULT	"myth://192.168.3.165:6543/livetv?channel=9"
 
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/gmyth_test_recorder.c
--- a/gmyth/tests/gmyth_test_recorder.c	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/gmyth_test_recorder.c	Wed May 02 16:11:14 2007 +0100
@@ -1,10 +1,10 @@
 #include <glib-object.h>
 
-#include "gmyth_backendinfo.h"
-#include "gmyth_remote_util.h"
-#include "gmyth_query.h"
-#include "gmyth_epg.h"
-#include "gmyth_common.h"
+#include <gmyth/gmyth_backendinfo.h>
+#include <gmyth/gmyth_remote_util.h>
+#include <gmyth/gmyth_query.h>
+#include <gmyth/gmyth_epg.h>
+#include <gmyth/gmyth_common.h>
 
 #include "common.h"
 
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/gmyth_test_recordings.c
--- a/gmyth/tests/gmyth_test_recordings.c	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/gmyth_test_recordings.c	Wed May 02 16:11:14 2007 +0100
@@ -1,10 +1,10 @@
 #include <glib-object.h>
 
-#include "gmyth_uri.h"
-#include "gmyth_backendinfo.h"
-#include "gmyth_scheduler.h"
-#include "gmyth_epg.h"
-#include "gmyth_common.h"
+#include <gmyth/gmyth_uri.h>
+#include <gmyth/gmyth_backendinfo.h>
+#include <gmyth/gmyth_scheduler.h>
+#include <gmyth/gmyth_epg.h>
+#include <gmyth/gmyth_common.h>
 
 #include "common.h"
 
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/gmyth_test_vlc.c
--- a/gmyth/tests/gmyth_test_vlc.c	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/gmyth_test_vlc.c	Wed May 02 16:11:14 2007 +0100
@@ -1,5 +1,5 @@
 #include <glib-object.h>
-#include "gmyth.h"
+#include <gmyth/gmyth.h>
 #include <glib.h>
 
 #include "common.h"
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/main.c
--- a/gmyth/tests/main.c	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/main.c	Wed May 02 16:11:14 2007 +0100
@@ -2,16 +2,22 @@
 #include <glib.h>
 #include <gmyth/gmyth.h>
 
+#include "common.h"
+
 int
 main (int args, const char **argv)
 {
     const char *uri = argv[1];
     GMythURI *gmyth_uri = NULL;
     gboolean res;
-    GMythBackendInfo *backend_info;
+    GMythBackendInfo *backend_info = NULL;
     g_type_init ();
     g_thread_init (NULL);
 
+    fprintf(stdout, SYNC_STRING);
+    fflush(NULL);
+    getchar();
+
     backend_info = gmyth_backend_info_new ();
     gmyth_uri = gmyth_uri_new_with_value (uri);
 
@@ -31,7 +37,7 @@
         return  -1;
     }
 
-    guint64 filesize = gmyth_file_transfer_get_filesize (file_transfer);
+    gint64 filesize = gmyth_file_transfer_get_filesize (file_transfer);
     if (filesize <= 0) {
         g_debug ("filesize is 0");
         return -1;
@@ -41,10 +47,15 @@
     guint num = gmyth_file_transfer_read (file_transfer, data, filesize, FALSE);
     g_debug ("read %d bytes", num);
 
-    g_byte_array_free (data, TRUE);
-    g_object_unref (file_transfer);
-    g_object_unref (gmyth_uri);
-    g_string_free (hostname, TRUE);
+    if ( data != NULL )
+	g_byte_array_free (data, TRUE);
+    if ( file_transfer != NULL )
+	g_object_unref (file_transfer);
+    if ( gmyth_uri != NULL )
+	g_object_unref (gmyth_uri);
+    if ( hostname != NULL )
+	g_string_free (hostname, TRUE);
 
-    return 0;    
+    return (0);
 }
+
diff -r a76074f53743 -r 88001a25ab5a gmyth/tests/testing_tools.py
--- a/gmyth/tests/testing_tools.py	Tue May 01 23:02:19 2007 +0100
+++ b/gmyth/tests/testing_tools.py	Wed May 02 16:11:14 2007 +0100
@@ -88,6 +88,7 @@
 
 def get_gcda(exe):
     #exe_args = exe.split(' ')
+    print "Get GCDA - %s" % exe
     f = open(exe[0])
     data = f.read()
     f.close()