Hash :
bf258729
Author :
Date :
2012-06-29T00:48:11
tests: prefer "test ! -e FILE" to check that a file doesn't exist Once, for the sake of (at least) Solaris 10 /bin/sh, we had to use "test ! -f FILE" or "test ! -r FILE" or "test ! -d FILE" instead, because the that shell's 'test' built-in didn't grok the '-e' option. Note however that we still can't use "test ! -e" in the Makefile recipes used in the test cases; that is because those recipes are run with the shell detected by 'configure', and Autoconf-generated configure scripts do no guarantee to find or provide a POSIX-compatible shell. * Several tests: Adjust. * t/yacc-clean-cxx: Adjust, and remove a couple of useless commands. * t/parallel-tests-dry-run-2.sh: Adjust, and add invocation to "make -n" forgotten in previous versions of the test. * t/txinfo26.sh: Adjust, and don't bother to skip the test when it's run in a directory whose absolute path contain whitespace: that setup is not supported anyway. * t/maken3.sh: Adjust, and fix a typo that could cause a minor false negative. * t/test-trs-recover2.sh: Prefer using 'skip_' with a suitable error message over a bare 'exit 77'. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
#! /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/>.
# Demo on C++ support.
required=c++
am_create_testdir=empty
. ./defs || exit 1
cat > configure.ac << 'END'
AC_INIT([GNU C++ Demo], [1.3], [bug-automake@gnu.org])
AC_CONFIG_SRCDIR([play.c++])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
# The C compiler shouldn't be required in any way.
CC=false; AC_SUBST([CC])
AC_PROG_CXX
AH_BOTTOM([
#ifndef GREETINGS
# define GREETINGS "Howdy"
#endif])
AC_DEFINE([OK_AC], [1],
[Give "good to go" declaration from configure.ac])
AC_CONFIG_HEADERS([config.hxx])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
END
cat > Makefile.am << 'END'
AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = work play
common_sources = common.hpp foo.cpp sub/bar.cc
AM_CPPFLAGS = -DOK_AM=1
play_SOURCES = play.c++ play.hh $(common_sources)
work_SOURCES = work.cxx work.h++ $(common_sources)
work_CXXFLAGS = -D'GREETINGS="Good morning"'
.PHONY: test-objs
check-local: test-objs
test-objs:
test -f play.$(OBJEXT)
test -f foo.$(OBJEXT)
test -f sub/bar.$(OBJEXT)
test -f work-foo.$(OBJEXT)
test -f sub/work-bar.$(OBJEXT)
test -f work-work.$(OBJEXT)
END
mkdir sub build-aux
$ACLOCAL
$AUTOHEADER
test -f config.hxx.in
$AUTOCONF
$AUTOMAKE --add-missing
test -f build-aux/depcomp
# Not needed by C++ compilers.
test ! -e build-aux/compile
cat > work.h++ << 'END'
#define ACTION "work"
class Hello_CXX
{
public:
Hello_CXX() { }
virtual ~Hello_CXX () { }
void hello_cxx_class ();
};
END
cat > play.hh << 'END'
#define ACTION "play"
void hello_cxx_function (void);
END
cat > common.hpp << 'END'
/* Common header. */
#include <config.hxx>
#if !OK_AM
#error "missing OK from Makefile.am"
choke me
#endif
#if !OK_AC
#error "missing OK from configure.ac"
choke me
#endif
#include <iostream>
END
cat > work.cxx << 'END'
#include "common.hpp"
#include "work.h++"
#include <cstdlib>
using namespace std;
int main (void)
{
cout << "We are working :-(" << endl;
Hello_CXX *hello = new Hello_CXX;
hello->hello_cxx_class ();
return EXIT_SUCCESS;
}
END
cat > play.c++ << 'END'
#include "common.hpp"
#include "play.hh"
int main (void)
{
std::cout << "We are playing :-)" << std::endl;
hello_cxx_function ();
return 0;
}
END
cat > foo.cpp <<'END'
#include <config.hxx>
#include "work.h++"
#include <iostream>
using namespace std;
void Hello_CXX::hello_cxx_class (void)
{
cout << GREETINGS << ", " << ACTION << "." << endl;
}
END
cat > sub/bar.cc << 'END'
#include <config.hxx>
#include "play.hh"
#include <stdio.h>
void hello_cxx_function (void)
{
printf ("%s, %s!\n", GREETINGS, ACTION);
}
END
./configure
$MAKE
$MAKE test-objs
if ! cross_compiling; then
unindent > exp.play << 'END'
We are playing :-)
Howdy, play!
END
unindent > exp.work << 'END'
We are working :-(
Good morning, work.
END
for p in play work; do
./$p > got.$p || { cat got.$p; exit 1; }
cat exp.$p
cat got.$p
diff exp.$p got.$p
done
fi
$MAKE distcheck
: