Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Dev

FWD: Testing modules using Python

 

 

Apache dev RSS feed   Index | Next | Previous | View Threaded


Steven.Mohr at dlr

Aug 5, 2008, 1:21 AM

Post #1 of 4 (287 views)
Permalink
FWD: Testing modules using Python

Hi,
on modules-dev[at]httpd.apache.org Peter gave me the advice to build apache with the SHARED_CORE rule. Apache 2.x does not have this rule anymore. Is there something comparable in Apache 2.x?
Sorry for cross-posting but I think you are the guys who could help me.

Steven


------------------------------------------------
Steven Mohr
Bachelor student

DLR (German Aerospace Center),
Simulation and Software Technology
Linder Hoehe, 51147 Cologne, Germany
voice: +49 2203 601 2956 fax: +49 2203 601 3070
eMail: steven.mohr at dlr.de http://www.dlr.de/sc



-----Ursprüngliche Nachricht-----
Von: Peter Poeml [mailto:poeml[at]suse.de]
Gesendet: Montag, 4. August 2008 16:37
An: modules-dev[at]httpd.apache.org
Betreff: Re: Testing modules using Python

On Mon, Aug 04, 2008 at 04:27:58PM +0200, Steven.Mohr[at]dlr.de wrote:
> Hi,
> I want to unit test my module (catacomb.tigris.org) using Python. My
> idea is to load the module with ctypes (a python module that allows to
> load functions from shared libraries into python) and test it in this
> environment. The main advantage is that it's much easier to create
> mock-up objects in Python than in C. My problem is that ctypes fails if
> the shared library contains any undefined symbols. Because the module is
> used normally together with a httpd server,
> there're a lot of undefined symbols. My solution is to link libapr,
> libaprutil, libexpat and libmysql statically in my module and to add a
> file with the definitions of the apache-internal functions (just copy
> and paste from httpd source). With every function which I copy in this
> file I get a few new undefined symbols. All in all it's a pain to search
> all definitions and I probably have to do this again after adding new
> features which uses other functionalities.
>
> Is there an easier way to do this? To build a module which includes all
> needed links to apache functions without linking the needed libraries
> statically and copy-and-paste functions from apache source? Or do you
> know a better way to do this?
>
> Steven

With httpd 1.3, there used to be a way to build something what was
called "shared core", a shared object that contained the server in a
form you could link it into an application.

I don't know if this is still possible with httpd 2.x, but what used I
in an RPM package at the time was

--enable-rule=SHARED_CORE

mkdir shared_core
cp -p src/libhttpd.ep src/libhttpd.so src/httpd
shared_core


# install shared-core apache
install -m 755 shared_core/libhttpd.ep $RPM_BUILD_ROOT/%{_libdir}/%{name}
install -m 755 shared_core/libhttpd.so $RPM_BUILD_ROOT/%{_libdir}/%{name}
ln -s %{_libdir}/%{name}/libhttpd.ep $RPM_BUILD_ROOT/%{_sbindir}/httpd-shared_core
ln -s %{_libdir}/%{name}/libhttpd.so $RPM_BUILD_ROOT/%{_libdir}/libhttpd.so


At the time, that was reportedly working to build DSOs with Kylix 3.

Peter
--
Contact: admin[at]opensuse.org (a.k.a. ftpadmin[at]suse.com)
#opensuse-mirrors on freenode.net
Info: http://en.opensuse.org/Mirror_Infrastructure

SUSE LINUX Products GmbH
Research & Development


poeml at suse

Aug 7, 2008, 2:40 AM

Post #2 of 4 (262 views)
Permalink
Re: FWD: Testing modules using Python [In reply to]

Hi Steven,

On Tue, Aug 05, 2008 at 10:21:01 +0200, Steven.Mohr[at]dlr.de wrote:
> Hi,
> on modules-dev[at]httpd.apache.org Peter gave me the advice to build apache with the SHARED_CORE rule. Apache 2.x does not have this rule anymore. Is there something comparable in Apache 2.x?
> Sorry for cross-posting but I think you are the guys who could help me.
>
> Steven

