[Python-checkins] bpo-45847: Port test modules to PY_STDLIB_MOD (GH-29660)

tiran webhook-mailer at python.org
Sat Nov 20 10:43:17 EST 2021


https://github.com/python/cpython/commit/f36c69a26ee880acf62a5ae8c5da49312e84c66d
commit: f36c69a26ee880acf62a5ae8c5da49312e84c66d
branch: main
author: Christian Heimes <christian at python.org>
committer: tiran <christian at python.org>
date: 2021-11-20T16:43:10+01:00
summary:

bpo-45847: Port test modules to PY_STDLIB_MOD (GH-29660)

files:
M Makefile.pre.in
M Modules/Setup.stdlib.in
M configure
M configure.ac
M setup.py

diff --git a/Makefile.pre.in b/Makefile.pre.in
index 312e52486f296..11ffdaabc617b 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -211,11 +211,13 @@ OPENSSL_LIBS=@OPENSSL_LIBS@
 OPENSSL_LDFLAGS=@OPENSSL_LDFLAGS@
 OPENSSL_RPATH=@OPENSSL_RPATH@
 
-# Module compiler and linker flags
-#   yes: module is available
-#   missing: build dependency is missing
-#   disabled: module is disabled
-#   n/a: module is not available on the current platform
+# Module state, compiler flags and linker flags
+# Empty CFLAGS and LDFLAGS are omitted.
+# states:
+#   * yes: module is available
+#   * missing: build dependency is missing
+#   * disabled: module is disabled
+#   * n/a: module is not available on the current platform
 # MODULE_EGG=yes  # yes, missing, disabled, n/a
 # MODULE_EGG_CFLAGS=
 # MODULE_EGG_LDFLAGS=
diff --git a/Modules/Setup.stdlib.in b/Modules/Setup.stdlib.in
index 4e5c158c0fdb2..fa553fb524f56 100644
--- a/Modules/Setup.stdlib.in
+++ b/Modules/Setup.stdlib.in
@@ -76,3 +76,18 @@
 
 # _scproxy needs SystemConfiguration and CoreFoundation framework
 @MODULE__SCPROXY_TRUE at _scproxy _scproxy.c
+
+
+############################################################################
+# Test modules
+
+ at MODULE__XXTESTFUZZ_TRUE@_xxtestfuzz _xxtestfuzz/_xxtestfuzz.c _xxtestfuzz/fuzzer.c
+ at MODULE__TESTBUFFER_TRUE@_testbuffer _testbuffer.c
+ at MODULE__TESTINTERNALCAPI_TRUE@_testinternalcapi _testinternalcapi.c
+
+# Some testing modules MUST be built as shared libraries.
+*shared*
+ at MODULE__TESTCAPI_TRUE@_testcapi _testcapimodule.c
+ at MODULE__TESTIMPORTMULTIPLE_TRUE@_testimportmultiple _testimportmultiple.c
+ at MODULE__TESTMULTIPHASE_TRUE@_testmultiphase _testmultiphase.c
+ at MODULE__CTYPES_TEST_TRUE@_ctypes_test _ctypes/_ctypes_test.c
diff --git a/configure b/configure
index dec3aa0586b83..7d2ef8f912073 100755
--- a/configure
+++ b/configure
@@ -624,6 +624,20 @@ ac_includes_default="\
 
 ac_subst_vars='LTLIBOBJS
 MODULE_BLOCK
+MODULE__CTYPES_TEST_FALSE
+MODULE__CTYPES_TEST_TRUE
+MODULE__XXTESTFUZZ_FALSE
+MODULE__XXTESTFUZZ_TRUE
+MODULE__TESTMULTIPHASE_FALSE
+MODULE__TESTMULTIPHASE_TRUE
+MODULE__TESTIMPORTMULTIPLE_FALSE
+MODULE__TESTIMPORTMULTIPLE_TRUE
+MODULE__TESTBUFFER_FALSE
+MODULE__TESTBUFFER_TRUE
+MODULE__TESTINTERNALCAPI_FALSE
+MODULE__TESTINTERNALCAPI_TRUE
+MODULE__TESTCAPI_FALSE
+MODULE__TESTCAPI_TRUE
 MODULE__SQLITE3_FALSE
 MODULE__SQLITE3_TRUE
 MODULE__DECIMAL_FALSE
@@ -19560,20 +19574,11 @@ esac
   as_fn_append MODULE_BLOCK "MODULE_OSSAUDIODEV=$py_cv_module_ossaudiodev$as_nl"
   if test "x$py_cv_module_ossaudiodev" = xyes; then :
 
