[Swfdec] 2 commits - test/image test/sound test/trace

Benjamin Otte company at kemper.freedesktop.org
Fri Apr 27 00:35:21 PDT 2007


 test/image/image.c     |   17 +++++++++++++----
 test/sound/Makefile.am |    2 +-
 test/sound/sound.c     |   27 ++++++++++++++++++++-------
 test/trace/Makefile.am |    4 ++--
 test/trace/trace.c     |   17 +++++++++++++----
 5 files changed, 49 insertions(+), 18 deletions(-)

New commits:
diff-tree ea8b755f4b18ae0aad094cf2ec08a33b84dc2083 (from f894cc08b5028d7541eaf765a1ef73bc08755dd0)
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Apr 27 09:35:13 2007 +0200

    fix errors exposed by the now working make distcheck

diff --git a/test/sound/Makefile.am b/test/sound/Makefile.am
index 9face8b..e576d5e 100644
--- a/test/sound/Makefile.am
+++ b/test/sound/Makefile.am
@@ -30,7 +30,7 @@ EXTRA_DIST = \
 	adpcm-4.swf.0.0.raw \
 	adpcm-4-2.swf \
 	adpcm-4-2.swf.0.0.raw \
-	adpcm-5.swf
+	adpcm-5.swf \
 	adpcm-5.swf.0.0.raw \
 	adpcm-5-2.swf \
 	adpcm-5-2.swf.0.0.raw
diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index c7b4870..4540967 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -67,7 +67,7 @@ EXTRA_DIST = \
 	doaction-before-placeobject.swf \
 	doaction-before-placeobject.swf.trace \
 	double.swf \
-	event-order.swf \
+	double.swf.trace \
 	empty-stack.as \
 	empty-stack.swf \
 	empty-stack.swf.trace \
@@ -165,7 +165,7 @@ EXTRA_DIST = \
 	scope2.swf \
 	scope2.swf.trace \
 	setinterval.swf \
-	setinterval.swf.trace
+	setinterval.swf.trace \
 	setinterval2.swf \
 	setinterval2.swf.trace \
 	setinterval-arguments.as \
diff-tree f894cc08b5028d7541eaf765a1ef73bc08755dd0 (from c210a2353bf2cf8a8596b5aa093998570828f014)
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Apr 27 09:34:33 2007 +0200

    check the srcdir env variable when no arguiments are given and prefer it to "."
    
    This ensures that tests take their directories out of srcdir on make check.
    And that in turn makes the tests actually run on make distcheck while
    previously they successfully tested 0 files...

diff --git a/test/image/image.c b/test/image/image.c
index 4113304..a50664e 100644
--- a/test/image/image.c
+++ b/test/image/image.c
@@ -213,13 +213,22 @@ main (int argc, char **argv)
     }
   } else {
     GDir *dir;
-    const char *file;
-    dir = g_dir_open (".", 0, NULL);
+    char *name;
+    const char *path, *file;
+    /* automake defines this */
+    path = g_getenv ("srcdir");
+    if (path == NULL)
+      path = ".";
+    dir = g_dir_open (path, 0, NULL);
     while ((file = g_dir_read_name (dir))) {
       if (!g_str_has_suffix (file, ".swf"))
 	continue;
-      if (!run_test (file))
-	failed_tests = g_list_prepend (failed_tests, g_strdup (file));
+      name = g_build_filename (path, file, NULL);
+      if (!run_test (name)) {
+	failed_tests = g_list_prepend (failed_tests, name);
+      } else {
+	g_free (name);
+      }
     }
     g_dir_close (dir);
   }
diff --git a/test/sound/sound.c b/test/sound/sound.c
index 85856aa..9624a4a 100644
--- a/test/sound/sound.c
+++ b/test/sound/sound.c
@@ -173,7 +173,7 @@ run_test (const char *filename)
   SwfdecPlayer *player = NULL;
   guint i, msecs;
   GError *error = NULL;
-  char *dirname;
+  char *dirname, *basename, *file;
   const char *name;
   GDir *dir;
   GList *walk;
@@ -181,6 +181,7 @@ run_test (const char *filename)
 
   g_print ("Testing %s:\n", filename);
   dirname = g_path_get_dirname (filename);
+  basename = g_path_get_basename (filename);
   dir = g_dir_open (dirname, 0, &error);
   if (!dir) {
     g_print ("  ERROR: %s\n", error->message);
@@ -188,13 +189,16 @@ run_test (const char *filename)
     return FALSE;
   }
   while ((name = g_dir_read_name (dir))) {
-    if (!g_str_has_prefix (name, filename))
+    if (!g_str_has_prefix (name, basename))
       continue;
     if (!g_str_has_suffix (name, ".raw"))
       continue;
-    data.files = g_list_prepend (data.files, g_strdup (name));
+    file = g_build_filename (dirname, name, NULL);
+    data.files = g_list_prepend (data.files, file);
   }
   g_dir_close (dir);
+  g_free (dirname);
+  g_free (basename);
 
   loader = swfdec_loader_new_from_file (filename);
   if (loader->error) {
@@ -257,13 +261,22 @@ main (int argc, char **argv)
     }
   } else {
     GDir *dir;
-    const char *file;
-    dir = g_dir_open (".", 0, NULL);
+    char *name;
+    const char *path, *file;
+    /* automake defines this */
+    path = g_getenv ("srcdir");
+    if (path == NULL)
+      path = ".";
+    dir = g_dir_open (path, 0, NULL);
     while ((file = g_dir_read_name (dir))) {
       if (!g_str_has_suffix (file, ".swf"))
 	continue;
-      if (!run_test (file))
-	failed_tests = g_list_prepend (failed_tests, g_strdup (file));
+      name = g_build_filename (path, file, NULL);
+      if (!run_test (name)) {
+	failed_tests = g_list_prepend (failed_tests, name);
+      } else {
+	g_free (name);
+      }
     }
     g_dir_close (dir);
   }
diff --git a/test/trace/trace.c b/test/trace/trace.c
index 2c7ced7..990e7cb 100644
--- a/test/trace/trace.c
+++ b/test/trace/trace.c
@@ -99,13 +99,22 @@ main (int argc, char **argv)
     }
   } else {
     GDir *dir;
-    const char *file;
-    dir = g_dir_open (".", 0, NULL);
+    char *name;
+    const char *path, *file;
+    /* automake defines this */
+    path = g_getenv ("srcdir");
+    if (path == NULL)
+      path = ".";
+    dir = g_dir_open (path, 0, NULL);
     while ((file = g_dir_read_name (dir))) {
       if (!g_str_has_suffix (file, ".swf"))
 	continue;
-      if (!run_test (file))
-	failed_tests = g_list_prepend (failed_tests, g_strdup (file));;
+      name = g_build_filename (path, file, NULL);
+      if (!run_test (name)) {
+	failed_tests = g_list_prepend (failed_tests, name);
+      } else {
+	g_free (name);
+      }
     }
     g_dir_close (dir);
   }


More information about the Swfdec mailing list