The build infrastructure doesn't seem to know this anymore -

but does it work if you do the following?

make clean
CFLAGS='-D SHARED_CORE -fPIC' ./configure
make

and then take the line which links together the httpd binary (the
one with
libtool ... -mode=link gcc ... -o httpd ...
which is probably the last line)
and rerun it manually with a slight change:

libtool ... -mode=link gcc ... -shared -o libhttpd.so ... server/exports.o

This should build the shared object anyway.
But it is possible that it doesn't provide what you need. YMMV.

> ------------------------------------------------
> Steven Mohr
> Bachelor student
>
> DLR (German Aerospace Center),
> Simulation and Software Technology
> Linder Hoehe, 51147 Cologne, Germany
> voice: +49 2203 601 2956 fax: +49 2203 601 3070
> eMail: steven.mohr at dlr.de http://www.dlr.de/sc
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Peter Poeml [mailto:poeml[at]suse.de]
> Gesendet: Montag, 4. August 2008 16:37
> An: modules-dev[at]httpd.apache.org
> Betreff: Re: Testing modules using Python
>
> On Mon, Aug 04, 2008 at 04:27:58PM +0200, Steven.Mohr[at]dlr.de wrote:
> > Hi,
> > I want to unit test my module (catacomb.tigris.org) using Python. My
> > idea is to load the module with ctypes (a python module that allows to
> > load functions from shared libraries into python) and test it in this
> > environment. The main advantage is that it's much easier to create
> > mock-up objects in Python than in C. My problem is that ctypes fails if
> > the shared library contains any undefined symbols. Because the module is
> > used normally together with a httpd server,
> > there're a lot of undefined symbols. My solution is to link libapr,
> > libaprutil, libexpat and libmysql statically in my module and to add a
> > file with the definitions of the apache-internal functions (just copy
> > and paste from httpd source). With every function which I copy in this
> > file I get a few new undefined symbols. All in all it's a pain to search
> > all definitions and I probably have to do this again after adding new
> > features which uses other functionalities.
> >
> > Is there an easier way to do this? To build a module which includes all
> > needed links to apache functions without linking the needed libraries
> > statically and copy-and-paste functions from apache source? Or do you
> > know a better way to do this?
> >
> > Steven
>
> With httpd 1.3, there used to be a way to build something what was
> called "shared core", a shared object that contained the server in a
> form you could link it into an application.
>
> I don't know if this is still possible with httpd 2.x, but what used I
> in an RPM package at the time was
>
> --enable-rule=SHARED_CORE
>
> mkdir shared_core
> cp -p src/libhttpd.ep src/libhttpd.so src/httpd
> shared_core
>
>
> # install shared-core apache
> install -m 755 shared_core/libhttpd.ep $RPM_BUILD_ROOT/%{_libdir}/%{name}
> install -m 755 shared_core/libhttpd.so $RPM_BUILD_ROOT/%{_libdir}/%{name}
> ln -s %{_libdir}/%{name}/libhttpd.ep $RPM_BUILD_ROOT/%{_sbindir}/httpd-shared_core
> ln -s %{_libdir}/%{name}/libhttpd.so $RPM_BUILD_ROOT/%{_libdir}/libhttpd.so
>
>
> At the time, that was reportedly working to build DSOs with Kylix 3.
>
> Peter
> --
> Contact: admin[at]opensuse.org (a.k.a. ftpadmin[at]suse.com)
> #opensuse-mirrors on freenode.net
> Info: http://en.opensuse.org/Mirror_Infrastructure
>
> SUSE LINUX Products GmbH
> Research & Development

Peter
--
"WARNING: This bug is visible to non-employees. Please be respectful!"