-    as_fn_append MODULE_BLOCK "MODULE_OSSAUDIODEV_CFLAGS=$as_nl"
-    as_fn_append MODULE_BLOCK "MODULE_OSSAUDIODEV_LDFLAGS=$as_nl"
-     if true; then
-  MODULE_OSSAUDIODEV_TRUE=
-  MODULE_OSSAUDIODEV_FALSE='#'
-else
-  MODULE_OSSAUDIODEV_TRUE='#'
-  MODULE_OSSAUDIODEV_FALSE=
-fi
 
 
-else
 
-     if false; then
+fi
+   if test "$py_cv_module_ossaudiodev" = yes; then
   MODULE_OSSAUDIODEV_TRUE=
   MODULE_OSSAUDIODEV_FALSE='#'
 else
@@ -19581,8 +19586,6 @@ else
   MODULE_OSSAUDIODEV_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_ossaudiodev" >&5
 $as_echo "$py_cv_module_ossaudiodev" >&6; }
 
@@ -19610,20 +19613,11 @@ esac
   as_fn_append MODULE_BLOCK "MODULE__SCPROXY=$py_cv_module__scproxy$as_nl"
   if test "x$py_cv_module__scproxy" = xyes; then :
 
-    as_fn_append MODULE_BLOCK "MODULE__SCPROXY_CFLAGS=$as_nl"
-    as_fn_append MODULE_BLOCK "MODULE__SCPROXY_LDFLAGS=-framework SystemConfiguration -framework CoreFoundation$as_nl"
-     if true; then
-  MODULE__SCPROXY_TRUE=
-  MODULE__SCPROXY_FALSE='#'
-else
-  MODULE__SCPROXY_TRUE='#'
-  MODULE__SCPROXY_FALSE=
-fi
-
 
-else
+    as_fn_append MODULE_BLOCK "MODULE__SCPROXY_LDFLAGS=-framework SystemConfiguration -framework CoreFoundation$as_nl"
 
-     if false; then
+fi
+   if test "$py_cv_module__scproxy" = yes; then
   MODULE__SCPROXY_TRUE=
   MODULE__SCPROXY_FALSE='#'
 else
@@ -19631,8 +19625,6 @@ else
   MODULE__SCPROXY_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__scproxy" >&5
 $as_echo "$py_cv_module__scproxy" >&6; }
 
@@ -19663,18 +19655,9 @@ esac
 
     as_fn_append MODULE_BLOCK "MODULE_PYEXPAT_CFLAGS=$LIBEXPAT_CFLAGS$as_nl"
     as_fn_append MODULE_BLOCK "MODULE_PYEXPAT_LDFLAGS=$LIBEXPAT_LDFLAGS$as_nl"
-     if true; then
-  MODULE_PYEXPAT_TRUE=
-  MODULE_PYEXPAT_FALSE='#'
-else
-  MODULE_PYEXPAT_TRUE='#'
-  MODULE_PYEXPAT_FALSE=
-fi
-
 
-else
-
-     if false; then
+fi
+   if test "$py_cv_module_pyexpat" = yes; then
   MODULE_PYEXPAT_TRUE=
   MODULE_PYEXPAT_FALSE='#'
 else
@@ -19682,8 +19665,6 @@ else
   MODULE_PYEXPAT_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module_pyexpat" >&5
 $as_echo "$py_cv_module_pyexpat" >&6; }
 
@@ -19712,19 +19693,10 @@ esac
   if test "x$py_cv_module__elementtree" = xyes; then :
 
     as_fn_append MODULE_BLOCK "MODULE__ELEMENTTREE_CFLAGS=$LIBEXPAT_CFLAGS$as_nl"
-    as_fn_append MODULE_BLOCK "MODULE__ELEMENTTREE_LDFLAGS=$as_nl"
-     if true; then
-  MODULE__ELEMENTTREE_TRUE=
-  MODULE__ELEMENTTREE_FALSE='#'
-else
-  MODULE__ELEMENTTREE_TRUE='#'
-  MODULE__ELEMENTTREE_FALSE=
-fi
-
 
-else
 
-     if false; then
+fi
+   if test "$py_cv_module__elementtree" = yes; then
   MODULE__ELEMENTTREE_TRUE=
   MODULE__ELEMENTTREE_FALSE='#'
 else
@@ -19732,8 +19704,6 @@ else
   MODULE__ELEMENTTREE_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__elementtree" >&5
 $as_echo "$py_cv_module__elementtree" >&6; }
 
@@ -19762,20 +19732,11 @@ esac
   as_fn_append MODULE_BLOCK "MODULE__MD5=$py_cv_module__md5$as_nl"
   if test "x$py_cv_module__md5" = xyes; then :
 
