From 69c6712755387db1b959729d2e986af9f774246d Mon Sep 17 00:00:00 2001 From: Nick Wilson Date: Wed, 30 Oct 2024 11:09:49 +0000 Subject: [PATCH] Fix PCRE2_DEBUG for multi-configuration builds * Add support for Ninja Multi-Config generator on all platforms * Ensure one build job is using CMake 3.15 * Provide a build type (Debug or RelWithDebInfo) on all CMake builds * Ensure PCRE2_DEBUG=ON is set for: dev.yml builds which use the Release configuration --- .github/workflows/build.yml | 13 ++-- .github/workflows/dev.yml | 81 +++++++++++++++------ CMakeLists.txt | 141 ++++++++++++++++++++++-------------- RunGrepTest | 4 +- RunTest | 133 ++++++++++++++++++---------------- config-cmake.h.in | 1 - 6 files changed, 224 insertions(+), 149 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d76578371..cb29ada0d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,7 +77,7 @@ jobs: submodules: true - name: Configure - run: cmake -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_C_FLAGS='-Wall -Wextra' -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -B build + run: cmake -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_C_FLAGS='-Wall -Wextra' -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -B build - name: Build run: cmake --build build @@ -103,8 +103,11 @@ jobs: ./pcre2posix_test -v windows: - name: 32bit Windows + name: Windows runs-on: windows-latest + strategy: + matrix: + arch: ["Win32", "x64"] steps: - name: Checkout uses: actions/checkout@v4 @@ -112,16 +115,16 @@ jobs: submodules: true - name: Configure - run: cmake -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -B build -A Win32 + run: cmake -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -B build -A ${{ matrix.arch }} - name: Build - run: cmake --build build + run: cmake --build build --config Release - name: Test id: test run: | cd build - ctest -C Debug . + ctest -C Release . - name: Debug if: ${{ failure() && steps.test.outcome == 'failure' }} diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index c3110b4ce..37ad28a8a 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -8,7 +8,8 @@ on: jobs: canary: - name: gcc + # Tests with: Debug & assertions; link-size=4 + name: GCC -O0 runs-on: ubuntu-latest steps: - name: Checkout @@ -38,7 +39,8 @@ jobs: run: ./pcre2posix_test -v dragon: - name: clang + # Tests with: clang AB/UB; link-size=3 + name: Clang runs-on: ubuntu-latest steps: - name: Checkout @@ -67,9 +69,31 @@ jobs: - name: Test (pcre2posix program) run: ./pcre2posix_test -v + greatawk: + # Tests with: GCC, -O3, oldest supported Ubuntu (in non-extended support) + name: GCC -O3 + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + + - name: Configure + run: cmake -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_DEBUG=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_BUILD_TYPE=Release -B build + + - name: Build + run: cd build && make -j3 + + - name: Test + run: cd build && make test + wasp: - name: No JIT - runs-on: ubuntu-24.04 + # Tests with: French locale; oldest supported CMake; no JIT; -Os + name: GCC -Os, CMake+ninja, no JIT + runs-on: ubuntu-latest + env: + CMAKE_VER: "3.15.7" steps: - name: Checkout uses: actions/checkout@v4 @@ -79,25 +103,33 @@ jobs: - name: Prepare run: | sudo apt-get -qq update - sudo apt-get -qq install language-pack-fr - ./autogen.sh + sudo apt-get -qq install language-pack-fr ninja-build - - name: Configure - run: ./configure CC='clang -fsanitize=undefined,address,integer -fno-sanitize-recover=undefined,integer -fno-sanitize=unsigned-shift-base,function' --enable-pcre2-16 --enable-pcre2-32 --enable-debug + - name: Cache CMake + uses: actions/cache@v4 + with: + key: cmake-${{ env.CMAKE_VER }}-Linux-x86_64 + path: cmake-${{ env.CMAKE_VER }}-Linux-x86_64.tar.gz - - name: Build - run: make CPPFLAGS='-pedantic -Wall -Wextra -Wpedantic -Wdeclaration-after-statement -Wshadow -Wno-overlength-strings -Werror -Wno-error=incompatible-pointer-types-discards-qualifiers' -j3 + - name: Install CMake + run: | + [ -f cmake-${CMAKE_VER}-Linux-x86_64.tar.gz ] || curl -L -S -O "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.tar.gz" + tar -xz -f cmake-${CMAKE_VER}-Linux-x86_64.tar.gz + realpath "cmake-${CMAKE_VER}-Linux-x86_64/bin" >> "$GITHUB_PATH" - - name: Test (main test script) - run: ./RunTest + - name: Configure + run: | + cmake --version | grep "version ${CMAKE_VER}" || (echo "CMake version mismatch" && exit 1) + CC='clang' CFLAGS='-fsanitize=undefined,address,integer -fno-sanitize-recover=undefined,integer -fno-sanitize=unsigned-shift-base,function -pedantic -Wall -Wextra -Wpedantic -Wdeclaration-after-statement -Wshadow -Wno-overlength-strings -Werror -Wno-error=incompatible-pointer-types-discards-qualifiers' cmake -G Ninja -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_DEBUG=ON -DCMAKE_BUILD_TYPE=MinSizeRel -B build - - name: Test (pcre2grep test script) - run: ./RunGrepTest + - name: Build + run: ninja -C build - - name: Test (pcre2posix program) - run: ./pcre2posix_test -v + - name: Test + run: ninja -C build test bat: + # Tests with: MSVC 32-bit, and a variety of CMake options name: 32bit MSVC runs-on: windows-latest steps: @@ -110,17 +142,17 @@ jobs: run: cmake -DPCRE2_SUPPORT_JIT=ON -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2GREP_SUPPORT_CALLOUT_FORK=OFF -DPCRE2_DEBUG=ON -DPCRE2_NEWLINE=ANYCRLF -DPCRE2_STATIC_PIC=ON -DPCRE2_STATIC_RUNTIME=ON -DPCRE2_SUPPORT_BSR_ANYCRLF=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_VERBOSE_MAKEFILE=ON -B build -A Win32 - name: Build - run: cmake --build build + run: cmake --build build --config RelWithDebInfo - name: Test shell: cmd run: | cd build - ctest -C Debug . - type Testing\Temporary\LastTest.log + ctest -C RelWithDebInfo . pterodactyl: - name: MSVC + # Tests with: MSVC 64-bit, Debug, shared libraries + name: 64bit MSVC runs-on: windows-latest steps: - name: Checkout @@ -129,19 +161,19 @@ jobs: submodules: true - name: Configure - run: cmake -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_DEBUG=ON -DPCRE2_BUILD_PCRE2GREP=OFF -DPCRE2_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -B build + run: cmake -DPCRE2_BUILD_PCRE2_16=ON -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_DEBUG=ON -DPCRE2_BUILD_PCRE2GREP=OFF -DPCRE2_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=OFF -DCMAKE_COMPILE_WARNING_AS_ERROR=ON -B build -A x64 - name: Build - run: cmake --build build + run: cmake --build build --config Debug - name: Test shell: cmd run: | cd build ctest -C Debug . - type Testing\Temporary\LastTest.log bigbird: + # Job to execute ManyConfigTests name: manyconfig runs-on: ubuntu-latest steps: @@ -161,6 +193,7 @@ jobs: ./maint/ManyConfigTests camel: + # Job to execute RunPerlTest name: perl runs-on: ubuntu-latest container: perl:devel @@ -176,7 +209,7 @@ jobs: apt-get -qq install cmake ninja-build - name: Configure - run: cmake -G Ninja -B build -DPCRE2_BUILD_PCRE2_8=OFF -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_NEVER_BACKSLASH_C=ON + run: cmake -G Ninja -B build -DPCRE2_BUILD_PCRE2_8=OFF -DPCRE2_BUILD_PCRE2_32=ON -DPCRE2_NEVER_BACKSLASH_C=ON -DPCRE2_DEBUG=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo - name: Build run: cmake --build build diff --git a/CMakeLists.txt b/CMakeLists.txt index ec8f70674..843ef62b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,9 +103,8 @@ # 2023-01-15 Carlo added C99 as the minimum required # 2023-08-06 PH added support for setting variable length lookbehind maximum -# Increased minimum to 3.5 to workaround deprecated backward compatibility -# since 3.27. -cmake_minimum_required(VERSION 3.5 FATAL_ERROR) +# Increased minimum to 3.15 to allow use of string(REPEAT). +cmake_minimum_required(VERSION 3.15 FATAL_ERROR) project(PCRE2 C) set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD_REQUIRED TRUE) @@ -239,7 +238,8 @@ OPTION(PCRE2_BUILD_PCRE2_32 "Build 32 bit PCRE2 library" OFF) OPTION(PCRE2_STATIC_PIC "Build the static library with the option position independent code enabled." OFF) -OPTION(PCRE2_DEBUG "Include debugging code" OFF) +set(PCRE2_DEBUG "IfDebugBuild" CACHE STRING "Include debugging code") +set_property(CACHE PCRE2_DEBUG PROPERTY STRINGS "IfDebugBuild" "ON" "OFF") OPTION(PCRE2_DISABLE_PERCENT_ZT "Disable the use of %zu and %td (rarely needed)" OFF) @@ -439,7 +439,7 @@ IF(PCRE2_SUPPORT_JIT_SEALLOC) UNSET(CMAKE_REQUIRED_DEFINITIONS) IF(${REQUIRED}) IF(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD) - ADD_DEFINITIONS(-D_GNU_SOURCE) + ADD_COMPILE_DEFINITIONS(_GNU_SOURCE) SET(SLJIT_PROT_EXECUTABLE_ALLOCATOR 1) ELSE(${CMAKE_SYSTEM_NAME} MATCHES Linux|NetBSD) MESSAGE(FATAL_ERROR "Your configuration is not supported") @@ -687,10 +687,16 @@ ENDIF(MSVC AND PCRE2_STATIC_RUNTIME) # Build setup -ADD_DEFINITIONS(-DHAVE_CONFIG_H) +ADD_COMPILE_DEFINITIONS(HAVE_CONFIG_H) + +if(PCRE2_DEBUG STREQUAL "IfDebugBuild") + ADD_COMPILE_DEFINITIONS("$<$:PCRE2_DEBUG>") +elseif(PCRE2_DEBUG) + ADD_COMPILE_DEFINITIONS("PCRE2_DEBUG") +endif() IF(MSVC) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS) + ADD_COMPILE_DEFINITIONS(_CRT_SECURE_NO_DEPRECATE _CRT_SECURE_NO_WARNINGS) ENDIF(MSVC) SET(CMAKE_INCLUDE_CURRENT_DIR 1) @@ -1029,6 +1035,8 @@ MESSAGE(\" \") "#! /bin/sh # This is a generated file. srcdir=${PROJECT_SOURCE_DIR} +pcre2test=${PROJECT_BINARY_DIR}/pcre2test +test -z \"$CMAKE_CONFIG_TYPE\" || pcre2test=${PROJECT_BINARY_DIR}/$CMAKE_CONFIG_TYPE/pcre2test . ${PROJECT_SOURCE_DIR}/RunTest if test \"$?\" != \"0\"; then exit 1; fi # End @@ -1043,6 +1051,10 @@ if test \"$?\" != \"0\"; then exit 1; fi "#! /bin/sh # This is a generated file. srcdir=${PROJECT_SOURCE_DIR} +pcre2grep=${PROJECT_BINARY_DIR}/pcre2grep +test -z \"$CMAKE_CONFIG_TYPE\" || pcre2grep=${PROJECT_BINARY_DIR}/$CMAKE_CONFIG_TYPE/pcre2grep +pcre2test=${PROJECT_BINARY_DIR}/pcre2test +test -z \"$CMAKE_CONFIG_TYPE\" || pcre2test=${PROJECT_BINARY_DIR}/$CMAKE_CONFIG_TYPE/pcre2test . ${PROJECT_SOURCE_DIR}/RunGrepTest if test \"$?\" != \"0\"; then exit 1; fi # End @@ -1147,81 +1159,98 @@ IF(PCRE2_HEAP_MATCH_RECURSE) ENDIF(PCRE2_HEAP_MATCH_RECURSE) IF(PCRE2_SHOW_REPORT) - STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype) - IF (CMAKE_C_FLAGS) - SET(cfsp " ") - ENDIF(CMAKE_C_FLAGS) MESSAGE(STATUS "") MESSAGE(STATUS "") MESSAGE(STATUS "PCRE2-${PCRE2_MAJOR}.${PCRE2_MINOR} configuration summary:") MESSAGE(STATUS "") - MESSAGE(STATUS " Install prefix .................. : ${CMAKE_INSTALL_PREFIX}") - MESSAGE(STATUS " C compiler ...................... : ${CMAKE_C_COMPILER}") - MESSAGE(STATUS " C compiler flags ................ : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}") + MESSAGE(STATUS " Install prefix .................... : ${CMAKE_INSTALL_PREFIX}") + MESSAGE(STATUS " C compiler ........................ : ${CMAKE_C_COMPILER}") + + if (CMAKE_C_FLAGS) + set(cfsp " ") + endif() + if (CMAKE_CONFIGURATION_TYPES) + foreach (config IN LISTS CMAKE_CONFIGURATION_TYPES) + STRING(TOUPPER "${config}" buildtype) + STRING(LENGTH " (${config})" buildtypelen) + MATH(EXPR dotslen "18 - ${buildtypelen}") + STRING(REPEAT "." ${dotslen} dots) + MESSAGE(STATUS " C compiler flags (${config}) ${dots} : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}") + endforeach() + else() + STRING(TOUPPER "${CMAKE_BUILD_TYPE}" buildtype) + MESSAGE(STATUS " C compiler flags .................. : ${CMAKE_C_FLAGS}${cfsp}${CMAKE_C_FLAGS_${buildtype}}") + endif() + MESSAGE(STATUS "") - MESSAGE(STATUS " Build 8 bit PCRE2 library ....... : ${PCRE2_BUILD_PCRE2_8}") - MESSAGE(STATUS " Build 16 bit PCRE2 library ...... : ${PCRE2_BUILD_PCRE2_16}") - MESSAGE(STATUS " Build 32 bit PCRE2 library ...... : ${PCRE2_BUILD_PCRE2_32}") - MESSAGE(STATUS " Include debugging code ...........: ${PCRE2_DEBUG}") - MESSAGE(STATUS " Enable JIT compiling support .... : ${PCRE2_SUPPORT_JIT}") - MESSAGE(STATUS " Use SELinux allocator in JIT .... : ${PCRE2_SUPPORT_JIT_SEALLOC}") - MESSAGE(STATUS " Enable Unicode support .......... : ${PCRE2_SUPPORT_UNICODE}") - MESSAGE(STATUS " Newline char/sequence ........... : ${PCRE2_NEWLINE}") - MESSAGE(STATUS " \\R matches only ANYCRLF ......... : ${PCRE2_SUPPORT_BSR_ANYCRLF}") - MESSAGE(STATUS " \\C is disabled .................. : ${PCRE2_NEVER_BACKSLASH_C}") - MESSAGE(STATUS " EBCDIC coding ................... : ${PCRE2_EBCDIC}") - MESSAGE(STATUS " EBCDIC coding with NL=0x25 ...... : ${PCRE2_EBCDIC_NL25}") - MESSAGE(STATUS " Rebuild char tables ............. : ${PCRE2_REBUILD_CHARTABLES}") - MESSAGE(STATUS " Internal link size .............. : ${PCRE2_LINK_SIZE}") - MESSAGE(STATUS " Maximum variable lookbehind ..... : ${PCRE2_MAX_VARLOOKBEHIND}") - MESSAGE(STATUS " Parentheses nest limit .......... : ${PCRE2_PARENS_NEST_LIMIT}") - MESSAGE(STATUS " Heap limit ...................... : ${PCRE2_HEAP_LIMIT}") - MESSAGE(STATUS " Match limit ..................... : ${PCRE2_MATCH_LIMIT}") - MESSAGE(STATUS " Match depth limit ............... : ${PCRE2_MATCH_LIMIT_DEPTH}") - MESSAGE(STATUS " Build shared libs ............... : ${BUILD_SHARED_LIBS}") - MESSAGE(STATUS " Build static libs ............... : ${BUILD_STATIC_LIBS}") - MESSAGE(STATUS " with PIC enabled ............. : ${PCRE2_STATIC_PIC}") - MESSAGE(STATUS " Build pcre2grep ................. : ${PCRE2_BUILD_PCRE2GREP}") - MESSAGE(STATUS " Enable JIT in pcre2grep ......... : ${PCRE2GREP_SUPPORT_JIT}") - MESSAGE(STATUS " Enable callouts in pcre2grep .... : ${PCRE2GREP_SUPPORT_CALLOUT}") - MESSAGE(STATUS " Enable callout fork in pcre2grep. : ${PCRE2GREP_SUPPORT_CALLOUT_FORK}") - MESSAGE(STATUS " Buffer size for pcre2grep ....... : ${PCRE2GREP_BUFSIZE}") - MESSAGE(STATUS " Build tests (implies pcre2test .. : ${PCRE2_BUILD_TESTS}") + IF(CMAKE_CONFIGURATION_TYPES) + MESSAGE(STATUS " Build configurations .............. : ${CMAKE_CONFIGURATION_TYPES}") + ELSE() + MESSAGE(STATUS " Build type ........................ : ${CMAKE_BUILD_TYPE}") + ENDIF() + MESSAGE(STATUS " Build 8 bit PCRE2 library ......... : ${PCRE2_BUILD_PCRE2_8}") + MESSAGE(STATUS " Build 16 bit PCRE2 library ........ : ${PCRE2_BUILD_PCRE2_16}") + MESSAGE(STATUS " Build 32 bit PCRE2 library ........ : ${PCRE2_BUILD_PCRE2_32}") + MESSAGE(STATUS " Include debugging code ............ : ${PCRE2_DEBUG}") + MESSAGE(STATUS " Enable JIT compiling support ...... : ${PCRE2_SUPPORT_JIT}") + MESSAGE(STATUS " Use SELinux allocator in JIT ...... : ${PCRE2_SUPPORT_JIT_SEALLOC}") + MESSAGE(STATUS " Enable Unicode support ............ : ${PCRE2_SUPPORT_UNICODE}") + MESSAGE(STATUS " Newline char/sequence ............. : ${PCRE2_NEWLINE}") + MESSAGE(STATUS " \\R matches only ANYCRLF ........... : ${PCRE2_SUPPORT_BSR_ANYCRLF}") + MESSAGE(STATUS " \\C is disabled .................... : ${PCRE2_NEVER_BACKSLASH_C}") + MESSAGE(STATUS " EBCDIC coding ..................... : ${PCRE2_EBCDIC}") + MESSAGE(STATUS " EBCDIC coding with NL=0x25 ........ : ${PCRE2_EBCDIC_NL25}") + MESSAGE(STATUS " Rebuild char tables ............... : ${PCRE2_REBUILD_CHARTABLES}") + MESSAGE(STATUS " Internal link size ................ : ${PCRE2_LINK_SIZE}") + MESSAGE(STATUS " Maximum variable lookbehind ....... : ${PCRE2_MAX_VARLOOKBEHIND}") + MESSAGE(STATUS " Parentheses nest limit ............ : ${PCRE2_PARENS_NEST_LIMIT}") + MESSAGE(STATUS " Heap limit ........................ : ${PCRE2_HEAP_LIMIT}") + MESSAGE(STATUS " Match limit ....................... : ${PCRE2_MATCH_LIMIT}") + MESSAGE(STATUS " Match depth limit ................. : ${PCRE2_MATCH_LIMIT_DEPTH}") + MESSAGE(STATUS " Build shared libs ................. : ${BUILD_SHARED_LIBS}") + MESSAGE(STATUS " Build static libs ................. : ${BUILD_STATIC_LIBS}") + MESSAGE(STATUS " with PIC enabled ............... : ${PCRE2_STATIC_PIC}") + MESSAGE(STATUS " Build pcre2grep ................... : ${PCRE2_BUILD_PCRE2GREP}") + MESSAGE(STATUS " Enable JIT in pcre2grep ........... : ${PCRE2GREP_SUPPORT_JIT}") + MESSAGE(STATUS " Enable callouts in pcre2grep ...... : ${PCRE2GREP_SUPPORT_CALLOUT}") + MESSAGE(STATUS " Enable callout fork in pcre2grep .. : ${PCRE2GREP_SUPPORT_CALLOUT_FORK}") + MESSAGE(STATUS " Buffer size for pcre2grep ......... : ${PCRE2GREP_BUFSIZE}") + MESSAGE(STATUS " Build tests (implies pcre2test .... : ${PCRE2_BUILD_TESTS}") MESSAGE(STATUS " and pcre2grep)") IF(ZLIB_FOUND) - MESSAGE(STATUS " Link pcre2grep with libz ........ : ${PCRE2_SUPPORT_LIBZ}") + MESSAGE(STATUS " Link pcre2grep with libz .......... : ${PCRE2_SUPPORT_LIBZ}") ELSE(ZLIB_FOUND) - MESSAGE(STATUS " Link pcre2grep with libz ........ : Library not found" ) + MESSAGE(STATUS " Link pcre2grep with libz .......... : Library not found" ) ENDIF(ZLIB_FOUND) IF(BZIP2_FOUND) - MESSAGE(STATUS " Link pcre2grep with libbz2 ...... : ${PCRE2_SUPPORT_LIBBZ2}") + MESSAGE(STATUS " Link pcre2grep with libbz2 ........ : ${PCRE2_SUPPORT_LIBBZ2}") ELSE(BZIP2_FOUND) - MESSAGE(STATUS " Link pcre2grep with libbz2 ...... : Library not found" ) + MESSAGE(STATUS " Link pcre2grep with libbz2 ........ : Library not found" ) ENDIF(BZIP2_FOUND) IF(EDITLINE_FOUND) - MESSAGE(STATUS " Link pcre2test with libeditline . : ${PCRE2_SUPPORT_LIBEDIT}") + MESSAGE(STATUS " Link pcre2test with libeditline ... : ${PCRE2_SUPPORT_LIBEDIT}") ELSE(EDITLINE_FOUND) - MESSAGE(STATUS " Link pcre2test with libeditline . : Library not found" ) + MESSAGE(STATUS " Link pcre2test with libeditline ... : Library not found" ) ENDIF(EDITLINE_FOUND) IF(READLINE_FOUND) - MESSAGE(STATUS " Link pcre2test with libreadline . : ${PCRE2_SUPPORT_LIBREADLINE}") + MESSAGE(STATUS " Link pcre2test with libreadline ... : ${PCRE2_SUPPORT_LIBREADLINE}") ELSE(READLINE_FOUND) - MESSAGE(STATUS " Link pcre2test with libreadline . : Library not found" ) + MESSAGE(STATUS " Link pcre2test with libreadline ... : Library not found" ) ENDIF(READLINE_FOUND) - MESSAGE(STATUS " Support Valgrind .................: ${PCRE2_SUPPORT_VALGRIND}") + MESSAGE(STATUS " Support Valgrind .................. : ${PCRE2_SUPPORT_VALGRIND}") IF(PCRE2_DISABLE_PERCENT_ZT) - MESSAGE(STATUS " Use %zu and %td ..................: OFF" ) + MESSAGE(STATUS " Use %zu and %td ................... : OFF" ) ELSE(PCRE2_DISABLE_PERCENT_ZT) - MESSAGE(STATUS " Use %zu and %td ..................: AUTO" ) + MESSAGE(STATUS " Use %zu and %td ................... : AUTO" ) ENDIF(PCRE2_DISABLE_PERCENT_ZT) IF(MINGW AND BUILD_SHARED_LIBS) - MESSAGE(STATUS " Non-standard dll names (prefix) . : ${NON_STANDARD_LIB_PREFIX}") - MESSAGE(STATUS " Non-standard dll names (suffix) . : ${NON_STANDARD_LIB_SUFFIX}") + MESSAGE(STATUS " Non-standard dll names (prefix) ... : ${NON_STANDARD_LIB_PREFIX}") + MESSAGE(STATUS " Non-standard dll names (suffix) ... : ${NON_STANDARD_LIB_SUFFIX}") ENDIF(MINGW AND BUILD_SHARED_LIBS) IF(MSVC) - MESSAGE(STATUS " Install MSVC .pdb files ..........: ${INSTALL_MSVC_PDB}") + MESSAGE(STATUS " Install MSVC .pdb files ........... : ${INSTALL_MSVC_PDB}") ENDIF(MSVC) MESSAGE(STATUS "") diff --git a/RunGrepTest b/RunGrepTest index 1ba05f4c2..bd39a1c50 100755 --- a/RunGrepTest +++ b/RunGrepTest @@ -25,8 +25,8 @@ unset cp ls mv rm # valgrind settings when requested. builddir=`pwd` -pcre2grep=$builddir/pcre2grep -pcre2test=$builddir/pcre2test +: ${pcre2grep:=$builddir/pcre2grep} +: ${pcre2test:=$builddir/pcre2test} if [ ! -x $pcre2grep ] ; then echo "** $pcre2grep does not exist or is not executable." diff --git a/RunTest b/RunTest index a165b0342..9978d4646 100755 --- a/RunTest +++ b/RunTest @@ -185,7 +185,7 @@ checkresult() checkspecial() { - $valgrind $vjs ./pcre2test $1 >>testtry + $sim $valgrind $vjs $pcre2test $1 >>testtry if [ $? -ne 0 ] ; then echo "** pcre2test $1 failed - check testtry" exit 1 @@ -193,24 +193,7 @@ checkspecial() } -# ------ Special EBCDIC Test ------- - -if [ $# -eq 1 -a "$1" = "ebcdic" ]; then - $valgrind ./pcre2test -C ebcdic >/dev/null - ebcdic=$? - if [ $ebcdic -ne 1 ] ; then - echo "Cannot run EBCDIC tests: EBCDIC support not compiled" - exit 1 - fi - for opt in "" "-dfa"; do - ./pcre2test -q $opt $testdata/testinputEBC >testtry - checkresult $? EBC "$opt" - done -exit 0 -fi - - -# ------ Normal Tests ------ +# ------ Test setup ------ # Default values @@ -223,10 +206,16 @@ sim= skip= valgrind= vjs= +: ${pcre2test:=./pcre2test} # This is in case the caller has set aliases (as I do - PH) unset cp ls mv rm +if [ ! -x $pcre2test ] ; then + echo "** $pcre2test does not exist or is not executable." + exit 1 +fi + # Process options and select which tests to run; for those that are explicitly # requested, check that the necessary optional facilities are available. @@ -259,6 +248,7 @@ do25=no do26=no do27=no doheap=no +doebcdic=no while [ $# -gt 0 ] ; do case $1 in @@ -290,8 +280,9 @@ while [ $# -gt 0 ] ; do 25) do25=yes;; 26) do26=yes;; 27) do27=yes;; - heap) doheap=yes;; - -8) arg8=yes;; + heap) doheap=yes;; + ebcdic) doebcdic=yes;; + -8) arg8=yes;; -16) arg16=yes;; -32) arg32=yes;; bigstack|-bigstack) bigstack=yes;; @@ -329,7 +320,7 @@ done # Find which optional facilities are available. -$sim ./pcre2test -C linksize >/dev/null +$sim $pcre2test -C linksize >/dev/null link_size=$? if [ $link_size -lt 2 ] ; then echo "RunTest: Failed to find internal link size" @@ -343,7 +334,7 @@ fi # If it is possible to set the system stack size and -bigstack was given, # set up a large stack. -$sim ./pcre2test -S 32 /dev/null /dev/null +$sim $pcre2test -S 32 /dev/null /dev/null support_setstack=$? if [ $support_setstack -eq 0 -a "$bigstack" != "" ] ; then setstack="-S 32" @@ -354,16 +345,16 @@ fi # All of 8-bit, 16-bit, and 32-bit character strings may be supported, but only # one need be. -$sim ./pcre2test -C pcre2-8 >/dev/null +$sim $pcre2test -C pcre2-8 >/dev/null support8=$? -$sim ./pcre2test -C pcre2-16 >/dev/null +$sim $pcre2test -C pcre2-16 >/dev/null support16=$? -$sim ./pcre2test -C pcre2-32 >/dev/null +$sim $pcre2test -C pcre2-32 >/dev/null support32=$? # \C may be disabled -$sim ./pcre2test -C backslash-C >/dev/null +$sim $pcre2test -C backslash-C >/dev/null supportBSC=$? # Initialize all bitsizes skipped @@ -415,7 +406,7 @@ fi # sizes if both are supported; we can't have UTF-8 support without UTF-16 or # UTF-32 support. -$sim ./pcre2test -C unicode >/dev/null +$sim $pcre2test -C unicode >/dev/null utf=$? # When JIT is used with valgrind, we need to set up valgrind suppressions as @@ -423,7 +414,7 @@ utf=$? # the hardware supports SSE2. jitopt= -$sim ./pcre2test -C jit >/dev/null +$sim $pcre2test -C jit >/dev/null jit=$? if [ $jit -ne 0 -a "$nojit" != "yes" ] ; then jitopt=-jit @@ -442,7 +433,7 @@ if [ $do0 = no -a $do1 = no -a $do2 = no -a $do3 = no -a \ $do16 = no -a $do17 = no -a $do18 = no -a $do19 = no -a \ $do20 = no -a $do21 = no -a $do22 = no -a $do23 = no -a \ $do24 = no -a $do25 = no -a $do26 = no -a $do27 = no -a \ - $doheap = no \ + $doheap = no -a $doebcdic = no \ ]; then do0=yes do1=yes @@ -483,9 +474,12 @@ for i in $skip; do eval do$i=no; done echo "" echo PCRE2 C library tests using test data from $testdata -$sim ./pcre2test /dev/null +$sim $pcre2test /dev/null echo "" + +# ------ Normal Tests ------ + for bmode in "$test8" "$test16" "$test32"; do case "$bmode" in skip) continue;; @@ -518,7 +512,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $do1 = yes ] ; then echo $title1 for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput1 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput1 testtry checkresult $? 1 "$opt" done fi @@ -530,10 +524,10 @@ for bmode in "$test8" "$test16" "$test32"; do echo $title2 "(excluding UTF-$bits)" cp $testdata/testbtables . for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput2 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput2 testtry saverc=$? if [ $saverc = 0 ] ; then - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $bmode $opt -error -70,-62,-2,-1,0,100,101,191,300 >>testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $bmode $opt -error -70,-62,-2,-1,0,100,101,191,300 >>testtry checkresult $? 2 "$opt" else checkresult $saverc 2 "$opt" @@ -559,7 +553,7 @@ for bmode in "$test8" "$test16" "$test32"; do locale -a | grep "^$loc\$" >/dev/null if [ $? -eq 0 ] ; then echo "/a/locale=$loc" | \ - $sim $valgrind ./pcre2test -q $bmode | \ + $sim $valgrind $pcre2test -q $bmode | \ grep "Failed to set locale" >/dev/null if [ $? -ne 0 ] ; then locale=$loc @@ -586,7 +580,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ "$locale" != "" ] ; then echo $title3 "(using '$locale' locale)" for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $infile testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $infile testtry if [ $? = 0 ] ; then case "$opt" in -jit) with=" with JIT";; @@ -623,7 +617,7 @@ for bmode in "$test8" "$test16" "$test32"; do echo " Skipped because UTF-$bits support is not available" else for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput4 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput4 testtry checkresult $? 4 "$opt" done fi @@ -635,7 +629,7 @@ for bmode in "$test8" "$test16" "$test32"; do echo " Skipped because UTF-$bits support is not available" else for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput5 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput5 testtry checkresult $? 5 "$opt" done fi @@ -645,7 +639,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $do6 = yes ] ; then echo $title6 - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput6 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput6 testtry checkresult $? 6 "" fi @@ -654,7 +648,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $utf -eq 0 ] ; then echo " Skipped because UTF-$bits support is not available" else - $sim $valgrind ./pcre2test -q $setstack $bmode $opt $testdata/testinput7 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $opt $testdata/testinput7 testtry checkresult $? 7 "" fi fi @@ -672,7 +666,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $utf -eq 0 ] ; then echo " Skipped because UTF-$bits support is not available" else - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput8 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput8 testtry checkresult $? 8-$bits-$link_size "" fi fi @@ -685,7 +679,7 @@ for bmode in "$test8" "$test16" "$test32"; do echo " Skipped when running 16/32-bit tests" else for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput9 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput9 testtry checkresult $? 9 "$opt" done fi @@ -701,7 +695,7 @@ for bmode in "$test8" "$test16" "$test32"; do echo " Skipped because UTF-$bits support is not available" else for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput10 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput10 testtry checkresult $? 10 "$opt" done fi @@ -715,7 +709,7 @@ for bmode in "$test8" "$test16" "$test32"; do echo " Skipped when running 8-bit tests" else for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput11 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput11 testtry checkresult $? 11-$bits "$opt" done fi @@ -732,7 +726,7 @@ for bmode in "$test8" "$test16" "$test32"; do echo " Skipped because UTF-$bits support is not available" else for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput12 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput12 testtry checkresult $? 12-$bits "$opt" done fi @@ -745,7 +739,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ "$bits" = "8" ] ; then echo " Skipped when running 8-bit tests" else - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput13 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput13 testtry checkresult $? 13 "" fi fi @@ -757,7 +751,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $utf -eq 0 ] ; then echo " Skipped because UTF-$bits support is not available" else - $sim $valgrind ./pcre2test -q $setstack $bmode $opt $testdata/testinput14 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $opt $testdata/testinput14 testtry checkresult $? 14-$bits "" fi fi @@ -766,7 +760,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $do15 = yes ] ; then echo $title15 - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput15 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput15 testtry checkresult $? 15 "" fi @@ -777,7 +771,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $jit -ne 0 ] ; then echo " Skipped because JIT is available" else - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput16 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput16 testtry checkresult $? 16 "" fi fi @@ -789,7 +783,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then echo " Skipped because JIT is not available or nojit was specified" else - $sim $valgrind $vjs ./pcre2test -q $setstack $bmode $testdata/testinput17 testtry + $sim $valgrind $vjs $pcre2test -q $setstack $bmode $testdata/testinput17 testtry checkresult $? 17 "" fi fi @@ -801,7 +795,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ "$bits" = "16" -o "$bits" = "32" ] ; then echo " Skipped when running 16/32-bit tests" else - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput18 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput18 testtry checkresult $? 18 "" fi fi @@ -815,7 +809,7 @@ for bmode in "$test8" "$test16" "$test32"; do elif [ $utf -eq 0 ] ; then echo " Skipped because UTF-$bits support is not available" else - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput19 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput19 testtry checkresult $? 19 "" fi fi @@ -824,7 +818,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $do20 = yes ] ; then echo $title20 - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput20 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput20 testtry checkresult $? 20 "" fi @@ -836,7 +830,7 @@ for bmode in "$test8" "$test16" "$test32"; do echo " Skipped because \C is disabled" else for opt in "" $jitopt -dfa; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput21 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput21 testtry checkresult $? 21 "$opt" done fi @@ -852,7 +846,7 @@ for bmode in "$test8" "$test16" "$test32"; do echo " Skipped because UTF-$bits support is not available" else for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput22 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput22 testtry checkresult $? 22-$bits "$opt" done fi @@ -865,7 +859,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $supportBSC -ne 0 ] ; then echo " Skipped because \C is not disabled" else - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput23 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput23 testtry checkresult $? 23 "" fi fi @@ -874,7 +868,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ "$do24" = yes ] ; then echo $title24 - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput24 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput24 testtry checkresult $? 24 "" fi @@ -885,7 +879,7 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $utf -eq 0 ] ; then echo " Skipped because UTF-$bits support is not available" else - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinput25 testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinput25 testtry checkresult $? 25 "" fi fi @@ -898,7 +892,7 @@ for bmode in "$test8" "$test16" "$test32"; do echo " Skipped because UTF-$bits support is not available" else for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput26 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput26 testtry checkresult $? 26 "$opt" done fi @@ -912,7 +906,7 @@ for bmode in "$test8" "$test16" "$test32"; do echo " Skipped because UTF-$bits support is not available" else for opt in "" $jitopt; do - $sim $valgrind ${opt:+$vjs} ./pcre2test -q $setstack $bmode $opt $testdata/testinput27 testtry + $sim $valgrind ${opt:+$vjs} $pcre2test -q $setstack $bmode $opt $testdata/testinput27 testtry checkresult $? 27 "$opt" done fi @@ -923,13 +917,30 @@ for bmode in "$test8" "$test16" "$test32"; do if [ $doheap = yes ] ; then echo $titleheap - $sim $valgrind ./pcre2test -q $setstack $bmode $testdata/testinputheap testtry + $sim $valgrind $pcre2test -q $setstack $bmode $testdata/testinputheap testtry checkresult $? heap-$bits "" fi # End of loop for 8/16/32-bit tests done + +# ------ Special EBCDIC Test ------- + +if [ $doebcdic = yes ] ; then + $sim $valgrind $pcre2test -C ebcdic >/dev/null + ebcdic=$? + if [ $ebcdic -ne 1 ] ; then + echo "Cannot run EBCDIC tests: EBCDIC support not compiled" + exit 1 + fi + for opt in "" "-dfa"; do + $sim $valgrind $pcre2test -q $opt $testdata/testinputEBC >testtry + checkresult $? EBC "$opt" + done +fi + + # Clean up local working files rm -f testbtables testSinput test3input testsaved1 testsaved2 test3output test3outputA test3outputB teststdout teststderr testtry diff --git a/config-cmake.h.in b/config-cmake.h.in index bc413af6b..0440274d5 100644 --- a/config-cmake.h.in +++ b/config-cmake.h.in @@ -20,7 +20,6 @@ #cmakedefine SUPPORT_PCRE2_8 1 #cmakedefine SUPPORT_PCRE2_16 1 #cmakedefine SUPPORT_PCRE2_32 1 -#cmakedefine PCRE2_DEBUG 1 #cmakedefine DISABLE_PERCENT_ZT 1 #cmakedefine SUPPORT_LIBBZ2 1