[pcre-dev] PCRE2 10.35 testing issues on Windows

Top Page
Delete this message
Author: Daniel Richard G.
Date:  
To: pcre-dev
Subject: [pcre-dev] PCRE2 10.35 testing issues on Windows
Hello list,

I'd like to report a couple issues I encountered in building PCRE2 10.35
on Windows, specifically when it came to running the test suite.

The first indication was a failed pcre2_test_bat:

    Test project C:/build/pcre/pcre2-10.35/build-test
        Start 1: pcre2_test_bat
    1/2 Test #1: pcre2_test_bat ...................***Failed  Required regular expression not found. Regex=[RunTest\.bat tests successfully completed
    ]  0.06 sec
        Start 2: pcre2_jit_test
    2/2 Test #2: pcre2_jit_test ...................   Passed    8.37 sec


I tried running pcre2_test.bat directly, and got this:

    C:\build\pcre\pcre2-10.35\build-test>pcre2_test.bat
    source dir is "C:\build\pcre\pcre2-10.35"
    pcre2test="$<TARGET_FILE:pcre2test>"
    Error: "$<TARGET_FILE:pcre2test>" not found


    Either your build is incomplete or you have a configuration error.


    If configured with cmake and executed via "make test" or the MSVC "RUN_TESTS"
    project, pcre2_test.bat defines variables and automatically calls RunTest.bat.
    (remainder of text elided)


This was the content of the batch file:

    C:\build\pcre\pcre2-10.35\build-test>more pcre2_test.bat
    @REM This is a generated file.
    @echo off
    setlocal
    SET srcdir="C:\build\pcre\pcre2-10.35"
    SET pcre2test="$<TARGET_FILE:pcre2test>"
    if not [%CMAKE_CONFIG_TYPE%]==[] SET pcre2test="C:\build\pcre\pcre2-10.35\build-test\%CMAKE_CONFIG_TYPE%\pcre2test.exe"
    call %srcdir%\RunTest.Bat
    if errorlevel 1 exit /b 1
    echo RunTest.bat tests successfully completed


$<TARGET_FILE:pcre2test> is a CMake directive that apparently didn't
work. (I was using CMake 3.18.4.)

I edited the batch file to use

    SET pcre2test="C:\build\pcre\pcre2-10.35\build-test\pcre2test.exe"


and tried again. Now, I saw a different error:

    Test 2: "API, errors, internals, and non-Perl stuff"
              failed executing command-line:
                "C:\build\pcre\pcre2-10.35\build-test\pcre2test.exe"  -q      "C:\build\pcre\pcre2-10.35"\testdata\testinput2 >testout8\testoutput2
    Test 2: "Test with JIT Override"
              failed executing command-line:
                "C:\build\pcre\pcre2-10.35\build-test\pcre2test.exe"  -q -jit     "C:\build\pcre\pcre2-10.35"\testdata\testinput2 >testoutjit8\testoutput2


(Same error for the 16-bit and 32-bit libraries.)

I looked at the end of testoutput2, and saw this telltale:

    #loadtables ./testdata/testbtables
    ** Failed to open './testdata/testbtables': No such file or directory
    ** pcre2test run abandoned


It seems that "#loadtables" is a new directive, that is not aware of the
%srcdir% convention used in the RunTest.bat batch file for locating the
testdata/ subdirectory.

Here is a minimal patch that yielded a successful build+test for me,
and should help point the way to a proper fix. (Note that the
#loadtables tweak only works for a build tree just inside the source
tree, as I was using):

diff -ru pcre2-10.35/CMakeLists.txt pcre2-10.35-fixed/CMakeLists.txt
--- pcre2-10.35/CMakeLists.txt    2020-05-09 11:43:10.000000000 -0400
+++ pcre2-10.35-fixed/CMakeLists.txt    2020-11-20 04:37:54.215894941 -0500
@@ -827,7 +827,7 @@
 \@echo off
 setlocal
 SET srcdir=\"${winsrc}\"
-SET pcre2test=\"${winexe}\"
+SET pcre2test=\"${winbin}\\pcre2test.exe\"
 if not [%CMAKE_CONFIG_TYPE%]==[] SET pcre2test=\"${winbin}\\%CMAKE_CONFIG_TYPE%\\pcre2test.exe\"
 call %srcdir%\\RunTest.Bat
 if errorlevel 1 exit /b 1
diff -ru pcre2-10.35/testdata/testinput2 pcre2-10.35-fixed/testdata/testinput2
--- pcre2-10.35/testdata/testinput2    2020-04-24 11:35:58.000000000 -0400
+++ pcre2-10.35-fixed/testdata/testinput2    2020-11-20 04:38:07.031894819 -0500
@@ -5850,7 +5850,7 @@
 /^\w+/tables=3
     École


-#loadtables ./testdata/testbtables
+#loadtables ../testdata/testbtables

 /^\w+/tables=3
     École
diff -ru pcre2-10.35/testdata/testoutput2 pcre2-10.35-fixed/testdata/testoutput2
--- pcre2-10.35/testdata/testoutput2    2020-04-24 11:36:22.000000000 -0400
+++ pcre2-10.35-fixed/testdata/testoutput2    2020-11-20 04:47:36.907889384 -0500
@@ -17597,7 +17597,7 @@
 ** 'Tables = 3' is invalid: binary tables have not been loaded
     École


-#loadtables ./testdata/testbtables
+#loadtables ../testdata/testbtables

 /^\w+/tables=3
     École



Please Cc: me on any replies, as I am not subscribed to this list.


--Daniel


--
Daniel Richard G. || skunk@???
My ASCII-art .sig got a bad case of Times New Roman.