-    as_fn_append MODULE_BLOCK "MODULE__MD5_CFLAGS=$as_nl"
-    as_fn_append MODULE_BLOCK "MODULE__MD5_LDFLAGS=$as_nl"
-     if true; then
-  MODULE__MD5_TRUE=
-  MODULE__MD5_FALSE='#'
-else
-  MODULE__MD5_TRUE='#'
-  MODULE__MD5_FALSE=
-fi
 
 
-else
 
-     if false; then
+fi
+   if test "$py_cv_module__md5" = yes; then
   MODULE__MD5_TRUE=
   MODULE__MD5_FALSE='#'
 else
@@ -19783,8 +19744,6 @@ else
   MODULE__MD5_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__md5" >&5
 $as_echo "$py_cv_module__md5" >&6; }
 
@@ -19812,20 +19771,11 @@ esac
   as_fn_append MODULE_BLOCK "MODULE__SHA1=$py_cv_module__sha1$as_nl"
   if test "x$py_cv_module__sha1" = xyes; then :
 
-    as_fn_append MODULE_BLOCK "MODULE__SHA1_CFLAGS=$as_nl"
-    as_fn_append MODULE_BLOCK "MODULE__SHA1_LDFLAGS=$as_nl"
-     if true; then
-  MODULE__SHA1_TRUE=
-  MODULE__SHA1_FALSE='#'
-else
-  MODULE__SHA1_TRUE='#'
-  MODULE__SHA1_FALSE=
-fi
 
 
-else
 
-     if false; then
+fi
+   if test "$py_cv_module__sha1" = yes; then
   MODULE__SHA1_TRUE=
   MODULE__SHA1_FALSE='#'
 else
@@ -19833,8 +19783,6 @@ else
   MODULE__SHA1_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha1" >&5
 $as_echo "$py_cv_module__sha1" >&6; }
 
@@ -19862,20 +19810,11 @@ esac
   as_fn_append MODULE_BLOCK "MODULE__SHA256=$py_cv_module__sha256$as_nl"
   if test "x$py_cv_module__sha256" = xyes; then :
 
-    as_fn_append MODULE_BLOCK "MODULE__SHA256_CFLAGS=$as_nl"
-    as_fn_append MODULE_BLOCK "MODULE__SHA256_LDFLAGS=$as_nl"
-     if true; then
-  MODULE__SHA256_TRUE=
-  MODULE__SHA256_FALSE='#'
-else
-  MODULE__SHA256_TRUE='#'
-  MODULE__SHA256_FALSE=
-fi
 
 
-else
 
-     if false; then
+fi
+   if test "$py_cv_module__sha256" = yes; then
   MODULE__SHA256_TRUE=
   MODULE__SHA256_FALSE='#'
 else
@@ -19883,8 +19822,6 @@ else
   MODULE__SHA256_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha256" >&5
 $as_echo "$py_cv_module__sha256" >&6; }
 
@@ -19912,20 +19849,11 @@ esac
   as_fn_append MODULE_BLOCK "MODULE__SHA512=$py_cv_module__sha512$as_nl"
   if test "x$py_cv_module__sha512" = xyes; then :
 
-    as_fn_append MODULE_BLOCK "MODULE__SHA512_CFLAGS=$as_nl"
-    as_fn_append MODULE_BLOCK "MODULE__SHA512_LDFLAGS=$as_nl"
-     if true; then
-  MODULE__SHA512_TRUE=
-  MODULE__SHA512_FALSE='#'
-else
-  MODULE__SHA512_TRUE='#'
-  MODULE__SHA512_FALSE=
-fi
 
 
-else
 
-     if false; then
+fi
+   if test "$py_cv_module__sha512" = yes; then
   MODULE__SHA512_TRUE=
   MODULE__SHA512_FALSE='#'
 else
@@ -19933,8 +19861,6 @@ else
   MODULE__SHA512_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha512" >&5
 $as_echo "$py_cv_module__sha512" >&6; }
 
@@ -19962,20 +19888,11 @@ esac
   as_fn_append MODULE_BLOCK "MODULE__SHA3=$py_cv_module__sha3$as_nl"
   if test "x$py_cv_module__sha3" = xyes; then :
 
-    as_fn_append MODULE_BLOCK "MODULE__SHA3_CFLAGS=$as_nl"
-    as_fn_append MODULE_BLOCK "MODULE__SHA3_LDFLAGS=$as_nl"
-     if true; then
-  MODULE__SHA3_TRUE=
-  MODULE__SHA3_FALSE='#'
-else
-  MODULE__SHA3_TRUE='#'
-  MODULE__SHA3_FALSE=
-fi
 
 
-else
 
