libbuild2-autoconf/libbuild2-autoconf-tests/module/testscript

522 lines
10 KiB
Plaintext

# Note: --silent rather than --quiet to suppress module update diagnostics.
#
test.options += --no-default-options --serial-stop --silent --buildfile -
# We disable bdep auto-synchronization since we will potentially be updating
# the module from multiple parallel tests. Note that we've made sure it is
# up-to-date by pre-loading it in the tests project (see root.build for
# details).
#
+export BDEP_SYNC=0
# Note that we are using the libbuild2-autoconf-tests project as our
# amalgamation in order to get the module import location and config.c.
#
+cat <<EOI >=bootstrap.build
project = basics
#amalgamation =
subprojects =
version = 1.2.3
EOI
+cat <<EOI >=root.build
using c
using autoconf
EOI
: basics-autoconf
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.in;
#define VERSION "@version@"
#undef TRUE
#undef FALSE
#undef ONE
#undef ZERO
#undef VALUE
#undef TRUE
#undef FALSE
# undef MAYBE
#undef CUSTOM_LINE
#undef CUSTOM_BLOCK
#undef zzz_TEST_DUMMY1_H
#undef zzz_TEST_DUMMY2_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config}
{
TRUE = true
FALSE = [bool] false
ONE = 1
ZERO = [uint64] 000
VALUE = [uint64] 0123
MAYBE = true
CUSTOM_LINE = '#define CUSTOM 123'
CUSTOM_BLOCK = \
'
/* Make sure we do not redefine CUSTOM. */
#ifndef CUSTOM
# define CUSTOM 123
#endif
'
zzz_TEST_DUMMY2_H = '#define zzz_TEST_DUMMY2_H 2'
}
EOI
cat config.h >>EOO
#define VERSION "1.2.3"
#define TRUE 1
#undef FALSE
#define ONE 1
#undef ZERO
#define VALUE 123
/* TRUE already defined. */
/* FALSE already defined. */
#define MAYBE 1
#define CUSTOM 123
/* Make sure we do not redefine CUSTOM. */
#ifndef CUSTOM
# define CUSTOM 123
#endif
#define zzz_TEST_DUMMY1_H 1
#define zzz_TEST_DUMMY2_H 2
EOO
: basics-cmake
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.cmake;
#define VERSION "@version@"
#cmakedefine TRUE
#cmakedefine FALSE
#cmakedefine ONE
#cmakedefine ZERO
#cmakedefine VALUE
#cmakedefine TRUE
#cmakedefine FALSE
# cmakedefine MAYBE
#cmakedefine CUSTOM_LINE
#cmakedefine CUSTOM_BLOCK
#cmakedefine CUSTOM_BLOCK1 @version@
#cmakedefine TRUE1 true
#cmakedefine FALSE1 false
#cmakedefine VALUE1 @VALUE1@ /* @version@ */
#cmakedefine TRUE1 true
#cmakedefine FALSE1 false
#cmakedefine VALUE1 @VALUE1@ /* @version@ */
#cmakedefine zzz_TEST_DUMMY1_H @zzz_TEST_DUMMY1_H@
#cmakedefine zzz_TEST_DUMMY2_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config.h.cmake}
{
TRUE = true
FALSE = [bool] false
ONE = 1
ZERO = [uint64] 000
VALUE = [uint64] 0123
MAYBE = true
CUSTOM_LINE = '#define CUSTOM 123'
CUSTOM_BLOCK = \
'
/* Make sure we do not redefine CUSTOM. */
#ifndef CUSTOM
# define CUSTOM 123
#endif
'
CUSTOM_BLOCK1 = \
'
/* Make sure we do not redefine CUSTOM1. */
#ifndef CUSTOM1
# define CUSTOM1 123
#endif
'
TRUE1 = true
FALSE1 = [bool] false
VALUE1 = [uint64] 0123
zzz_TEST_DUMMY2_H = '#define zzz_TEST_DUMMY2_H 2'
}
EOI
cat config.h >>EOO
#define VERSION "1.2.3"
#define TRUE 1
#undef FALSE
#define ONE 1
#undef ZERO
#define VALUE 123
/* TRUE already defined. */
/* FALSE already defined. */
#define MAYBE 1
#define CUSTOM 123
/* Make sure we do not redefine CUSTOM. */
#ifndef CUSTOM
# define CUSTOM 123
#endif
/* Make sure we do not redefine CUSTOM1. */
#ifndef CUSTOM1
# define CUSTOM1 123
#endif
#define TRUE1 true
#undef FALSE1
#define VALUE1 123 /* 1.2.3 */
/* TRUE1 already defined. */
/* FALSE1 already defined. */
/* VALUE1 already defined. */
#define zzz_TEST_DUMMY1_H 1
#define zzz_TEST_DUMMY2_H 2
EOO
: basics-meson
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.in;
#define VERSION "@version@"
#mesondefine TRUE
#mesondefine FALSE
#mesondefine ONE
#mesondefine ZERO
#mesondefine VALUE
#mesondefine TRUE
#mesondefine FALSE
# mesondefine MAYBE
#mesondefine CUSTOM_LINE
#mesondefine CUSTOM_BLOCK
#mesondefine zzz_TEST_DUMMY1_H
#mesondefine zzz_TEST_DUMMY2_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config}
{
autoconf.flavor = meson
TRUE = true
FALSE = [bool] false
ONE = 1
ZERO = [uint64] 000
VALUE = [uint64] 0123
MAYBE = true
CUSTOM_LINE = '#define CUSTOM 123'
CUSTOM_BLOCK = \
'
/* Make sure we do not redefine CUSTOM. */
#ifndef CUSTOM
# define CUSTOM 123
#endif
'
zzz_TEST_DUMMY2_H = '#define zzz_TEST_DUMMY2_H 2'
}
EOI
cat config.h >>EOO
#define VERSION "1.2.3"
#define TRUE 1
#undef FALSE
#define ONE 1
#undef ZERO
#define VALUE 123
/* TRUE already defined. */
/* FALSE already defined. */
#define MAYBE 1
#define CUSTOM 123
/* Make sure we do not redefine CUSTOM. */
#ifndef CUSTOM
# define CUSTOM 123
#endif
#define zzz_TEST_DUMMY1_H 1
#define zzz_TEST_DUMMY2_H 2
EOO
: prefix
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.in;
#undef PREFIX_zzz_TEST_DUMMY1_H
#undef PREFIX_zzz_TEST_DUMMY2_H
#undef zzz_TEST_DUMMY3_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config}
{
autoconf.prefix = PREFIX_
PREFIX_zzz_TEST_DUMMY2_H = '#define PREFIX_zzz_TEST_DUMMY2_H 2'
}
EOI
cat config.h >>EOO
#define PREFIX_zzz_TEST_DUMMY1_H 1
#define PREFIX_zzz_TEST_DUMMY2_H 2
#define zzz_TEST_DUMMY3_H 1
EOO
: base
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.in;
#undef PREFIX_zzz_TEST_DUMMY4_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config}
{
autoconf.prefix = PREFIX_
}
EOI
cat config.h >>EOO
#define PREFIX_zzz_TEST_DUMMY1_H 1
#define zzz_TEST_DUMMY3_H 1
#ifdef PREFIX_zzz_TEST_DUMMY1_H
# define PREFIX_zzz_TEST_DUMMY4_H zzz_TEST_DUMMY3_H
#endif /*PREFIX_zzz_TEST_DUMMY1_H*/
EOO
: base-duplicate
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.in;
#undef PREFIX_zzz_TEST_DUMMY1_H
#undef zzz_TEST_DUMMY3_H
#undef PREFIX_zzz_TEST_DUMMY4_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config}
{
autoconf.prefix = PREFIX_
}
EOI
cat config.h >>EOO
#define PREFIX_zzz_TEST_DUMMY1_H 1
#define zzz_TEST_DUMMY3_H 1
/* Base PREFIX_zzz_TEST_DUMMY1_H already defined. */
/* Base zzz_TEST_DUMMY3_H already defined. */
#ifdef PREFIX_zzz_TEST_DUMMY1_H
# define PREFIX_zzz_TEST_DUMMY4_H zzz_TEST_DUMMY3_H
#endif /*PREFIX_zzz_TEST_DUMMY1_H*/
EOO
: base-custom
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.in;
#undef PREFIX_zzz_TEST_DUMMY4_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config}
{
autoconf.prefix = PREFIX_
PREFIX_zzz_TEST_DUMMY1_H = '#define PREFIX_zzz_TEST_DUMMY1_H 10'
zzz_TEST_DUMMY3_H = '#define zzz_TEST_DUMMY3_H 30'
}
EOI
cat config.h >>EOO
#define PREFIX_zzz_TEST_DUMMY1_H 10
#define zzz_TEST_DUMMY3_H 30
#ifdef PREFIX_zzz_TEST_DUMMY1_H
# define PREFIX_zzz_TEST_DUMMY4_H zzz_TEST_DUMMY3_H
#endif /*PREFIX_zzz_TEST_DUMMY1_H*/
EOO
: base-recursive
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.in;
#undef PREFIX_zzz_TEST_DUMMY5_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config}
{
autoconf.prefix = PREFIX_
}
EOI
cat config.h >>EOO
#define zzz_TEST_DUMMY3_H 1
#define PREFIX_zzz_TEST_DUMMY1_H 1
/* Base zzz_TEST_DUMMY3_H already defined. */
#ifdef PREFIX_zzz_TEST_DUMMY1_H
# define PREFIX_zzz_TEST_DUMMY4_H zzz_TEST_DUMMY3_H
#endif /*PREFIX_zzz_TEST_DUMMY1_H*/
#ifdef zzz_TEST_DUMMY3_H
# define PREFIX_zzz_TEST_DUMMY5_H PREFIX_zzz_TEST_DUMMY4_H
#endif /*zzz_TEST_DUMMY3_H*/
EOO
: substitution-map
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.in;
#undef _GNU_SOURCE
#undef _POSIX_SOURCE
#undef FOO
EOI
$* <<EOI &config.h &config.h.d;
gnu = false
./: h{config}: in{config}
{
autoconf.substitutions = _GNU_SOURCE@$gnu _POSIX_SOURCE@true
FOO = true
}
EOI
cat config.h >>EOO
#undef _GNU_SOURCE
#define _POSIX_SOURCE 1
#define FOO 1
EOO
: alias-map
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.in;
#undef TEST_DUMMY1_H
#undef TEST_DUMMY2_H
#undef TEST_DUMMY3_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config}
{
autoconf.aliases = TEST_DUMMY1_H@zzz_TEST_DUMMY1_H
autoconf.aliases += TEST_DUMMY2_H@zzz_TEST_DUMMY2_H
autoconf.aliases += TEST_DUMMY3_H@zzz_TEST_DUMMY3_H
zzz_TEST_DUMMY2_H = '#define zzz_TEST_DUMMY2_H 20'
}
EOI
cat config.h >>EOO
#define zzz_TEST_DUMMY1_H 1
#undef TEST_DUMMY1_H
#ifdef zzz_TEST_DUMMY1_H
# define TEST_DUMMY1_H zzz_TEST_DUMMY1_H
#endif
#define zzz_TEST_DUMMY2_H 20
#undef TEST_DUMMY2_H
#ifdef zzz_TEST_DUMMY2_H
# define TEST_DUMMY2_H zzz_TEST_DUMMY2_H
#endif
#define zzz_TEST_DUMMY3_H 1
#undef TEST_DUMMY3_H
#define TEST_DUMMY3_H zzz_TEST_DUMMY3_H
EOO
: alias-map-prefix
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.in;
#undef PREFIX_TEST_DUMMY1_H
#undef PREFIX_TEST_DUMMY3_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config}
{
autoconf.prefix = PREFIX_
autoconf.aliases = PREFIX_TEST_DUMMY1_H@PREFIX_zzz_TEST_DUMMY1_H
autoconf.aliases += PREFIX_TEST_DUMMY3_H@zzz_TEST_DUMMY3_H
}
EOI
cat config.h >>EOO
#define PREFIX_zzz_TEST_DUMMY1_H 1
#undef PREFIX_TEST_DUMMY1_H
#ifdef PREFIX_zzz_TEST_DUMMY1_H
# define PREFIX_TEST_DUMMY1_H PREFIX_zzz_TEST_DUMMY1_H
#endif
#define zzz_TEST_DUMMY3_H 1
#undef PREFIX_TEST_DUMMY3_H
#define PREFIX_TEST_DUMMY3_H zzz_TEST_DUMMY3_H
EOO
: alias-map-prefix-same-name
:
mkdir build;
ln -s ../../bootstrap.build ../../root.build build/;
cat <<EOI >=config.h.cmake;
#cmakedefine PREFIX_zzz_TEST_DUMMY3_H
EOI
$* <<EOI &config.h &config.h.d;
./: h{config}: in{config.h.cmake}
{
autoconf.prefix = PREFIX_
autoconf.aliases = PREFIX_zzz_TEST_DUMMY3_H@zzz_TEST_DUMMY3_H
}
EOI
cat config.h >>EOO
#define zzz_TEST_DUMMY3_H 1
#undef PREFIX_zzz_TEST_DUMMY3_H
#define PREFIX_zzz_TEST_DUMMY3_H zzz_TEST_DUMMY3_H
EOO