SUSE LINUX Products GmbH
Research & Development


Steven.Mohr at dlr

Aug 27, 2008, 11:50 AM

Post #3 of 4 (174 views)
Permalink
AW: FWD: Testing modules using Python [In reply to]

Hi Peter,
I've followed your instruction. The shared object which is created has a size of 5 kB. Is this right? It seems to be very small. There are still undefined symbols of functions like ap_filter_flush, ap_is_url or ap_count_dirs. I will edit server/exports.c file because many of the undefined symbols are defined in this file (and as the first lines say, exports.c is an ugly hack which exports every function => undefined symbols)
Do you know an options or other files which would improve the shared object?

Thanks for your advices

Steven

------------------------------------------------
Steven Mohr
Bachelor student

DLR (German Aerospace Center),
Simulation and Software Technology
Linder Hoehe, 51147 Cologne, Germany
voice: +49 2203 601 2053
eMail: steven.mohr at dlr.de http://www.dlr.de/sc

-----Ursprüngliche Nachricht-----
Von: Peter Poeml [mailto:poeml[at]suse.de]
Gesendet: Donnerstag, 7. August 2008 11:41
An: dev[at]httpd.apache.org
Betreff: Re: FWD: Testing modules using Python

Hi Steven,

On Tue, Aug 05, 2008 at 10:21:01 +0200, Steven.Mohr[at]dlr.de wrote:
> Hi,
> on modules-dev[at]httpd.apache.org Peter gave me the advice to build apache with the SHARED_CORE rule. Apache 2.x does not have this rule anymore. Is there something comparable in Apache 2.x?
> Sorry for cross-posting but I think you are the guys who could help me.
>
> Steven

The build infrastructure doesn't seem to know this anymore -

but does it work if you do the following?

make clean
CFLAGS='-D SHARED_CORE -fPIC' ./configure
make

and then take the line which links together the httpd binary (the
one with
libtool ... -mode=link gcc ... -o httpd ...
which is probably the last line)
and rerun it manually with a slight change:

libtool ... -mode=link gcc ... -shared -o libhttpd.so ... server/exports.o

This should build the shared object anyway.
But it is possible that it doesn't provide what you need. YMMV.

> ------------------------------------------------
> Steven Mohr
> Bachelor student
>
> DLR (German Aerospace Center),
> Simulation and Software Technology
> Linder Hoehe, 51147 Cologne, Germany
> voice: +49 2203 601 2956 fax: +49 2203 601 3070
> eMail: steven.mohr at dlr.de http://www.dlr.de/sc
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Peter Poeml [mailto:poeml[at]suse.de]
> Gesendet: Montag, 4. August 2008 16:37
> An: modules-dev[at]httpd.apache.org
> Betreff: Re: Testing modules using Python
>
> On Mon, Aug 04, 2008 at 04:27:58PM +0200, Steven.Mohr[at]dlr.de wrote:
> > Hi,
> > I want to unit test my module (catacomb.tigris.org) using Python. My
> > idea is to load the module with ctypes (a python module that allows to
> > load functions from shared libraries into python) and test it in this
> > environment. The main advantage is that it's much easier to create
> > mock-up objects in Python than in C. My problem is that ctypes fails if
> > the shared library contains any undefined symbols. Because the module is
> > used normally together with a httpd server,
> > there're a lot of undefined symbols. My solution is to link libapr,
> > libaprutil, libexpat and libmysql statically in my module and to add a
> > file with the definitions of the apache-internal functions (just copy
> > and paste from httpd source). With every function which I copy in this
> > file I get a few new undefined symbols. All in all it's a pain to search
> > all definitions and I probably have to do this again after adding new
> > features which uses other functionalities.
> >
> > Is there an easier way to do this? To build a module which includes all
> > needed links to apache functions without linking the needed libraries
> > statically and copy-and-paste functions from apache source? Or do you
> > know a better way to do this?
> >
> > Steven
>
> With httpd 1.3, there used to be a way to build something what was
> called "shared core", a shared object that contained the server in a
> form you could link it into an application.
>
> I don't know if this is still possible with httpd 2.x, but what used I
> in an RPM package at the time was
>
> --enable-rule=SHARED_CORE
>
> mkdir shared_core
> cp -p src/libhttpd.ep src/libhttpd.so src/httpd
> shared_core
>
>
> # install shared-core apache
> install -m 755 shared_core/libhttpd.ep $RPM_BUILD_ROOT/%{_libdir}/%{name}
> install -m 755 shared_core/libhttpd.so $RPM_BUILD_ROOT/%{_libdir}/%{name}
> ln -s %{_libdir}/%{name}/libhttpd.ep $RPM_BUILD_ROOT/%{_sbindir}/httpd-shared_core
> ln -s %{_libdir}/%{name}/libhttpd.so $RPM_BUILD_ROOT/%{_libdir}/libhttpd.so
>
>
> At the time, that was reportedly working to build DSOs with Kylix 3.
>
> Peter
> --
> Contact: admin[at]opensuse.org (a.k.a. ftpadmin[at]suse.com)
> #opensuse-mirrors on freenode.net
> Info: http://en.opensuse.org/Mirror_Infrastructure
>
> SUSE LINUX Products GmbH
> Research & Development

