diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cd2ee5d..61bf4bb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,12 +5,15 @@ on: branches: - master - dev + - boilerplate + - idiomatic + - update + - update.2 - rc1 - rc2 - rc3 - rc4 - rc5 - - update pull_request: concurrency: diff --git a/.sis/project_name.txt b/.sis/project_name.txt new file mode 100644 index 00000000..aa334ac0 --- /dev/null +++ b/.sis/project_name.txt @@ -0,0 +1 @@ +STLSoft diff --git a/CHANGES.md b/CHANGES.md index aaaa6fbf..87d3ded8 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,4 @@ -# **STLSoft** Changes +# STLSoft - CHANGES ## 1.11.1-rc5 - 9th August 2026 diff --git a/CMakeLists.txt b/CMakeLists.txt index 946df499..71e9f794 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ # Purpose: Top-level CMake lists file for STLSoft # # Created: 31st March 2021 -# Updated: 30th July 2026 +# Updated: 7th August 2026 # # ######################################################################## # @@ -14,6 +14,9 @@ # CMake cmake_minimum_required(VERSION 3.20 FATAL_ERROR) +if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.31") + cmake_policy(SET CMP0177 NEW) +endif() # require out-of-source builds file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}/CMakeLists.txt" LOC_PATH) diff --git a/EXAMPLES.md b/EXAMPLES.md index da60d4af..e12dae08 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -1,4 +1,4 @@ -# STLSoft Examples +# STLSoft - Examples | Name | Source & Description | Platform | Summary | | ---- | -------------------- | -------- | ------- | diff --git a/KNOWN_ISSUES.md b/KNOWN_ISSUES.md index 0f098a12..99d56f98 100644 --- a/KNOWN_ISSUES.md +++ b/KNOWN_ISSUES.md @@ -3,8 +3,8 @@ ## STLSoft 1.11 Known Issues -* [ ] Deeper API documentation beyond the README Components catalogue remains incomplete (see also [**TODO.md**](./TODO.md)); further documentation work is planned for 1.12+; -* [ ] Several `unixstl::system_traits` methods are declared but not defined, with the intention to flesh them out from Linux system calls (and provide emulations/workarounds for other architectures); pull requests are welcome; +* [ ] Deeper API documentation beyond the README Components catalogue remains incomplete (see [**TODO.md**](./TODO.md) **1.11.11**); +* [ ] Several `unixstl::system_traits` methods are declared but not defined, with the intention to flesh them out from Linux system calls (and provide emulations/workarounds for other architectures); see [**TODO.md**](./TODO.md) **1.11.6**; pull requests are welcome; ## STLSoft 1.11 Suspected Issues diff --git a/TODO.md b/TODO.md index 7c3fe372..4cc3f9a1 100644 --- a/TODO.md +++ b/TODO.md @@ -5,152 +5,125 @@ ## Table of Contents -- [Functional improvements](#functional-improvements) - - [Code changes (1.10.x)](#code-changes-110x) - - [Code changes (1.11.x)](#code-changes-111x) - - [Code changes (1.12+)](#code-changes-112) - - [abandoned TODOs](#abandoned-todos) -- [Performance improvements](#performance-improvements) -- [Packaging improvements](#packaging-improvements) - - [Administrative (1.10.x)](#administrative-110x) - - [Administrative (1.11.x)](#administrative-111x) - - [Building/executing automated tests (1.11.x)](#buildingexecuting-automated-tests-111x) - - [Administrative (1.12+)](#administrative-112) - - -## Functional improvements - - -### Code changes (1.10.x) - -* [ ] GitHub README.md badges - version, build, etc; -* [ ] STLSoft-related blog posts (focusing on new components); -* [ ] fix Doxygen build; -* [x] ~~~CMake~~~ - ✅; -* [ ] `invoke_ACE_OS_snprintf` should be implemented in terms of `stlsoft_C_snprintf()`; -* [ ] `invalid_integral_range_policy::operator ()` should be implemented in terms of `stlsoft_C_snprintf()`; -* [ ] `stlsoft::auto_buffer<>::copy_from()` should be template and work with other instances (with different `V_internalSize`); -* [ ] hash specialisations for all possible key types (incl. `stlsoft::basic_simple_string<>`, etc.); -* [x] ~~~final filesystem fixes (found during testing of [**recls**](https://github.com/synesissoftware/recls) 1.10's significantly improved functionality)~~~ - ✅; -* [x] ~~~apply `stlsoft::unit::string_insert()` to UNIXSTL/WinSTL `basic_path<>`~~~ - ✅; -* [x] ~~~C++ 11/14/17/20 compatibility - partial~~~ - ✅; -* [x] ~~~better documentation markup for `stlsoft::translate_thousands()`, `stlsoft::format_thousands()`, `stlsoft::integer_to_lc_string()`, `winstl::format_thousands()`, ...~~~ - ✅; -* [x] ~~~apply `stlsoft::string_insert()` to **WinSTL** time type shims~~~ - ✅; - - -### Code changes (1.11.x) - -* [ ] find all `STLSOFT_USING_SAFE_STR_FUNCTIONS` and abstract all code to worker functions; -* [ ] integrate **STLSoft**'s exception-hierarchies with new standard exception design; -* [ ] C++ 11/14/17/20/23 compatibility - partial; further coming in 1.12; -* [ ] further system_traits refactoring: - * [ ] joining common code via **CRTP**; - * [ ] abstracting out string stuff (into `stlsoft::`); - * [ ] sorting the "safe-string" stuff; - * [ ] abstracted file-system operations such as `#make_writeable()` / `#make_readonly()`; - * [x] ~~~**winstl/api/internal/get_home_directory_.h**~~~ - ✅; - * [x] ~~~add `WINSTL_API_INTERNAL_System_get_home_directory_a_()` / `WINSTL_API_INTERNAL_System_get_home_directory_w_()`~~~ - ✅; - * [x] ~~~tries first for `"USERPROFILE"` and then falls back to `"HOMEDRIVE"` and `"HOMEPATH"`~~~ - ✅; - * [x] ~~~implement `winstl_C_get_home_directory_a()` / `winstl_C_get_home_directory_w()` (**winstl/system/directory_functions.h**) in terms of `WINSTL_API_INTERNAL_System_get_home_directory_a_()` / `WINSTL_API_INTERNAL_System_get_home_directory_w_()`~~~ - ✅; - * [x] ~~~add **test.component.winstl.system.directory_functions**~~~ - ✅; - * [x] ~~~implement **unixstl_C_get_home_directory_invoke_getenv_a_()** in terms of `WINSTL_API_INTERNAL_System_get_home_directory_a_()`~~~ - ✅; +- [1.11](#111) + - [1.11.1](#1111) + - [1.11.2](#1112) + - [1.11.3](#1113) + - [1.11.4](#1114) + - [1.11.5](#1115) + - [1.11.6](#1116) + - [1.11.7](#1117) + - [1.11.8](#1118) + - [1.11.9](#1119) + - [1.11.10](#11110) + - [1.11.11](#11111) +- [1.12](#112) +- [Requires clarification by project maintainers](#requires-clarification-by-project-maintainers) +- [Abandoned](#abandoned) + + +## 1.11 + + +### 1.11.1 + +* [ ] Remove **WTL**; +* [ ] ACESTL: implement `invoke_ACE_OS_snprintf` in terms of `stlsoft_C_snprintf()`; + + +### 1.11.2 + +Dedicated increment: **test analysis and coverage only** — no other product changes in this release. + +* [ ] Existing test consistency (deep analysis); +* [ ] Complete coverage of currently tested components (improvement / completion); +* [ ] Coverage of currently untested components; + + +### 1.11.3 + +* [ ] Remove defunct compilers; +* [ ] `invalid_integral_range_policy::operator()` — implement in terms of `stlsoft_C_snprintf()` (replace `::sprintf`); +* [ ] Canonicalise exception messages (consistency, lower-case, etc.); +* [ ] Rename HAS files under **include/stlsoft/internal/std/has/** to remove the trailing `_` (and disambiguate further if needed); +* [ ] Add **test.performance.stlsoft.util.bit_functions**; +* [ ] Take down https://github.com/synesissoftware/STLSoft-1.10-delta; + + +### 1.11.4 + * [ ] `platformstl::FILE_stream` implemented in terms of **stlsoft/api/internal/memfns.h**; -* [x] ~~~`unixstl::glob_sequence` add `skipHiddenFiles` and `skipHiddenDirs`~~~ - ✅; -* [x] ~~~`unixstl::readdir_sequence` add `skipHiddenFiles` and `skipHiddenDirs`~~~ - ✅; -* [ ] standardise (via **INTERNAL**) of following: - * [x] ~~~`ExpandEnvironmentStringsA/W()`~~~ - ✅; - * [x] ~~~`GetEnvironmentVariableA/W()`~~~ - ✅; - * [x] ~~~`GetModuleFileNameA/W()`~~~ - ✅; - * [x] ~~~`GetSystemDirectoryA/W()`~~~ - ✅; - * [x] ~~~needs to set `ERROR_INSUFFICIENT_BUFFER`~~~ - ✅; - * [x] ~~~`GetWindowsDirectoryA/W()`~~~ - ✅; - * [x] ~~~needs to set `ERROR_INSUFFICIENT_BUFFER`~~~ - ✅; - - -### Code changes (1.12+) - -* [ ] C++ 11/14/17/20/23/26 compatibility — inventory remaining gaps and record concrete per-standard fixes here (partial work already tracked under **Code changes (1.11.x)**); -* [ ] syslog in variadic templates, a la `winstl::output_debug_line()`; -* [ ] Simple thread-pool (bring from **SS** work circa 2000); -* [ ] include/*stl*/error => include/*stl*/diagnostics; -* [ ] memory-mapped-file class minor issues; -* [ ] canonicalise all exception messages - consistency, lower-case, etc.; -* [ ] bring in `platformstl::properties_file` from 1.12 project; -* [ ] bring in `platformstl::temporary_directory_contents` from 1.12 project; -* [ ] move include/stlsoft/util/string/*printf.h code to api/internal, and deprecate; -* [ ] same with the include/stlsoft/std/* files; -* [ ] rename all HAS files to remove the trailing _ (as that _might_ conflict with actual symbols; in any case, have the header name exact). Maybe further disambiguate with has_file/... and has_construct/...; -* [ ] deprecate various iterator types ...; -* [ ] centralise `mbstowcs`/`mbstowcs_s` and `wcstombs`/`wcstombs_s` in single function; -* [ ] have `basic_path_buffer` use pre and post eye-catcher (`STLSOFT_DEBUG`-only); -* [ ] standard names of integer-to-string and string-to-integer to allow for coming enhancements for multiple bases; - - -### abandoned TODOs -* [-] ~~~custom radix in integer_to_string - abandoned for performance reasons, and obviated by new conversion functions (oct, dec, hex) in 1.10~~~ - ❌; + +### 1.11.5 + +* [ ] Find all `STLSOFT_USING_SAFE_STR_FUNCTIONS` and abstract call sites to worker functions; -## Performance improvements +### 1.11.6 -* [x] ~~~optimise `char_traits<>` and/or `pod_fill_n()` block operations (e.g. in terms of `mem***()`)~~~ - ✅; -* [ ] **test.performance.stlsoft.util.bit_functions**; +* [ ] Flesh out declared-but-undefined `unixstl::system_traits` methods (Linux system calls; emulations/workarounds elsewhere) — see also [**KNOWN_ISSUES.md**](./KNOWN_ISSUES.md); -## Packaging improvements +### 1.11.7 +* [ ] Rename `include/*stl*/error` → `include/*stl*/diagnostics` (with deprecation aliases as needed); -### Administrative (1.10.x) -* [ ] GitHub README.md image features - version, build, etc; -* [ ] STLSoft 1.10-related blog posts (focusing on new components); -* [ ] fix Doxygen build; -* [x] ~~~CMake~~~ - ✅; +### 1.11.8 +* [ ] Move **include/stlsoft/util/string/**`*printf.h` into **api/internal** and deprecate the old headers; -### Administrative (1.11.x) -* [ ] flesh out [**README.md**](./README.md); -* [ ] convert to https://github.com/synesissoftware/STLSoft; -* [ ] take down https://github.com/synesissoftware/STLSoft-1.10-delta; -* [ ] Documentation improvements; -* [-] ~~~update the downloads on SourceForge~~~ - ❌ (canonical distribution is now GitHub); -* [-] ~~~sort the SourceForge site~~~ - ❌ (canonical presence is now GitHub); -* [ ] STLSoft 1.11-related blog posts (focusing on new components); -* [ ] Website - currently http://stlsoft.org/ is *VERY* out of date; +### 1.11.9 + +* [ ] Centralise `mbstowcs` / `mbstowcs_s` and `wcstombs` / `wcstombs_s` in a single function; + + +### 1.11.10 + +* [ ] Have `basic_path_buffer` use pre and post eye-catchers (`STLSOFT_DEBUG`-only); + + +### 1.11.11 + +* [ ] Doxygen build (**Doxyfile**, **generate_doxygen.sh**) and deeper API documentation — see also [**KNOWN_ISSUES.md**](./KNOWN_ISSUES.md); + + +## 1.12 + +From **1.12** onwards, every new component or feature must ship with an **example**, **unit tests**, and a **blog entry** on the new Website (website work is contemporaneous with 1.12). See **oss-library-modernisation** (STLSoft 1.12+ feature completeness). + +* [ ] Assess all **1.12** (separate internal repository) contents for inclusion, component by component; +* [ ] Inventory remaining C++11/14/17/20/23/26 gaps and record concrete per-standard fixes (see NOTE above); +* [ ] Further `system_traits` structural refactoring (CRTP common code; string abstraction into `stlsoft::`; safe-string sorting; `#make_writeable()` / `#make_readonly()`); +* [ ] `stlsoft::auto_buffer<>::copy_from()` — template across differing `V_internalSize`; +* [ ] Hash specialisations for all appropriate key types (incl. `stlsoft::basic_simple_string<>`, etc.); +* [ ] Syslog in variadic templates, a la `winstl::output_debug_line()`; +* [ ] Simple thread-pool (bring from **SS** work circa 2000); +* [ ] Bring in `platformstl::properties_file` from the unpublished 1.12 tree; +* [ ] Bring in `platformstl::temporary_directory_contents` from the unpublished 1.12 tree; +* [ ] Memory-mapped-file class minor issues; +* [ ] Deprecate various iterator types; +* [ ] Standard names of integer-to-string and string-to-integer (for multiple bases; may already be done — verify); +* [ ] Remove defunct / outmoded components; +* [ ] New Website (contemporaneous with 1.12); +* [ ] STLSoft-related blog posts on the new Website (focusing on new components); * [ ] Set-up donation; -* [ ] Ensure all permutations (in below table) work; - - -### Building/executing automated tests (1.11.x) - -| C++ | C | Clang 15.0 (macOS, ARM64) | Clang 17.0 (macOS, x64) | GCC 11.4 (Linux) | GCC 13.2 (Linux) | GCC 14.2 (Linux) | GCC 14.2 (MinGW, Windows) | Visual C++ 17.x (Windows) | -| ----- | --- | :-----------------------: | :---------------------: | :---------------: | :---------------: | :---------------: | :-----------------------: | :-----------------------: | -| 23 | 23 | | ✅ | | ✅ | ✅ | | | -| 23 | 17 | | ✅ | | | | | | -| 20 | 23 | | ✅ | | | | | | -| 20 | 17 | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| 20 | 11 | | ✅ | | | | | | -| 20 | 99 | | ✅ | | | | | | -| 20 | 90 | | ✅ | | | | | | -| 17 | 17 | | ✅ | ✅ | ✅ | ✅ | | ✅ | -| 17 | 11 | | ✅ | | | | ✅ | | -| 17 | 99 | | ✅ | | | | | | -| 17 | 90 | | ✅ | | | | | | -| 14 | 11 | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| 14 | 99 | | ✅ | | | | | | -| 14 | 90 | | ✅ | | | | | ✅ | -| 11 | 11 | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| 11 | 99 | | ✅ | | | ✅ | | | -| 11 | 90 | | ✅ | | | | | | -| 98 | 99 | | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | -| 98 | 90 | | ✅ | | ❌ | ❌ | | ✅ | - - -### Administrative (1.12+) - -* [ ] DO NOT just branch over; instead, take each component at a time and consider files such as include/stlsoft/util/std/stdio_overload_detectors.hpp even still having a purpose - Maybe this is a 1.12 thing?; -* [-] ~~~VC++ common makefile(s) (legacy build trees removed; CMake-only)~~~ - ❌; +* [ ] Work out how to provide compiler/language-dialect compatibility reporting in an automated or semi-automated manner henceforth (replaces the retired manual matrix); + + +## Requires clarification by project maintainers + +* [ ] Integrate **STLSoft**'s exception hierarchies with the new standard exception design — **1.12**; requires further elaboration by the project maintainer before implementation; + + +## Abandoned + +* [-] ~~~custom radix in integer_to_string - abandoned for performance reasons, and obviated by new conversion functions (oct, dec, hex) in 1.10~~~ - ❌; +* [-] ~~~SourceSafe-era “do not branch the whole monorepo” note~~~ - ❌ (obsolete under Git; superseded by assessing the separate 1.12 internal repository for inclusion); +* [-] ~~~Manual C/C++ dialect compatibility matrix in **TODO.md**~~~ - ❌ (CI is the record of actively exercised builds; automated/semi-automated reporting deferred to **1.12**); +* [-] ~~~Migrate/deprecate **include/stlsoft/std/**`*` in parallel with `*printf.h`~~~ - ❌ (cut); diff --git a/build_cmake.sh b/build_cmake.sh index 2c6ab398..55e6c4ac 100755 --- a/build_cmake.sh +++ b/build_cmake.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") IgnoreRemainingFlagsAndOptions=0 Targets=() @@ -103,10 +105,10 @@ else if [ -z "$Targets" ]; then - echo "Executing build (via command \`$MakeCmd\`)" + echo "Executing build for ${ProjectName} (via command \`$MakeCmd\`)" else - echo "Executing build (via command \`$MakeCmd\`) with specific target(s) $(join_by , "${Targets[@]}")" + echo "Executing build for ${ProjectName} (via command \`$MakeCmd\`) with specific target(s) $(join_by , "${Targets[@]}")" fi $MakeCmd ${Targets[*]} diff --git a/clean_cmake.sh b/clean_cmake.sh index 0abbeede..ead9c205 100755 --- a/clean_cmake.sh +++ b/clean_cmake.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") # ########################################################## @@ -69,7 +71,7 @@ else exit 1 else - echo "Cleaning build (via command \`$MakeCmd clean\`)" + echo "Cleaning ${ProjectName} build (via command \`$MakeCmd clean\`)" $MakeCmd clean status=$? diff --git a/cmake/BuildType.cmake b/cmake/BuildType.cmake index dce0a1b9..b5ac90e4 100644 --- a/cmake/BuildType.cmake +++ b/cmake/BuildType.cmake @@ -5,7 +5,7 @@ # Purpose: CMake module file (for BuildType) # # Created: 16th October 2019 -# Updated: 28th October 2024 +# Updated: 7th August 2026 # # ######################################################################## # @@ -35,7 +35,7 @@ include(BuildType) ]========] -if(EXISTS "${CMAKE_SOURCE_DIR}/.git") +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../.git") set(DEFAULT_BUILD_TYPE "Debug") else() @@ -47,8 +47,8 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.") - set(CACHE CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" - STRING "Choose the type of build." FORCE + set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING + "Choose the type of build." FORCE ) # Set the possible values of build type for cmake-gui @@ -58,4 +58,3 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif() # ############################## end of file ############################# # - diff --git a/cmake/TargetMacros.cmake b/cmake/TargetMacros.cmake index 393c6ea8..5f2b320c 100644 --- a/cmake/TargetMacros.cmake +++ b/cmake/TargetMacros.cmake @@ -6,6 +6,15 @@ function(define_automated_test_program program_name entry_point_source_name) ${entry_point_source_name} ) + # Prefer this tree's headers over any installed STLSoft. On Apple Clang, + # /usr/local/include is searched before -isystem paths, so includes that + # arrive only via imported deps (e.g. xTests) can otherwise shadow us. + set_property(TARGET ${program_name} PROPERTY NO_SYSTEM_FROM_IMPORTED TRUE) + target_include_directories(${program_name} + BEFORE PRIVATE + ${CMAKE_SOURCE_DIR}/include + ) + target_link_libraries(${program_name} $<$:cstring::core> $<$:shwild::core> @@ -65,6 +74,15 @@ function(define_example_program program_name entry_point_source_name) ${entry_point_source_name} ) + # Prefer this tree's headers over any installed STLSoft. On Apple Clang, + # /usr/local/include is searched before -isystem paths, so includes that + # arrive only via imported deps (e.g. xTests) can otherwise shadow us. + set_property(TARGET ${program_name} PROPERTY NO_SYSTEM_FROM_IMPORTED TRUE) + target_include_directories(${program_name} + BEFORE PRIVATE + ${CMAKE_SOURCE_DIR}/include + ) + target_link_libraries(${program_name} $<$:shwild::core> $<$:cstring::core> diff --git a/ctest_cmake.sh b/ctest_cmake.sh new file mode 100755 index 00000000..24c21723 --- /dev/null +++ b/ctest_cmake.sh @@ -0,0 +1,108 @@ +#! /bin/bash + +ScriptPath=$0 +Dir=$(cd $(dirname "$ScriptPath"); pwd) +Basename=$(basename "$ScriptPath") +CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +[[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make +MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") + +CMakeVerbose= +RunMake=1 + + +# ########################################################## +# command-line handling + +while [[ $# -gt 0 ]]; do + + case $1 in + --no-make|-M) + + RunMake=0 + ;; + --verbose|-V) + + CMakeVerbose=--verbose + ;; + --help) + + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" + cat << EOF +Runs CMake's CTest test program(s) + +$ScriptPath [ ... flags/options ... ] + +Flags/options: + + behaviour: + + -M + --no-make + does not execute CMake and make before running tests + + -V + --verbose + verbose test output + + + standard flags: + + --help + displays this help and terminates + +EOF + + exit 0 + ;; + *) + + >&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage" + + exit 1 + ;; + esac + + shift +done + + +# ########################################################## +# main() + +status=0 + +if [ $RunMake -ne 0 ]; then + + echo "Executing build for ${ProjectName} (via command \`$MakeCmd\`) and then running all component and unit test programs" + + mkdir -p $CMakeDir || exit 1 + + cd $CMakeDir + + $MakeCmd + status=$? + + cd ->/dev/null +else + + if [ ! -d "$CMakeDir" ] || [ ! -f "$CMakeDir/CMakeCache.txt" ] || [ ! -d "$CMakeDir/CMakeFiles" ]; then + + >&2 echo "$ScriptPath: cannot run in '--no-make' mode without a previous successful build step" + fi +fi + +if [ $status -eq 0 ]; then + + echo "Running CMake tests" + + ctest --test-dir $CMakeDir $CMakeVerbose + status=$? +fi + +exit $status + + +# ############################## end of file ############################# # diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 041a6cbd..201f3ecd 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,5 +1,5 @@ -include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(BEFORE ${CMAKE_SOURCE_DIR}/include) if(_BUILD_AS_UNIX) diff --git a/execute_performance_tests.sh b/execute_performance_tests.sh index 970796b6..69aed3cf 100755 --- a/execute_performance_tests.sh +++ b/execute_performance_tests.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") ExpandWidth=0 ListOnly=0 @@ -85,7 +87,7 @@ status=0 if [ $RunMake -ne 0 ]; then if [ $ListOnly -eq 0 ]; then - echo "Executing make and then running all performance test programs" + echo "Executing build (via command \`$MakeCmd\`) and then running all ${ProjectName} performance test programs" mkdir -p $CMakeDir || exit 1 @@ -110,10 +112,10 @@ if [ $status -eq 0 ]; then if [ $ListOnly -ne 0 ]; then - echo "Listing all performance test programs" + echo "Listing all ${ProjectName} performance test programs" else - echo "Running all performance test programs" + echo "Running all ${ProjectName} performance test programs" fi for f in $(find "$CMakeDir" -type f '(' -name 'test_performance*' -o -name 'test.performance.*' ')' -exec test -x {} \; -print | sort) diff --git a/prepare_cmake.sh b/prepare_cmake.sh index 5db61c53..48f32a74 100755 --- a/prepare_cmake.sh +++ b/prepare_cmake.sh @@ -4,8 +4,17 @@ ScriptPath=$0 Dir=$(cd $(dirname "$ScriptPath"); pwd) Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} -[[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make +if [[ -n "$MSYSTEM" ]]; then + + DefaultMakeCmd=mingw32-make.exe + MinGW=1 +else + + DefaultMakeCmd=make +fi MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") Configuration=Release @@ -152,7 +161,7 @@ mkdir -p $CMakeDir || exit 1 cd $CMakeDir -echo "Executing CMake (in ${CMakeDir})" +echo "Executing CMake for ${ProjectName} (in ${CMakeDir})" if [ $ExamplesDisabled -eq 0 ]; then CMakeBuildExamplesFlag="ON" ; else CMakeBuildExamplesFlag="OFF" ; fi if [ $MSVC_MT -eq 0 ]; then CMakeMsvcMtFlag="OFF" ; else CMakeMsvcMtFlag="ON" ; fi @@ -195,7 +204,7 @@ status=0 if [ $RunMake -ne 0 ]; then - echo "Executing build (via command \`$MakeCmd\`)" + echo "Executing build for ${ProjectName} (via command \`$MakeCmd\`)" $MakeCmd status=$? diff --git a/remove_cmake_artefacts.sh b/remove_cmake_artefacts.sh index 0ffde798..97c1bc00 100755 --- a/remove_cmake_artefacts.sh +++ b/remove_cmake_artefacts.sh @@ -4,6 +4,8 @@ ScriptPath=$0 Dir=$(cd $(dirname "$ScriptPath"); pwd) Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") Directories=( CMakeFiles @@ -100,7 +102,7 @@ if [ ! -d "$CMakeDir" ]; then exit 0 else - echo "Removing all cmake artefacts in '$CMakeDir'" + echo "Removing all ${ProjectName} cmake artefacts in '$CMakeDir'" num_dirs_removed=0 num_files_removed=0 diff --git a/run_all_examples.sh b/run_all_examples.sh index dc9337f3..b9f90b02 100755 --- a/run_all_examples.sh +++ b/run_all_examples.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") ListOnly=0 RunMake=1 @@ -148,7 +150,7 @@ if [ $RunMake -ne 0 ]; then if [ $ListOnly -eq 0 ]; then - echo "Executing build (via command \`$MakeCmd\`) and then running all example programs" + echo "Executing build (via command \`$MakeCmd\`) and then running all ${ProjectName} example programs" mkdir -p $CMakeDir || exit 1 @@ -180,10 +182,10 @@ if [ $status -eq 0 ]; then if [ $ListOnly -ne 0 ]; then - echo "Listing all example programs" + echo "Listing all ${ProjectName} example programs" else - echo "Running all example programs" + echo "Running all ${ProjectName} example programs" fi for f in $(find "$CMakeDir/examples" -type f -exec test -x {} \; -print | sort) diff --git a/run_all_scratch_tests.sh b/run_all_scratch_tests.sh index 98929b3c..dc6710a4 100755 --- a/run_all_scratch_tests.sh +++ b/run_all_scratch_tests.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") ListOnly=0 RunMake=1 @@ -85,7 +87,7 @@ status=0 if [ $RunMake -ne 0 ]; then if [ $ListOnly -eq 0 ]; then - echo "Executing make and then running all scratch test programs" + echo "Executing build (via command \`$MakeCmd\`) and then running all ${ProjectName} scratch test programs" mkdir -p $CMakeDir || exit 1 @@ -110,10 +112,10 @@ if [ $status -eq 0 ]; then if [ $ListOnly -ne 0 ]; then - echo "Listing all scratch test programs" + echo "Listing all ${ProjectName} scratch test programs" else - echo "Running all scratch test programs" + echo "Running all ${ProjectName} scratch test programs" fi for f in $(find "$CMakeDir" -type f '(' -name 'test_scratch*' -o -name 'test.scratch.*' ')' -exec test -x {} \; -print | sort) diff --git a/run_all_unit_tests.sh b/run_all_unit_tests.sh index 12fe51a7..e4fa11b2 100755 --- a/run_all_unit_tests.sh +++ b/run_all_unit_tests.sh @@ -6,6 +6,8 @@ Basename=$(basename "$ScriptPath") CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} [[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") ListOnly=0 RunMake=1 @@ -119,7 +121,7 @@ if [ $RunMake -ne 0 ]; then if [ $ListOnly -eq 0 ]; then - echo "Executing build (via command \`$MakeCmd\`) and then running all ${TestKindDescription} programs" + echo "Executing build (via command \`$MakeCmd\`) and then running all ${ProjectName} ${TestKindDescription} programs" mkdir -p $CMakeDir || exit 1 @@ -144,10 +146,10 @@ if [ $status -eq 0 ]; then if [ $ListOnly -ne 0 ]; then - echo "Listing all ${TestKindDescription} programs" + echo "Listing all ${ProjectName} ${TestKindDescription} programs" else - echo "Running all ${TestKindDescription} programs" + echo "Running all ${ProjectName} ${TestKindDescription} programs" fi if [ $UnitOnly -ne 0 ]; then diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 96959bf6..c0fdc161 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,5 @@ -include_directories(${CMAKE_SOURCE_DIR}/include) +include_directories(BEFORE ${CMAKE_SOURCE_DIR}/include) if(_BUILD_AS_UNIX) diff --git a/test/component/winstl/filesystem/test.component.winstl.filesystem.C.memory_map_functions/entry.c b/test/component/winstl/filesystem/test.component.winstl.filesystem.C.memory_map_functions/entry.c index f095b724..d9522e91 100644 --- a/test/component/winstl/filesystem/test.component.winstl.filesystem.C.memory_map_functions/entry.c +++ b/test/component/winstl/filesystem/test.component.winstl.filesystem.C.memory_map_functions/entry.c @@ -4,7 +4,7 @@ * Purpose: Scratch test for memory-map functions. * * Created: 26th August 2010 - * Updated: 23rd August 2025 + * Updated: 8th August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -157,7 +157,7 @@ static int teardown(void* param) static void test_1_0() { - ws_uintptr_t viewSize; + ws_uintptr_t viewSize = 0; void* view = winstl_C_map_readonly_view_of_file_by_name_a(TEST_FILE_NAME, GENERIC_READ, 0, 0, 0, &viewSize); XTESTS_TEST_POINTER_NOT_EQUAL(NULL, view); @@ -186,7 +186,7 @@ static void test_1_0() static void test_1_1() { - ws_uintptr_t viewSize; + ws_uintptr_t viewSize = 0; ws_uintptr_t offset = 65536; ws_uint32_t requestSize = 8092; void* view = winstl_C_map_readonly_view_of_file_by_name_a(TEST_FILE_NAME, GENERIC_READ, 0, offset, requestSize, &viewSize); @@ -224,7 +224,7 @@ static void test_1_2() ws_uint32_t requestSize; for (requestSize = 0; requestSize <= (65536 * 1024); requestSize = (0 == requestSize) ? 0x1 : (requestSize << 1)) { - ws_uintptr_t viewSize; + ws_uintptr_t viewSize = 0; ws_uintptr_t offset = 65536; void* view = winstl_C_map_readonly_view_of_file_by_name_a(TEST_FILE_NAME, GENERIC_READ, 0, offset, requestSize, &viewSize); DWORD err = GetLastError();