* t/objcxx-minidemo.sh: New test. * t/objc-minidemo.sh: Likewise. * t/list-of-tests.mk: Add them.
Co-authored-by: Peter Breitenlohner <p...@mppmu.mpg.de> Signed-off-by: Stefano Lattarini <stefano.lattar...@gmail.com> --- t/list-of-tests.mk | 2 ++ t/objc-minidemo.sh | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ t/objcxx-minidemo.sh | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100755 t/objc-minidemo.sh create mode 100755 t/objcxx-minidemo.sh diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index bc6dfe2..d19c74a 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -704,7 +704,9 @@ t/notrans.sh \ t/number.sh \ t/objc.sh \ t/objc2.sh \ +t/objc-minidemo.sh \ t/objcxx-basic.sh \ +t/objcxx-minidemo.sh \ t/objext-pr10128.sh \ t/obsolete.sh \ t/oldvars.sh \ diff --git a/t/objc-minidemo.sh b/t/objc-minidemo.sh new file mode 100755 index 0000000..acd7e19 --- /dev/null +++ b/t/objc-minidemo.sh @@ -0,0 +1,76 @@ +#! /bin/sh +# Copyright (C) 2012 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Dummy demo package using Objective C and doing distcheck. +# See also sister test 'objcxx-minidemo.sh'. + +required=native +. ./defs || Exit 1 + +cat >> configure.ac << 'END' +AC_PROG_OBJC +AC_CONFIG_HEADERS([config.h]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AM_DEFAULT_SOURCE_EXT = .m +bin_PROGRAMS = ok +noinst_PROGRAMS = ko +TESTS = $(bin_PROGRAMS) $(XFAIL_TESTS) +XFAIL_TESTS = $(noinst_PROGRAMS) +END + +cat > ok.m << 'END' +/* The use of #import makes this valid Object C but invalid C. */ +#import <stdio.h> +#import <config.h> +int main (void) +{ + printf ("Success (%s)\n", PACKAGE_STRING); + return 0; +} +END + +cat > ko.m << 'END' +/* The use of #import makes this valid Object C but invalid C. */ +#import <stdio.h> +int main (void) +{ + printf("Failure\n"); + return 1; +} +END + +if $ACLOCAL; then + : We have a modern enough autoconf, go ahead. +elif test $? -eq 63; then + skip_ "Object C++ support requires Autoconf 2.65 or later" +else + Exit 1 # Some other aclocal failure. +fi + +$ACLOCAL +$AUTOCONF +$AUTOHEADER +$AUTOMAKE --add-missing + +./configure +$MAKE +$MAKE check +$MAKE distcheck + +: diff --git a/t/objcxx-minidemo.sh b/t/objcxx-minidemo.sh new file mode 100755 index 0000000..fe93ea6 --- /dev/null +++ b/t/objcxx-minidemo.sh @@ -0,0 +1,77 @@ +#! /bin/sh +# Copyright (C) 2012 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Dummy demo package using Objective C++ and doing distcheck. +# See also sister test 'objc-minidemo.sh'. + +required=native +. ./defs || Exit 1 + +cat >> configure.ac << 'END' +dnl Support for Object C++ was introduced only in Autoconf 2.65. +AC_PREREQ([2.65]) +AC_PROG_OBJCXX +AC_CONFIG_HEADERS([config.h]) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AM_DEFAULT_SOURCE_EXT = .mm +bin_PROGRAMS = ok +noinst_PROGRAMS = ko +TESTS = $(bin_PROGRAMS) $(XFAIL_TESTS) +XFAIL_TESTS = $(noinst_PROGRAMS) +END + +cat > ok.mm << 'END' +/* The use of #import makes this valid Object C++ but invalid C++. */ +#import <iostream> +#import <config.h> +using namespace std; +int main (void) +{ + cout << "Success (" << PACKAGE_STRING << ")\n"; + return 0; +} +END + +cat > ko.mm << 'END' +/* The use of #import makes this valid Object C++ but invalid C++. */ +#import <cstdio> +int main (void) +{ + printf("Failure\n"); + return 1; +} +END + +if $ACLOCAL; then + : We have a modern enough autoconf, go ahead. +elif test $? -eq 63; then + skip_ "Object C++ support requires Autoconf 2.65 or later" +else + Exit 1 # Some other aclocal failure. +fi +$AUTOCONF +$AUTOHEADER +$AUTOMAKE --add-missing + +./configure +$MAKE +$MAKE check +$MAKE distcheck + +: -- 1.7.9.5