-     if false; then
+fi
+   if test "$py_cv_module__sha3" = yes; then
   MODULE__SHA3_TRUE=
   MODULE__SHA3_FALSE='#'
 else
@@ -19983,8 +19900,6 @@ else
   MODULE__SHA3_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha3" >&5
 $as_echo "$py_cv_module__sha3" >&6; }
 
@@ -20012,20 +19927,11 @@ esac
   as_fn_append MODULE_BLOCK "MODULE__BLAKE2=$py_cv_module__blake2$as_nl"
   if test "x$py_cv_module__blake2" = xyes; then :
 
-    as_fn_append MODULE_BLOCK "MODULE__BLAKE2_CFLAGS=$as_nl"
-    as_fn_append MODULE_BLOCK "MODULE__BLAKE2_LDFLAGS=$as_nl"
-     if true; then
-  MODULE__BLAKE2_TRUE=
-  MODULE__BLAKE2_FALSE='#'
-else
-  MODULE__BLAKE2_TRUE='#'
-  MODULE__BLAKE2_FALSE=
-fi
 
 
-else
 
-     if false; then
+fi
+   if test "$py_cv_module__blake2" = yes; then
   MODULE__BLAKE2_TRUE=
   MODULE__BLAKE2_FALSE='#'
 else
@@ -20033,8 +19939,6 @@ else
   MODULE__BLAKE2_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__blake2" >&5
 $as_echo "$py_cv_module__blake2" >&6; }
 
@@ -20065,18 +19969,9 @@ esac
 
     as_fn_append MODULE_BLOCK "MODULE__DECIMAL_CFLAGS=$LIBMPDEC_CFLAGS$as_nl"
     as_fn_append MODULE_BLOCK "MODULE__DECIMAL_LDFLAGS=$LIBMPDEC_LDFLAGS$as_nl"
-     if true; then
-  MODULE__DECIMAL_TRUE=
-  MODULE__DECIMAL_FALSE='#'
-else
-  MODULE__DECIMAL_TRUE='#'
-  MODULE__DECIMAL_FALSE=
-fi
-
 
-else
-
-     if false; then
+fi
+   if test "$py_cv_module__decimal" = yes; then
   MODULE__DECIMAL_TRUE=
   MODULE__DECIMAL_FALSE='#'
 else
@@ -20084,8 +19979,6 @@ else
   MODULE__DECIMAL_FALSE=
 fi
 
-
-fi
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__decimal" >&5
 $as_echo "$py_cv_module__decimal" >&6; }
 
@@ -20115,7 +20008,9 @@ esac
 
     as_fn_append MODULE_BLOCK "MODULE__SQLITE3_CFLAGS=$LIBSQLITE3_CFLAGS$as_nl"
     as_fn_append MODULE_BLOCK "MODULE__SQLITE3_LDFLAGS=$LIBSQLITE3_LIBS$as_nl"
-     if true; then
+
+fi
+   if test "$py_cv_module__sqlite3" = yes; then
   MODULE__SQLITE3_TRUE=
   MODULE__SQLITE3_FALSE='#'
 else
@@ -20123,21 +20018,282 @@ else
   MODULE__SQLITE3_FALSE=
 fi
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sqlite3" >&5
+$as_echo "$py_cv_module__sqlite3" >&6; }
+
 
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testcapi" >&5
+$as_echo_n "checking for stdlib extension module _testcapi... " >&6; }
+      case $py_stdlib_not_available in #(
+  *_testcapi*) :
+    py_cv_module__testcapi=n/a ;; #(
+  *) :
+
+      if test "$TEST_MODULES" = yes; then :
+  if true; then :
+  py_cv_module__testcapi=yes
 else
+  py_cv_module__testcapi=missing
+fi
+else
+  py_cv_module__testcapi=disabled
 
-     if false; then
-  MODULE__SQLITE3_TRUE=
-  MODULE__SQLITE3_FALSE='#'
+fi
+
+   ;;
+esac
+  as_fn_append MODULE_BLOCK "MODULE__TESTCAPI=$py_cv_module__testcapi$as_nl"
+  if test "x$py_cv_module__testcapi" = xyes; then :
+
+
+
+
+fi
+   if test "$py_cv_module__testcapi" = yes; then
+  MODULE__TESTCAPI_TRUE=
+  MODULE__TESTCAPI_FALSE='#'
 else