Peter
--
"WARNING: This bug is visible to non-employees. Please be respectful!"

SUSE LINUX Products GmbH
Research & Development


Steven.Mohr at dlr

Aug 28, 2008, 11:24 PM

Post #4 of 4 (165 views)
Permalink
AW: FWD: Testing modules using Python [In reply to]

Hi Peter,
I've fixed my problem. Your advice was really helpful, the only thing I had to change was to replace server/exports.o with server/protocol.o modules.o buildmark.o server/provider.o server/util_xml.o server/error_bucket.o and everything works fine.

Thanks again for your help

Steven

------------------------------------------------
Steven Mohr
Bachelor student

DLR (German Aerospace Center),
Simulation and Software Technology
Linder Hoehe, 51147 Cologne, Germany
voice: +49 2203 601 2956 fax: +49 2203 601 3070
eMail: steven.mohr at dlr.de http://www.dlr.de/sc

-----Ursprüngliche Nachricht-----
Von: Steven.Mohr[at]dlr.de [mailto:Steven.Mohr[at]dlr.de]
Gesendet: Mittwoch, 27. August 2008 20:51
An: dev[at]httpd.apache.org
Betreff: AW: FWD: Testing modules using Python

Hi Peter,
I've followed your instruction. The shared object which is created has a size of 5 kB. Is this right? It seems to be very small. There are still undefined symbols of functions like ap_filter_flush, ap_is_url or ap_count_dirs. I will edit server/exports.c file because many of the undefined symbols are defined in this file (and as the first lines say, exports.c is an ugly hack which exports every function => undefined symbols)
Do you know an options or other files which would improve the shared object?

Thanks for your advices

Steven

------------------------------------------------
Steven Mohr
Bachelor student

DLR (German Aerospace Center),
Simulation and Software Technology
Linder Hoehe, 51147 Cologne, Germany
voice: +49 2203 601 2053
eMail: steven.mohr at dlr.de http://www.dlr.de/sc

-----Ursprüngliche Nachricht-----
Von: Peter Poeml [mailto:poeml[at]suse.de]
Gesendet: Donnerstag, 7. August 2008 11:41
An: dev[at]httpd.apache.org
Betreff: Re: FWD: Testing modules using Python

Hi Steven,

On Tue, Aug 05, 2008 at 10:21:01 +0200, Steven.Mohr[at]dlr.de wrote:
> Hi,
> on modules-dev[at]httpd.apache.org Peter gave me the advice to build apache with the SHARED_CORE rule. Apache 2.x does not have this rule anymore. Is there something comparable in Apache 2.x?
> Sorry for cross-posting but I think you are the guys who could help me.
>
> Steven

