jhbuild r2494 - in trunk: . tests tests/hello tests/libhello



Author: fpeters
Date: Sun Nov  9 23:08:24 2008
New Revision: 2494
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2494&view=rev

Log:
* tests/hello/Makefile.am, tests/hello/autogen.sh,
tests/hello/configure.in, tests/hello/hello-frontend.c,
tests/libhello/Makefile.am, tests/libhello/autogen.sh,
tests/libhello/configure.in, tests/libhello/libhello.c,
tests/libhello/libhello.h, tests/libhello/libhello.pc.in,
tests/tests.py: added test case covering libtool; thanks to Mark
Seaborn (closes: #559428)



Added:
   trunk/tests/hello/
   trunk/tests/hello/Makefile.am
   trunk/tests/hello/autogen.sh
   trunk/tests/hello/configure.in
   trunk/tests/hello/hello-frontend.c
   trunk/tests/libhello/
   trunk/tests/libhello/Makefile.am
   trunk/tests/libhello/autogen.sh
   trunk/tests/libhello/configure.in
   trunk/tests/libhello/libhello.c
   trunk/tests/libhello/libhello.h
   trunk/tests/libhello/libhello.pc.in
Modified:
   trunk/ChangeLog
   trunk/tests/tests.py

Added: trunk/tests/hello/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/tests/hello/Makefile.am	Sun Nov  9 23:08:24 2008
@@ -0,0 +1,6 @@
+
+INCLUDES = $(LIBHELLO_CFLAGS)
+
+bin_PROGRAMS = hello
+hello_SOURCES = hello-frontend.c
+hello_LDADD = $(LIBHELLO_LIBS)

Added: trunk/tests/hello/autogen.sh
==============================================================================
--- (empty file)
+++ trunk/tests/hello/autogen.sh	Sun Nov  9 23:08:24 2008
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=. 
+
+aclocal
+automake --add-missing
+autoconf
+
+exec $srcdir/configure "$@"

Added: trunk/tests/hello/configure.in
==============================================================================
--- (empty file)
+++ trunk/tests/hello/configure.in	Sun Nov  9 23:08:24 2008
@@ -0,0 +1,8 @@
+
+AC_INIT([hello], [1.0])
+AM_INIT_AUTOMAKE([1.9 foreign])
+
+AC_PROG_CC
+PKG_CHECK_MODULES(LIBHELLO, libhello)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT

Added: trunk/tests/hello/hello-frontend.c
==============================================================================
--- (empty file)
+++ trunk/tests/hello/hello-frontend.c	Sun Nov  9 23:08:24 2008
@@ -0,0 +1,8 @@
+
+#include <libhello/libhello.h>
+
+int main()
+{
+  greet_world("library test");
+  return 0;
+}

Added: trunk/tests/libhello/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/tests/libhello/Makefile.am	Sun Nov  9 23:08:24 2008
@@ -0,0 +1,9 @@
+
+lib_LTLIBRARIES = libhello.la
+libhello_la_SOURCES = libhello.c
+
+libhellodir = $(includedir)/libhello-1.0/libhello
+libhello_HEADERS = libhello.h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libhello.pc

Added: trunk/tests/libhello/autogen.sh
==============================================================================
--- (empty file)
+++ trunk/tests/libhello/autogen.sh	Sun Nov  9 23:08:24 2008
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=. 
+
+libtoolize
+aclocal
+automake --add-missing
+autoconf
+
+exec $srcdir/configure "$@"

Added: trunk/tests/libhello/configure.in
==============================================================================
--- (empty file)
+++ trunk/tests/libhello/configure.in	Sun Nov  9 23:08:24 2008
@@ -0,0 +1,7 @@
+
+AC_INIT([hello], [1.0])
+AM_INIT_AUTOMAKE([1.9 foreign])
+AC_PROG_LIBTOOL
+
+AC_PROG_CC
+AC_OUTPUT([Makefile libhello.pc])

Added: trunk/tests/libhello/libhello.c
==============================================================================
--- (empty file)
+++ trunk/tests/libhello/libhello.c	Sun Nov  9 23:08:24 2008
@@ -0,0 +1,10 @@
+
+#include <stdio.h>
+
+#include "libhello.h"
+
+
+void greet_world(const char *text)
+{
+  printf("Hello world (%s)\n", text);
+}

Added: trunk/tests/libhello/libhello.h
==============================================================================
--- (empty file)
+++ trunk/tests/libhello/libhello.h	Sun Nov  9 23:08:24 2008
@@ -0,0 +1,2 @@
+
+void greet_world(const char *text);

Added: trunk/tests/libhello/libhello.pc.in
==============================================================================
--- (empty file)
+++ trunk/tests/libhello/libhello.pc.in	Sun Nov  9 23:08:24 2008
@@ -0,0 +1,11 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+includedir= includedir@
+
+
+Name: libhello
+Version: @VERSION@
+Description: libhello test library
+Libs: -L${libdir} -lhello
+Cflags: -I${includedir}/libhello-1.0

Modified: trunk/tests/tests.py
==============================================================================
--- trunk/tests/tests.py	(original)
+++ trunk/tests/tests.py	Sun Nov  9 23:08:24 2008
@@ -540,7 +540,7 @@
 
 STDOUT_FILENO = 1
 
-def with_stdout(func):
+def with_stdout_hidden(func):
     old_fd = os.dup(STDOUT_FILENO)
     new_fd = os.open('/dev/null', os.O_WRONLY)
     os.dup2(new_fd, STDOUT_FILENO)
@@ -581,14 +581,19 @@
         config.real_setup_env()
         return config
 
+    def make_branch(self, config, src_name):
+        branch_dir = os.path.join(config.checkoutroot, src_name)
+        shutil.copytree(os.path.join(os.path.dirname(__file__), src_name),
+                        branch_dir)
+        return SimpleBranch(src_name, branch_dir)
+
     def test_distutils(self):
         config = self.make_config()
-        branch_dir = os.path.join(config.checkoutroot, 'hello')
-        shutil.copytree(os.path.join(os.path.dirname(__file__), 'distutils'), branch_dir)
-        module_list = [DistutilsModule('hello', SimpleBranch('hello', branch_dir))]
+        module_list = [DistutilsModule('hello',
+                                       self.make_branch(config, 'distutils'))]
         build = jhbuild.frontends.terminal.TerminalBuildScript(
             config, module_list)
-        with_stdout(build.build)
+        with_stdout_hidden(build.build)
         proc = subprocess.Popen(['hello'], stdout=subprocess.PIPE)
         stdout, stderr = proc.communicate()
         self.assertEquals(stdout, 'Hello world (distutils)\n')
@@ -596,18 +601,29 @@
 
     def test_autotools(self):
         config = self.make_config()
-        branch_dir = os.path.join(config.checkoutroot, 'hello')
-        shutil.copytree(os.path.join(os.path.dirname(__file__), 'autotools'),
-                        branch_dir)
-        module_list = [AutogenModule('hello', SimpleBranch('hello', branch_dir))]
+        module_list = [AutogenModule('hello',
+                                     self.make_branch(config, 'autotools'))]
         build = jhbuild.frontends.terminal.TerminalBuildScript(
             config, module_list)
-        with_stdout(build.build)
+        with_stdout_hidden(build.build)
         proc = subprocess.Popen(['hello'], stdout=subprocess.PIPE)
         stdout, stderr = proc.communicate()
         self.assertEquals(stdout, 'Hello world (autotools)\n')
         self.assertEquals(proc.wait(), 0)
 
+    def test_autotools_with_libtool(self):
+        config = self.make_config()
+        module_list = [
+            AutogenModule('libhello', self.make_branch(config, 'libhello')),
+            AutogenModule('hello', self.make_branch(config, 'hello'))]
+        build = jhbuild.frontends.terminal.TerminalBuildScript(
+            config, module_list)
+        with_stdout_hidden(build.build)
+        proc = subprocess.Popen(['hello'], stdout=subprocess.PIPE)
+        stdout, stderr = proc.communicate()
+        self.assertEquals(stdout, 'Hello world (library test)\n')
+        self.assertEquals(proc.wait(), 0)
+
 
 if __name__ == '__main__':
     unittest.main()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]