-  MODULE__SQLITE3_TRUE='#'
-  MODULE__SQLITE3_FALSE=
+  MODULE__TESTCAPI_TRUE='#'
+  MODULE__TESTCAPI_FALSE=
 fi
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testcapi" >&5
+$as_echo "$py_cv_module__testcapi" >&6; }
+
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testinternalcapi" >&5
+$as_echo_n "checking for stdlib extension module _testinternalcapi... " >&6; }
+      case $py_stdlib_not_available in #(
+  *_testinternalcapi*) :
+    py_cv_module__testinternalcapi=n/a ;; #(
+  *) :
+
+      if test "$TEST_MODULES" = yes; then :
+  if true; then :
+  py_cv_module__testinternalcapi=yes
+else
+  py_cv_module__testinternalcapi=missing
 fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sqlite3" >&5
-$as_echo "$py_cv_module__sqlite3" >&6; }
+else
+  py_cv_module__testinternalcapi=disabled
+
+fi
+
+   ;;
+esac
+  as_fn_append MODULE_BLOCK "MODULE__TESTINTERNALCAPI=$py_cv_module__testinternalcapi$as_nl"
+  if test "x$py_cv_module__testinternalcapi" = xyes; then :
+
+
+
+
+fi
+   if test "$py_cv_module__testinternalcapi" = yes; then
+  MODULE__TESTINTERNALCAPI_TRUE=
+  MODULE__TESTINTERNALCAPI_FALSE='#'
+else
+  MODULE__TESTINTERNALCAPI_TRUE='#'
+  MODULE__TESTINTERNALCAPI_FALSE=
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testinternalcapi" >&5
+$as_echo "$py_cv_module__testinternalcapi" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testbuffer" >&5
+$as_echo_n "checking for stdlib extension module _testbuffer... " >&6; }
+      case $py_stdlib_not_available in #(
+  *_testbuffer*) :
+    py_cv_module__testbuffer=n/a ;; #(
+  *) :
+
+      if test "$TEST_MODULES" = yes; then :
+  if true; then :
+  py_cv_module__testbuffer=yes
+else
+  py_cv_module__testbuffer=missing
+fi
+else
+  py_cv_module__testbuffer=disabled
+
+fi
+
+   ;;
+esac
+  as_fn_append MODULE_BLOCK "MODULE__TESTBUFFER=$py_cv_module__testbuffer$as_nl"
+  if test "x$py_cv_module__testbuffer" = xyes; then :
+
+
+
+
+fi
+   if test "$py_cv_module__testbuffer" = yes; then
+  MODULE__TESTBUFFER_TRUE=
+  MODULE__TESTBUFFER_FALSE='#'
+else
+  MODULE__TESTBUFFER_TRUE='#'
+  MODULE__TESTBUFFER_FALSE=
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testbuffer" >&5
+$as_echo "$py_cv_module__testbuffer" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testimportmultiple" >&5
+$as_echo_n "checking for stdlib extension module _testimportmultiple... " >&6; }
+      case $py_stdlib_not_available in #(
+  *_testimportmultiple*) :
+    py_cv_module__testimportmultiple=n/a ;; #(
+  *) :
+
+      if test "$TEST_MODULES" = yes; then :
+  if true; then :
+  py_cv_module__testimportmultiple=yes
+else
+  py_cv_module__testimportmultiple=missing
+fi
+else
+  py_cv_module__testimportmultiple=disabled
+
+fi
+
+   ;;
+esac
+  as_fn_append MODULE_BLOCK "MODULE__TESTIMPORTMULTIPLE=$py_cv_module__testimportmultiple$as_nl"
+  if test "x$py_cv_module__testimportmultiple" = xyes; then :
+
+
+
+
+fi
+   if test "$py_cv_module__testimportmultiple" = yes; then
+  MODULE__TESTIMPORTMULTIPLE_TRUE=
+  MODULE__TESTIMPORTMULTIPLE_FALSE='#'
+else
+  MODULE__TESTIMPORTMULTIPLE_TRUE='#'
+  MODULE__TESTIMPORTMULTIPLE_FALSE=
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testimportmultiple" >&5
+$as_echo "$py_cv_module__testimportmultiple" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _testmultiphase" >&5
+$as_echo_n "checking for stdlib extension module _testmultiphase... " >&6; }
+      case $py_stdlib_not_available in #(
+  *_testmultiphase*) :
+    py_cv_module__testmultiphase=n/a ;; #(
+  *) :
+
+      if test "$TEST_MODULES" = yes; then :
+  if true; then :
+  py_cv_module__testmultiphase=yes
+else
+  py_cv_module__testmultiphase=missing
+fi
+else
+  py_cv_module__testmultiphase=disabled
+
+fi
+
+   ;;
+esac
+  as_fn_append MODULE_BLOCK "MODULE__TESTMULTIPHASE=$py_cv_module__testmultiphase$as_nl"
+  if test "x$py_cv_module__testmultiphase" = xyes; then :
+
+
+
+
+fi
+   if test "$py_cv_module__testmultiphase" = yes; then
+  MODULE__TESTMULTIPHASE_TRUE=
+  MODULE__TESTMULTIPHASE_FALSE='#'
+else
+  MODULE__TESTMULTIPHASE_TRUE='#'
+  MODULE__TESTMULTIPHASE_FALSE=
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__testmultiphase" >&5
+$as_echo "$py_cv_module__testmultiphase" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _xxtestfuzz" >&5
+$as_echo_n "checking for stdlib extension module _xxtestfuzz... " >&6; }
+      case $py_stdlib_not_available in #(
+  *_xxtestfuzz*) :
+    py_cv_module__xxtestfuzz=n/a ;; #(
+  *) :
+
+      if test "$TEST_MODULES" = yes; then :
+  if true; then :
+  py_cv_module__xxtestfuzz=yes
+else
+  py_cv_module__xxtestfuzz=missing
+fi
+else
+  py_cv_module__xxtestfuzz=disabled
+
+fi
+
+   ;;
+esac
+  as_fn_append MODULE_BLOCK "MODULE__XXTESTFUZZ=$py_cv_module__xxtestfuzz$as_nl"
+  if test "x$py_cv_module__xxtestfuzz" = xyes; then :
+
+
+
+
+fi
+   if test "$py_cv_module__xxtestfuzz" = yes; then
+  MODULE__XXTESTFUZZ_TRUE=
+  MODULE__XXTESTFUZZ_FALSE='#'
+else
+  MODULE__XXTESTFUZZ_TRUE='#'
+  MODULE__XXTESTFUZZ_FALSE=
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__xxtestfuzz" >&5
+$as_echo "$py_cv_module__xxtestfuzz" >&6; }
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _ctypes_test" >&5
+$as_echo_n "checking for stdlib extension module _ctypes_test... " >&6; }
+      case $py_stdlib_not_available in #(
+  *_ctypes_test*) :
+    py_cv_module__ctypes_test=n/a ;; #(
+  *) :
+
+      if test "$TEST_MODULES" = yes; then :
+  if true; then :
+  py_cv_module__ctypes_test=yes
+else
+  py_cv_module__ctypes_test=missing
+fi
+else
+  py_cv_module__ctypes_test=disabled
+
+fi
+
+   ;;
+esac
+  as_fn_append MODULE_BLOCK "MODULE__CTYPES_TEST=$py_cv_module__ctypes_test$as_nl"
+  if test "x$py_cv_module__ctypes_test" = xyes; then :
+
+
+    as_fn_append MODULE_BLOCK "MODULE__CTYPES_TEST_LDFLAGS=-lm$as_nl"
+
+fi
+   if test "$py_cv_module__ctypes_test" = yes; then
+  MODULE__CTYPES_TEST_TRUE=
+  MODULE__CTYPES_TEST_FALSE='#'
+else
+  MODULE__CTYPES_TEST_TRUE='#'
+  MODULE__CTYPES_TEST_FALSE=
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__ctypes_test" >&5
+$as_echo "$py_cv_module__ctypes_test" >&6; }
 
 
 # substitute multiline block, must come after last PY_STDLIB_MOD()
