diff options
author | Jacob Champion <jchampion@apache.org> | 2017-05-25 23:18:32 +0200 |
---|---|---|
committer | Jacob Champion <jchampion@apache.org> | 2017-05-25 23:18:32 +0200 |
commit | d3289c73ee5f053dc99ccb8546624017e83cca8b (patch) | |
tree | b6bd7bc9e87d1f33c41294a8dbdeb255ad52f569 /build/httpdunit_gen_stubs.pl | |
parent | configure: don't overwrite other_targets when mod_suexec is enabled (diff) | |
download | apache2-d3289c73ee5f053dc99ccb8546624017e83cca8b.tar.xz apache2-d3289c73ee5f053dc99ccb8546624017e83cca8b.zip |
httpdunit: a Check-based unit test suite
Add a unit test suite based on Check:
https://libcheck.github.io/check/
The suite depends on the build system to automatically generate the code
stubs that call every test case.
httpdunit is automatically enabled in the build if configure is able to
find Check via pkg-config. At the moment pkg-config is the only official
(non-deprecated) way to build and link against Check with an autoconf
system, since platforms may distribute Check as a static library.
Note that Check is an LGPL'd library, so we can't distribute test
objects and binaries. Building and running the suite remains optional
and is not required to run the server.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/httpdunit@1796202 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build/httpdunit_gen_stubs.pl')
-rwxr-xr-x | build/httpdunit_gen_stubs.pl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/build/httpdunit_gen_stubs.pl b/build/httpdunit_gen_stubs.pl new file mode 100755 index 0000000000..abb640c6bf --- /dev/null +++ b/build/httpdunit_gen_stubs.pl @@ -0,0 +1,22 @@ +#! /usr/bin/env perl + +# +# Generates a code stub that adds unit tests to a Check test case. +# +# Supply the test case's source file contents on stdin; the resulting code will +# be printed to stdout. This code is designed to be included as part of the +# boilerplate at the end of each test case. +# + +use strict; +use warnings; + +while (my $line = <>) { + # FIXME: this does not correctly handle macro invocations that are split + # over multiple lines. + if ($line =~ /^HTTPD_START_LOOP_TEST\((\w+),(.*)\)/) { + print "tcase_add_loop_test(testcase, $1, 0, ($2));\n"; + } elsif ($line =~ /^START_TEST\((\w+)\)/) { + print "tcase_add_test(testcase, $1);\n" + } +} |