The build infrastructure doesn't seem to know this anymore -

but does it work if you do the following?

make clean
CFLAGS='-D SHARED_CORE -fPIC' ./configure
make

and then take the line which links together the httpd binary (the
one with
libtool ... -mode=link gcc ... -o httpd ...
which is probably the last line)
and rerun it manually with a slight change:

libtool ... -mode=link gcc ... -shared -o libhttpd.so ... server/exports.o

This should build the shared object anyway.
But it is possible that it doesn't provide what you need. YMMV.

> ------------------------------------------------
> Steven Mohr
> Bachelor student
>
> DLR (German Aerospace Center),
> Simulation and Software Technology
> Linder Hoehe, 51147 Cologne, Germany
> voice: +49 2203 601 2956 fax: +49 2203 601 3070
> eMail: steven.mohr at dlr.de http://www.dlr.de/sc
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Peter Poeml [mailto:poeml[at]suse.de]
> Gesendet: Montag, 4. August 2008 16:37
> An: modules-dev[at]httpd.apache.org
> Betreff: Re: Testing modules using Python
>
> On Mon, Aug 04, 2008 at 04:27:58PM +0200, Steven.Mohr[at]dlr.de wrote:
> > Hi,
> > I want to unit test my module (catacomb.tigris.org) using Python. My
> > idea is to load the module with ctypes (a python module that allows to
> > load functions from shared libraries into python) and test it in this
> > environment. The main advantage is that it's much easier to create
> > mock-up objects in Python than in C. My problem is that ctypes fails if
> > the shared library contains any undefined symbols. Because the module is
> > used normally together with a httpd server,
> > there're a lot of undefined symbols. My solution is to link libapr,
> > libaprutil, libexpat and libmysql statically in my module and to add a
> > file with the definitions of the apache-internal functions (just copy
> > and paste from httpd source). With every function which I copy in this
> > file I get a few new undefined symbols. All in all it's a pain to search
> > all definitions and I probably have to do this again after adding new
> > features which uses other functionalities.
> >
> > Is there an easier way to do this? To build a module which includes all
> > needed links to apache functions without linking the needed libraries
> > statically and copy-and-paste functions from apache source? Or do you
> > know a better way to do this?
> >
> > Steven
>
> With httpd 1.3, there used to be a way to build something what was
> called "shared core", a shared object that contained the server in a
> form you could link it into an application.
>
> I don't know if this is still possible with httpd 2.x, but what used I
> in an RPM package at the time was
>
> --enable-rule=SHARED_CORE
>
> mkdir shared_core
> cp -p src/libhttpd.ep src/libhttpd.so src/httpd
> shared_core
>
>
> # install shared-core apache
> install -m 755 shared_core/libhttpd.ep $RPM_BUILD_ROOT/%{_libdir}/%{name}
> install -m 755 shared_core/libhttpd.so $RPM_BUILD_ROOT/%{_libdir}/%{name}
> ln -s %{_libdir}/%{name}/libhttpd.ep $RPM_BUILD_ROOT/%{_sbindir}/httpd-shared_core
> ln -s %{_libdir}/%{name}/libhttpd.so $RPM_BUILD_ROOT/%{_libdir}/libhttpd.so
>
>
> At the time, that was reportedly working to build DSOs with Kylix 3.
>
> Peter
> --
> Contact: admin[at]opensuse.org (a.k.a. ftpadmin[at]suse.com)
> #opensuse-mirrors on freenode.net
> Info: http://en.opensuse.org/Mirror_Infrastructure
>
> SUSE LINUX Products GmbH
> Research & Development

Peter
--
"WARNING: This bug is visible to non-employees. Please be respectful!"

SUSE LINUX Products GmbH
Research & Development

Apache dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.