@@ -20276,22 +20432,10 @@ if test -z "${MODULE_OSSAUDIODEV_TRUE}" && test -z "${MODULE_OSSAUDIODEV_FALSE}"
   as_fn_error $? "conditional \"MODULE_OSSAUDIODEV\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${MODULE_OSSAUDIODEV_TRUE}" && test -z "${MODULE_OSSAUDIODEV_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE_OSSAUDIODEV\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${MODULE__SCPROXY_TRUE}" && test -z "${MODULE__SCPROXY_FALSE}"; then
   as_fn_error $? "conditional \"MODULE__SCPROXY\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${MODULE__SCPROXY_TRUE}" && test -z "${MODULE__SCPROXY_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE__SCPROXY\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${MODULE_PYEXPAT_TRUE}" && test -z "${MODULE_PYEXPAT_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE_PYEXPAT\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${MODULE_PYEXPAT_TRUE}" && test -z "${MODULE_PYEXPAT_FALSE}"; then
   as_fn_error $? "conditional \"MODULE_PYEXPAT\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -20300,14 +20444,6 @@ if test -z "${MODULE__ELEMENTTREE_TRUE}" && test -z "${MODULE__ELEMENTTREE_FALSE
   as_fn_error $? "conditional \"MODULE__ELEMENTTREE\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${MODULE__ELEMENTTREE_TRUE}" && test -z "${MODULE__ELEMENTTREE_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE__ELEMENTTREE\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${MODULE__MD5_TRUE}" && test -z "${MODULE__MD5_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE__MD5\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${MODULE__MD5_TRUE}" && test -z "${MODULE__MD5_FALSE}"; then
   as_fn_error $? "conditional \"MODULE__MD5\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -20316,14 +20452,6 @@ if test -z "${MODULE__SHA1_TRUE}" && test -z "${MODULE__SHA1_FALSE}"; then
   as_fn_error $? "conditional \"MODULE__SHA1\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${MODULE__SHA1_TRUE}" && test -z "${MODULE__SHA1_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE__SHA1\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${MODULE__SHA256_TRUE}" && test -z "${MODULE__SHA256_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE__SHA256\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${MODULE__SHA256_TRUE}" && test -z "${MODULE__SHA256_FALSE}"; then
   as_fn_error $? "conditional \"MODULE__SHA256\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -20332,14 +20460,6 @@ if test -z "${MODULE__SHA512_TRUE}" && test -z "${MODULE__SHA512_FALSE}"; then
   as_fn_error $? "conditional \"MODULE__SHA512\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${MODULE__SHA512_TRUE}" && test -z "${MODULE__SHA512_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE__SHA512\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${MODULE__SHA3_TRUE}" && test -z "${MODULE__SHA3_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE__SHA3\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${MODULE__SHA3_TRUE}" && test -z "${MODULE__SHA3_FALSE}"; then
   as_fn_error $? "conditional \"MODULE__SHA3\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -20348,14 +20468,6 @@ if test -z "${MODULE__BLAKE2_TRUE}" && test -z "${MODULE__BLAKE2_FALSE}"; then
   as_fn_error $? "conditional \"MODULE__BLAKE2\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${MODULE__BLAKE2_TRUE}" && test -z "${MODULE__BLAKE2_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE__BLAKE2\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
-if test -z "${MODULE__DECIMAL_TRUE}" && test -z "${MODULE__DECIMAL_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE__DECIMAL\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${MODULE__DECIMAL_TRUE}" && test -z "${MODULE__DECIMAL_FALSE}"; then
   as_fn_error $? "conditional \"MODULE__DECIMAL\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -20364,8 +20476,32 @@ if test -z "${MODULE__SQLITE3_TRUE}" && test -z "${MODULE__SQLITE3_FALSE}"; then
   as_fn_error $? "conditional \"MODULE__SQLITE3\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${MODULE__SQLITE3_TRUE}" && test -z "${MODULE__SQLITE3_FALSE}"; then
-  as_fn_error $? "conditional \"MODULE__SQLITE3\" was never defined.
+if test -z "${MODULE__TESTCAPI_TRUE}" && test -z "${MODULE__TESTCAPI_FALSE}"; then
+  as_fn_error $? "conditional \"MODULE__TESTCAPI\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${MODULE__TESTINTERNALCAPI_TRUE}" && test -z "${MODULE__TESTINTERNALCAPI_FALSE}"; then
+  as_fn_error $? "conditional \"MODULE__TESTINTERNALCAPI\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${MODULE__TESTBUFFER_TRUE}" && test -z "${MODULE__TESTBUFFER_FALSE}"; then
+  as_fn_error $? "conditional \"MODULE__TESTBUFFER\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${MODULE__TESTIMPORTMULTIPLE_TRUE}" && test -z "${MODULE__TESTIMPORTMULTIPLE_FALSE}"; then
+  as_fn_error $? "conditional \"MODULE__TESTIMPORTMULTIPLE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${MODULE__TESTMULTIPHASE_TRUE}" && test -z "${MODULE__TESTMULTIPHASE_FALSE}"; then
+  as_fn_error $? "conditional \"MODULE__TESTMULTIPHASE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${MODULE__XXTESTFUZZ_TRUE}" && test -z "${MODULE__XXTESTFUZZ_FALSE}"; then
+  as_fn_error $? "conditional \"MODULE__XXTESTFUZZ\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${MODULE__CTYPES_TEST_TRUE}" && test -z "${MODULE__CTYPES_TEST_FALSE}"; then
+  as_fn_error $? "conditional \"MODULE__CTYPES_TEST\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
diff --git a/configure.ac b/configure.ac
index f4adab19d6138..6c24a278595a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6028,12 +6028,10 @@ AC_DEFUN([PY_STDLIB_MOD], [
   )
   _MODULE_BLOCK_ADD(modcond, [$modstate])
   AS_VAR_IF([modstate], [yes], [
-    _MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_CFLAGS], [$4])
-    _MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_LDFLAGS], [$5])
-    AM_CONDITIONAL(modcond, [true])
-  ], [
-    AM_CONDITIONAL(modcond, [false])
+    m4_ifblank([$4], [], [_MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_CFLAGS], [$4])])
+    m4_ifblank([$5], [], [_MODULE_BLOCK_ADD([MODULE_]m4_toupper([$1])[_LDFLAGS], [$5])])
   ])
