📄 torture.at
字号:
# -*- Autotest -*-# Copyright (C) 2000, 2001, 2002, 2003 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, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA# 02111-1307, USA.AT_BANNER([[Testing config.status.]])## ---------------------------------------- #### AC_CONFIG_COMMANDS with empty commands. #### ---------------------------------------- ##AT_CHECK_MACRO([AC_CONFIG_COMMANDS with empty commands],[[AC_CONFIG_COMMANDS([foo], [], [:])]])## -------------------------- #### Multiple AC_CONFIG_FILES. #### -------------------------- ##AT_SETUP([Multiple AC_CONFIG_FILES])AT_CONFIGURE_AC([[AC_CONFIG_FILES([foo foo])]])AT_CHECK_AUTOCONF([], 1, [], [ignore])AT_CLEANUP## ------------ #### AC_ARG_VAR. #### ------------ ### AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE)# ----------------------------------------------# Check that AC_ARG_VAR caches the latest values, diagnoses# inconsistencies, and arms config.status.m4_define([AT_CHECK_AC_ARG_VAR],[rm -f config.cache# Initial value.m4_ifval([$1], [precious='$1'; export precious], [unset precious])AT_CHECK_CONFIGURE([--config-cache -q])AT_CHECK([cat file], [], [`$1'])# Testing --recheck: 1. have the environment `forget' about PRECIOUS.unset precious# 2. Rerun config.status to recreate `file'.AT_CHECK([./config.status --recheck], [], [ignore])AT_CHECK([./config.status], [], [ignore])# 3. Check that file contains the old value of PRECIOUS.AT_CHECK([cat file], [], [`$1'])# Second value: we should issue an error here: the value# has changed!m4_ifval([$2], [precious='$2'; export precious], [unset precious])AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore])])# AT_CHECK_AC_ARG_VARAT_SETUP([AC_ARG_VAR])# We don't want to run this test if this shell doesn't support# `unset'.AT_CHECK([if (FOO=FOO; unset FOO) >/dev/null 2>&1; then exit 0else exit 77fi])AT_DATA([configure.ac],[[AC_INITAC_ARG_VAR([precious], [this variable costs a lot])echo "precious:$precious"AC_OUTPUT(file)]])AT_DATA([file.in],[[`@precious@']])AT_CHECK_AUTOCONF# Set a precious variableAT_CHECK_AC_ARG_VAR([], [apple of my eye])# Unset a precious variableAT_CHECK_AC_ARG_VAR([apple of my eye], [])# Change a precious variableAT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye])AT_CLEANUP## ---------------------------------------------- #### AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. #### ---------------------------------------------- ##AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS])AT_DATA([configure.ac],[[AC_INITrm -rf header var-header file var-file link var-link command var-commandecho 'OK' >input# Be sure to also stress the associated INIT-CMDS.case $what_to_test in header) AC_CONFIG_HEADERS(header:input);; var-header) AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);; file) AC_CONFIG_FILES(file:input);; var-file) AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);; command) AC_CONFIG_COMMANDS(command:input, [cp input command]);; var-command) AC_CONFIG_COMMANDS(var-command:$command_in, [cp $command_in var-command], [command_in=input]);; link) AC_CONFIG_LINKS(link:input);; var-link) AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);;esacAC_OUTPUT]])AT_CHECK_AUTOCONF# AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command))# ------------------------------------------------------------------# Check that THING and var-THING (which uses variables in AC_CONFIG_THING)# are properly created, with the right content.# Use `grep OK' instead of a simple `cat' to avoid banners such as in# AC_CONFIG_HEADERS.m4_define([AT_CHECK_CONFIG_CREATION],[AT_CHECK_CONFIGURE([what_to_test=$1])AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null], [ignore], [$1])AT_CHECK([grep OK $1], [], [OK])AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create])# config.status might be stupidly expecting data on stdin, if it's# really broken...AT_CHECK([./config.status var-$1 </dev/null], [], [ignore])AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null], [ignore], [var-$1])AT_CHECK([grep OK var-$1], [], [OK])])# AT_CHECK_CONFIG_CREATION# Create a fileAT_CHECK_CONFIG_CREATION(file)# Create a headerAT_CHECK_CONFIG_CREATION(header)# Execute a commandAT_CHECK_CONFIG_CREATION(command)# Create a linkAT_CHECK_CONFIG_CREATION(link)AT_CLEANUP## ------------------- #### Missing templates. #### ------------------- ### Check that config.status detects missing input filesAT_SETUP([Missing templates])AT_DATA([configure.ac],[[AC_INITAC_CONFIG_FILES([nonexistent])AC_OUTPUT]])AT_CHECK_AUTOCONFAT_CHECK_CONFIGURE([], [1], [],[[config.status: error: cannot find input file: nonexistent.in]])# Make sure that the output file doesn't existAT_CHECK([test -f nonexistent], 1)AT_CLEANUP## ---------------------- #### configure invocation. #### ---------------------- ### Check that `configure' and `config.status' honor their interface.## We run `./configure one=val1 --enable-two=val2 --with-three=val3'# and verify that (i) `configure' correctly receives the arguments and# (ii) correctly passes them to `config.status', which we check by# running `config.status --recheck'.AT_SETUP([configure invocation])AT_DATA([configure.ac],[[AC_INITecho "result=$one$enable_two$with_three"AC_OUTPUT]])AT_CHECK_AUTOCONFAT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three | sed -n -e 's/^result=//p'], 0, [onetwothree])AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0, [onetwothree])AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"| sed -n -e 's/^result=//p'], 0, ["'$ " ' $ "'$])AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0, ["'$ " ' $ "'$])AT_CLEANUP## -------------------------------------------- #### Check that `#define' templates are honored. #### -------------------------------------------- ### Use various forms of `#define' templates, and make sure there are no# problems when a symbol is prefix of another.AT_SETUP([#define header templates])AT_DATA([configure.ac],[[AC_INITAC_CONFIG_HEADERS(config.h:config.hin)# I18n of dummy variables: their French translations.AC_DEFINE(foo, toto)AC_DEFINE(bar, tata)AC_DEFINE(baz, titi)AC_DEFINE(fubar, tutu)# Symbols which are prefixes of another.AC_DEFINE(a, A)AC_DEFINE(aaa, AAA)AC_DEFINE(aa, AA)AC_CONFIG_FILES(defs)# Things included in confdefs.h, but which make no sense in# config.h, nor in $DEFS.cat <<\EOF >>confdefs.h/* Hi Mum! Look, I am doing C++! */#ifdef __cplusplusvoid exit (int status);#endifEOF# In addition of config.h output a full DEFSAC_OUTPUT_MAKE_DEFSDEFS_SAVED=$DEFSAC_SUBST(DEFS_SAVED)AC_OUTPUT]])AT_DATA([defs.in],[[@DEFS_SAVED@]])AT_DATA([config.hin],[[#define foo 0# define bar bar# define baz "Archimedes was sinking in his baz"# define fubar tutu#define a B#define aa BB#define aaa BBB#undef a#undef aa#undef aaa]])AT_CHECK_AUTOCONFAT_CHECK_CONFIGUREAT_DATA([expout],[[/* config.h. Generated by configure. */#define foo toto# define bar tata# define baz titi# define fubar tutu#define a A#define aa AA#define aaa AAA#define a A#define aa AA#define aaa AAA]])AT_CHECK([cat config.h], 0, expout)# Check the value of DEFS.AT_DATA([expout],[[-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA]])# Because we strip trailing spaces in `testsuite' we can't leave one in# expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS.AT_CHECK([sed -e 's/ $//' defs], 0, expout)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -