Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 71757 invoked from network); 22 Nov 2010 10:05:50 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Nov 2010 10:05:50 -0000 Received: (qmail 8753 invoked by uid 500); 22 Nov 2010 10:06:21 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 8431 invoked by uid 500); 22 Nov 2010 10:06:19 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 8423 invoked by uid 99); 22 Nov 2010 10:06:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Nov 2010 10:06:18 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [217.72.192.243] (HELO fmmailgate05.web.de) (217.72.192.243) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Nov 2010 10:06:10 +0000 Received: from mwmweb044 ( [172.20.18.53]) by fmmailgate05.web.de (Postfix) with ESMTP id 4A55F639AC5B for ; Mon, 22 Nov 2010 11:05:50 +0100 (CET) Received: from [80.153.202.193] by mwmweb044 with HTTP; Mon Nov 22 11:05:50 CET 2010 Date: Mon, 22 Nov 2010 11:05:50 +0100 (CET) From: "Edgar Frank" To: modules-dev@httpd.apache.org Message-ID: <1947462667.4636885.1290420350297.JavaMail.fmail@mwmweb044> In-Reply-To: References: <1554952896.409239.1289459501425.JavaMail.fmail@mwmweb043>, Subject: Re: Howto unittest httpd modules? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-UI-Message-Type: mail X-UI-ATTACHMENT-ID-POSTFIX: 17ff083a-a7d4-4e17-ab46-dbcb6f45e0a6 X-Priority: 3 Importance: normal Sensitivity: Normal X-Provags-ID: V01U2FsdGVkX1+2qiwJ1mxkWnRu4KX5TBHzIIAKiwd6cAOsn8Nm8irrgHXA7M44Cyoz Qd0X5Vt9PXzchPHEnUzofSzz0UdjcpR/TNzWQAABf+8= X-Virus-Checked: Checked by ClamAV on apache.org 2010/11/11 Sorin Manolache: >On Thu, Nov 11, 2010 at 08:11, Edgar Frank wrote: >> I've written a handful of modules for httpd. I'm now looking for a way to setup some unit tests. We have continuous integration running, so I want to supply some tests, starting from compiling against httpd to basic functionality to more elaborate feature tests. >> >> I wonder how to unit-test this, as the prerequsites are rather complicated. The tests would have to setup a httpd, provide a config, compile and install the modules. As you don't want to modify the modules themselves, you have to run a bunch of requests and monitor expected output - maybe measuring coverage or running valgrind on the way. >> >> I see no way to run "real" unit tests as you would have to emulate httpd and run your modules against it, as most of the code is httpd or at least highly APR dependent. I see no point in emulating httpd as you would have to implement every little detail - httpd specific behaviour (e.g. in version bumps) is one important thing to test IMHO. >> >> So, has anyone some experience with this, some suggestions, howtos or tutorials? Any help would be greatly appreciated. > >In our group we unit test only parts of our modules. We unit test the >callbacks and their sequence (a sort of poor-man's emulation of >httpd). We populate a request_rec structure and then we pass it to the >various callbacks. > >Our callbacks are mainly wrappers around bigger functions that are >httpd-independent. The apache filters are tested in this way. > >The part that needed more code in order to emulate httpd was the >subrequest infrastructure. Thanks for your reply. Unfortunately this is the way we're trying to avoid if possible. Has anyone else some hints or best pratices, besides emulating httpd? Is there even another way? Regards, Edgar