+  AM_CONDITIONAL(modcond, [test "$modstate" = yes])
   AC_MSG_RESULT([$modstate])
   m4_popdef([modcond])dnl
   m4_popdef([modstate])dnl
@@ -6087,6 +6085,15 @@ PY_STDLIB_MOD([_sqlite3],
   [test "$have_supported_sqlite3" = "yes"],
   [$LIBSQLITE3_CFLAGS], [$LIBSQLITE3_LIBS])
 
+dnl test modules
+PY_STDLIB_MOD([_testcapi], [test "$TEST_MODULES" = yes])
+PY_STDLIB_MOD([_testinternalcapi], [test "$TEST_MODULES" = yes])
+PY_STDLIB_MOD([_testbuffer], [test "$TEST_MODULES" = yes])
+PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes])
+PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes])
+PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes])
+PY_STDLIB_MOD([_ctypes_test], [test "$TEST_MODULES" = yes], [], [], [-lm])
+
 # substitute multiline block, must come after last PY_STDLIB_MOD()
 AC_SUBST([MODULE_BLOCK])
 
diff --git a/setup.py b/setup.py
index 83a676bfefbbe..d01cc4f7169ec 100644
--- a/setup.py
+++ b/setup.py
@@ -55,9 +55,6 @@
     from distutils.spawn import find_executable
 
 
