diff options
author | Modestas Vainius <modestas@vainius.eu> | 2009-06-11 03:01:58 +0300 |
---|---|---|
committer | Modestas Vainius <modestas@vainius.eu> | 2009-06-11 14:10:08 +0300 |
commit | a7eeaa0001d4c12a1df6df17de2cb437dbab7423 (patch) | |
tree | f7eb37792a4db9a856ab54fd4e8c3a78de79ff69 /t/buildsystems/autoconf | |
parent | b3d77e8fd680f69445efee8f9e760be5ed3ccb54 (diff) |
Add a test suite for build systems.
* Tests for core Buildsystem API (mostly path API).
* Tests for check_auto_configure() for each buildsystem.
* Build system autoselection tests under "typical" conditions for each buildsystem.
* DH_AUTO_OPTIONS and command line argument parsing tests.
* Real dh_auto_* tests for autoconf/makefile build systems with emulated.
autoconf behaviour under in both in source and out of source tree scenarios.
Signed-off-by: Modestas Vainius <modestas@vainius.eu>
Diffstat (limited to 't/buildsystems/autoconf')
-rwxr-xr-x | t/buildsystems/autoconf/configure | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/t/buildsystems/autoconf/configure b/t/buildsystems/autoconf/configure new file mode 100755 index 00000000..adea14e6 --- /dev/null +++ b/t/buildsystems/autoconf/configure @@ -0,0 +1,74 @@ +#!/usr/bin/perl + +# Emulate autoconf behaviour and do some checks + +use strict; +use warnings; + +my @OPTIONS=qw( + ^--build=.*$ + ^--prefix=/usr$ + ^--includedir=\$\{prefix\}/include$ + ^--mandir=\$\{prefix\}/share/man$ + ^--infodir=\$\{prefix\}/share/info$ + ^--sysconfdir=/etc$ + ^--localstatedir=/var$ + ^--libexecdir=\$\{prefix\}/lib/.*$ + ^--disable-maintainer-mode$ + ^--disable-dependency-tracking$ +); + +# Verify if all command line arguments were passed +my @options = map { { regex => qr/$_/, + str => $_, + found => 0 } } @OPTIONS; +my @extra_args; +ARGV_LOOP: foreach my $arg (@ARGV) { + foreach my $opt (@options) { + if ($arg =~ $opt->{regex}) { + $opt->{found} = 1; + next ARGV_LOOP; + } + } + # Extra / unrecognized argument + push @extra_args, $arg; +} + +my @notfound = grep { ! $_->{found} and $_ } @options; +if (@notfound) { + print STDERR "Error: the following default options were NOT passed\n"; + print STDERR " ", $_->{str}, "\n" foreach (@notfound); + exit 1; +} + +# Create a simple Makefile +open(MAKEFILE, ">", "Makefile"); +print MAKEFILE <<EOF; +CONFIGURE := $0 +all: stamp_configure \$(CONFIGURE) + \@echo Package built > stamp_build + +# Tests if dh_auto_test executes 'check' target if 'test' does not exist +check: \$(CONFIGURE) stamp_build + \@echo Tested > stamp_test + +install: stamp_build + \@echo DESTDIR=\$(DESTDIR) > stamp_install + +# Tests whether dh_auto_clean executes distclean but does not touch +# this target +clean: + echo "This should not have been executed" >&2 && exit 1 + +distclean: + \@rm -f stamp_* Makefile + +.PHONY: all check install clean distclean +EOF +close MAKEFILE; + +open(STAMP, ">", "stamp_configure"); +print STAMP $_, "\n" foreach (@extra_args); +close STAMP; + +exit 0; |