Commit 736ee4fafd for perl
commit 736ee4fafd8a83c7525d60a98bee54784adde486
Author: Yves Orton <demerphq@gmail.com>
Date: Tue Oct 13 10:39:56 2026 +0200
Make test_reonly ensure test_prep has run at least once
Record successful test_prep runs in .done_test_prep and make test_reonly
depend on that file. If it is missing, run test_prep to build the test
framework dependencies and necessary Unicode data files. Cleaning
removes the file. Normal test targets run test_prep as before, but using
test_reonly no longer requires remembering to run it once after Configure.
The regex engine is built into both the interpreter and the 're'
extension with different options, and is used via miniperl to build
all our extensions. A broken regex engine can therefore leave the build
in a mess that requires rebuilding clean with known good code. The 'test_reonly'
target deliberately wants to rebuild the minimal needed, ideally only the
interpreter and 're'. We don't really want to rebuild everything with a
potentially broken regex engine, we just want to do the minimal to test that
the regex engine wouldn't break the build with a normal make target. We
actually build more than I would like during 'test_reonly' as it is and this
patch prepares to remove some of the other dependencies later on.
diff --git a/.gitignore b/.gitignore
index e28c88225c..66d0259343 100644
--- a/.gitignore
+++ b/.gitignore
@@ -105,6 +105,7 @@ MYMETA.*
/generate_uudmap
/ugenerate_uudmap
/uni.data
+/.done_test_prep
/uudmap.h
/uuudmap.h
/bitcount.h
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
index bf6fcba30a..73ba309ee9 100644
--- a/MANIFEST.SKIP
+++ b/MANIFEST.SKIP
@@ -7,4 +7,5 @@
^\.agents/
^AGENTS\.md$
^CLAUDE\.md$
+^\.done_test_prep$
^Porting/check-ws-only-change
diff --git a/Makefile.SH b/Makefile.SH
index 2aca35a26b..6692d14a56 100755
--- a/Makefile.SH
+++ b/Makefile.SH
@@ -1399,7 +1399,7 @@ _mopup:
-@test -f vms/README_vms.pod && rm -f vms/README_vms.pod
-rm -f perl.exp ext.libs $(generated_pods) uni.data $(mini_only_objs) pod/roffitall
-rm -f perl.export perl.dll perl.libexp perl.map perl.def
- -rm -f *perl.xok
+ -rm -f *perl.xok .done_test_prep
-rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump
-rm -f $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.*
-rm -f config.arch config.over $(DTRACE_H)
@@ -1560,7 +1560,7 @@ depend: makedependfile makedepend $(DTRACE_H) $(generated_headers)
.PHONY: test check test_prep test_prep_nodll test_prep_pre \
test_prep_reonly test_tty test-tty test_notty test-notty \
- test_harness test_harness_notty minitest test-reonly _test
+ test_harness test_harness_notty minitest test_reonly test-reonly _test
# The _test target is there just for Test::Smoke, which does a make test_prep
# always before invoking this target, thus preventing checking again
@@ -1580,6 +1580,7 @@ case "$targethost" in
test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \
$(dynamic_ext) $(TEST_PERL_DLL) runtests $(generated_pods) common_build
cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE))
+ touch .done_test_prep
!NO!SUBS!
;;
@@ -1631,6 +1632,7 @@ test_prep test-prep: test_prep_pre \$(MINIPERL_EXE) \$(unidatafiles) \$(PERL_EXE
$to \$(PERL_EXE)
cd t && (rm -f \$(PERL_EXE); \$(LNS) ../\$(PERL_EXE) \$(PERL_EXE)) && cd ..
$to t/\$(PERL_EXE)
+ touch .done_test_prep
!GROK!THIS!
;;
@@ -1721,7 +1723,13 @@ test_harness test-harness: test_prep
test_harness_notty: test_prep
HARNESS_NOTTY=1 TESTFILE=harness $(RUN_TESTS) choose
-test_reonly test-reonly: test_prep_reonly
+# The stamp records full preparation once between cleans. We deliberately
+# avoid checking unrelated extensions during regex engine development.
+.done_test_prep:
+ $(MAKE) test_prep
+
+test_reonly test-reonly: .done_test_prep
+ $(MAKE) test_prep_reonly
TEST_ARGS='re/*.t ../ext/re/t/*.t' PERL_TEST_HARNESS_ASAP=1 TESTFILE=harness $(RUN_TESTS) choose
diff --git a/pod/perlhack.pod b/pod/perlhack.pod
index 210d3e7e01..ee8f805c35 100644
--- a/pod/perlhack.pod
+++ b/pod/perlhack.pod
@@ -1003,6 +1003,23 @@ systems.
This runs some basic sanity tests on the source tree and helps catch
basic errors before you submit a patch.
+=item * test_reonly test-reonly
+
+Run the regex engine tests. On Unix, these are the tests in F<t/re> and
+F<ext/re/t>. This target runs C<make test_prep> if F<.done_test_prep> is
+absent, to build the test framework dependencies and necessary Unicode
+data files. Successful C<make test_prep> runs update this file, and
+C<make clean> removes it. Normal test targets run C<test_prep> as before.
+On Windows, use the C<test-reonly> and C<test-prep> spellings from F<win32>.
+
+Subsequent runs rebuild the interpreter and the C<re> extension without
+rebuilding unrelated extensions. The regex engine is built into both
+the interpreter and C<re> with different options, and is used via
+F<miniperl> to build all our extensions. A broken regex engine can
+therefore break other parts of the build. This target lets us check
+that the engine is safe enough for a full build first. To refresh the
+full test environment, run C<make test_prep> explicitly.
+
=item * minitest
Run F<miniperl> on F<t/base>, F<t/comp>, F<t/cmd>, F<t/run>, F<t/io>,
diff --git a/win32/GNUmakefile b/win32/GNUmakefile
index badfc24020..d63c70e559 100644
--- a/win32/GNUmakefile
+++ b/win32/GNUmakefile
@@ -1812,6 +1812,7 @@ test-prep : all utils ..\pod\perltoc.pod $(TESTPREPGCC)
$(XCOPY) $(PERLEXE) ..\t\$(NULL)
$(XCOPY) $(PERLDLL) ..\t\$(NULL)
$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
+ @echo done> ..\.done_test_prep
# If building with gcc versions 4.x.x or greater, then
# the GCC helper DLL will also need copied to the test directory.
# The name of the dll can change, depending upon which vendor has supplied
@@ -1841,7 +1842,13 @@ test_porting : test-prep
set PERL_STATIC_EXT=$(STATIC_EXT) && \
cd ..\t && perl.exe harness $(TEST_ARGS) $(TEST_SWITCHES) porting\*.t ..\lib\diagnostics.t
-test-reonly : reonly utils
+# Prepare the full test environment once between cleans.
+..\.done_test_prep :
+ $(MAKE) test-prep
+
+.PHONY: test-reonly
+test-reonly : ..\.done_test_prep
+ $(MAKE) reonly utils
$(XCOPY) $(PERLEXE) ..\t\$(NULL)
$(XCOPY) $(PERLDLL) ..\t\$(NULL)
$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
@@ -1902,6 +1909,7 @@ _test :
cd ..\t && perl.exe harness $(TEST_ARGS) $(TEST_SWITCHES) $(TEST_FILES)
_clean :
+ -@erase ..\.done_test_prep
-@erase miniperlmain$(o)
-@erase $(MINIPERL)
-@erase perlglob$(o)
diff --git a/win32/Makefile b/win32/Makefile
index 55b4695c4d..42ae2ee012 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -1339,6 +1339,7 @@ test-prep : all utils ../pod/perltoc.pod
$(XCOPY) $(PERLDLL) ..\t\$(NULL)
$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
set PERL_STATIC_EXT=$(STATIC_EXT)
+ @echo done> ..\.done_test_prep
test : test-prep
cd ..\t
@@ -1350,7 +1351,12 @@ test_porting : test-prep
perl.exe harness $(TEST_ARGS) $(TEST_SWITCHES) porting\*.t ..\lib\diagnostics.t
cd ..\win32
-test-reonly : reonly utils
+# Prepare the full test environment once between cleans.
+..\.done_test_prep :
+ $(MAKE) test-prep
+
+test-reonly : ..\.done_test_prep
+ $(MAKE) reonly utils
$(XCOPY) $(PERLEXE) ..\t\$(NULL)
$(XCOPY) $(PERLDLL) ..\t\$(NULL)
$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
@@ -1412,6 +1418,7 @@ _test :
cd ..\win32
_clean :
+ -@$(DEL) ..\.done_test_prep
-@$(DEL) miniperlmain$(o)
-@$(DEL) $(MINIPERL)
-@$(DEL) perlglob$(o)