-# Compile extensions used to test Python?
-TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes')
-
 # This global variable is used to hold the list of modules to be disabled.
 DISABLED_MODULE_LIST = []
 
@@ -1098,24 +1095,25 @@ def detect_simple_extensions(self):
 
     def detect_test_extensions(self):
         # Python C API test module
-        self.add(Extension('_testcapi', ['_testcapimodule.c']))
+        self.addext(Extension('_testcapi', ['_testcapimodule.c']))
 
         # Python Internal C API test module
-        self.add(Extension('_testinternalcapi', ['_testinternalcapi.c']))
+        self.addext(Extension('_testinternalcapi', ['_testinternalcapi.c']))
 
         # Python PEP-3118 (buffer protocol) test module
-        self.add(Extension('_testbuffer', ['_testbuffer.c']))
+        self.addext(Extension('_testbuffer', ['_testbuffer.c']))
 
         # Test loading multiple modules from one compiled file (https://bugs.python.org/issue16421)
-        self.add(Extension('_testimportmultiple', ['_testimportmultiple.c']))
+        self.addext(Extension('_testimportmultiple', ['_testimportmultiple.c']))
 
         # Test multi-phase extension module init (PEP 489)
-        self.add(Extension('_testmultiphase', ['_testmultiphase.c']))
+        self.addext(Extension('_testmultiphase', ['_testmultiphase.c']))
 
         # Fuzz tests.
-        self.add(Extension('_xxtestfuzz',
-                           ['_xxtestfuzz/_xxtestfuzz.c',
-                            '_xxtestfuzz/fuzzer.c']))
+        self.addext(Extension(
+            '_xxtestfuzz',
+            ['_xxtestfuzz/_xxtestfuzz.c', '_xxtestfuzz/fuzzer.c']
+        ))
 
     def detect_readline_curses(self):
         # readline
@@ -1503,8 +1501,7 @@ def detect_modules(self):
         # These are extensions are required to bootstrap the interpreter or
         # build process.
         self.detect_simple_extensions()
-        if TEST_EXTENSIONS:
-            self.detect_test_extensions()
+        self.detect_test_extensions()
         self.detect_readline_curses()
         self.detect_crypt()
         self.detect_socket()
@@ -1883,11 +1880,8 @@ def detect_ctypes(self):
                         libraries=[],
                         sources=sources)
         self.add(ext)
-        if TEST_EXTENSIONS:
-            # function my_sqrt() needs libm for sqrt()
-            self.add(Extension('_ctypes_test',
-                               sources=['_ctypes/_ctypes_test.c'],
-                               libraries=['m']))
+        # function my_sqrt() needs libm for sqrt()
+        self.addext(Extension('_ctypes_test', ['_ctypes/_ctypes_test.c']))
 
         ffi_inc = sysconfig.get_config_var("LIBFFI_INCLUDEDIR")
         ffi_lib = None



More information about the Python-checkins mailing list