From 855c01bc77bc2cb1a6e9f892f9d5596525a847b2 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 12:57:40 +0100 Subject: [PATCH 01/21] make configure_for_rtd.sh callable from everywhere --- scripts/configure_for_rtd.sh | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 scripts/configure_for_rtd.sh diff --git a/scripts/configure_for_rtd.sh b/scripts/configure_for_rtd.sh old mode 100644 new mode 100755 index dc44a436e7..b5e96a024d --- a/scripts/configure_for_rtd.sh +++ b/scripts/configure_for_rtd.sh @@ -20,6 +20,8 @@ # along with t8code; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +cd "$(git rev-parse --show-toplevel)" + git submodule init git submodule update From d36243579afdc991717408954adc7562e4188549 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 12:59:32 +0100 Subject: [PATCH 02/21] move t8indent_ignore.sh to internal/ --- scripts/indent_all_files.sh | 6 +++--- scripts/{ => internal}/t8indent_ignore.sh | 4 ++-- scripts/t8indent.sh | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) rename scripts/{ => internal}/t8indent_ignore.sh (98%) diff --git a/scripts/indent_all_files.sh b/scripts/indent_all_files.sh index 8d0559530f..71f3ef96f9 100755 --- a/scripts/indent_all_files.sh +++ b/scripts/indent_all_files.sh @@ -49,7 +49,7 @@ notallindented=0 INDENT=./t8indent.sh -echo This script will change all source files found in +echo This script will change all source files found in echo $PWD/../src/ echo $PWD/../example/ echo $PWD/../test/ @@ -72,14 +72,14 @@ then then $INDENT $file status=$? - if test $status -ne 0 + if test $status -ne 0 then echo "File $file is not indented." notallindented=1 fi fi done - + if test $notallindented -eq 0 then echo All files are indented. diff --git a/scripts/t8indent_ignore.sh b/scripts/internal/t8indent_ignore.sh similarity index 98% rename from scripts/t8indent_ignore.sh rename to scripts/internal/t8indent_ignore.sh index 6a0c982c23..fadec42ce0 100755 --- a/scripts/t8indent_ignore.sh +++ b/scripts/internal/t8indent_ignore.sh @@ -19,9 +19,9 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # This is t8code's indentation ignore file. -# All files listed here are ignored by out t8indent.sh script and thus not +# All files listed here are ignored by out t8indent.sh script and thus not # indented according to our indentation guidelines. -# Since we rely on clang-format version 17 and clang-format.ignored files +# Since we rely on clang-format version 17 and clang-format.ignored files # have only been introduced in version 18, we need to manually parse # this list and throw out the matching files. This happens in t8indent.sh diff --git a/scripts/t8indent.sh b/scripts/t8indent.sh index 750ecd6c51..32808451ef 100755 --- a/scripts/t8indent.sh +++ b/scripts/t8indent.sh @@ -66,12 +66,12 @@ fi # # Parsing of input files and throwing out files to be ignored # -# Read all lines from the IGNORE_FILE +# Read all lines from the IGNORE_FILE # that are not empty and are not comments (i.e. start with '#'). # Determine base directory of git repo GIT_REPO_PATH=$(git rev-parse --show-toplevel) -IGNORE_FILE=${GIT_REPO_PATH}/scripts/t8indent_ignore.sh +IGNORE_FILE=${GIT_REPO_PATH}/scripts/internal/t8indent_ignore.sh files_to_ignore=() while read line; do if [[ ${line:0:1} != "#" ]] && [[ $line != "" ]] @@ -112,7 +112,7 @@ do do echo Checking "$arg" against "${GIT_REPO_PATH}/$ignore_file" if [[ "$arg" -ef "${GIT_REPO_PATH}/$ignore_file" ]] - then + then # arg matches and will be ignored echo The file \"$arg\" will be ignored by indentation as specified in \"$IGNORE_FILE\". ignore_arg=1 @@ -136,7 +136,7 @@ then else $FORMAT $FORMAT_OPTIONS ${newargs[@]} status=$? -fi +fi # If the file content was not changed, the return # value determines whether or not the file was From 6ff81add08f63045672d8f653f4339cd5141ac15 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:04:03 +0100 Subject: [PATCH 03/21] move check_macros.sh to internal/ --- .github/workflows/spell_check.yml | 2 +- scripts/{ => internal}/check_macros.sh | 12 ++++++------ scripts/pre-commit | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) rename scripts/{ => internal}/check_macros.sh (96%) diff --git a/.github/workflows/spell_check.yml b/.github/workflows/spell_check.yml index 207182401d..305b1af303 100644 --- a/.github/workflows/spell_check.yml +++ b/.github/workflows/spell_check.yml @@ -38,7 +38,7 @@ jobs: - name: check macros run: | for file in $(git diff --name-only --diff-filter=A); do - ./scripts/check_macros.sh "$file" &>> check_macros.txt + ./scripts/internal/check_macros.sh "$file" &>> check_macros.txt done - name: Archive script output if: failure() diff --git a/scripts/check_macros.sh b/scripts/internal/check_macros.sh similarity index 96% rename from scripts/check_macros.sh rename to scripts/internal/check_macros.sh index cd6cc8e5cf..7597ea9c11 100755 --- a/scripts/check_macros.sh +++ b/scripts/internal/check_macros.sh @@ -35,19 +35,19 @@ then exit 0 fi -# -# This script searches for lines containing a macro definition in the style of '#ifdef T8_ENABLE_' +# +# This script searches for lines containing a macro definition in the style of '#ifdef T8_ENABLE_' # in the specified file and processes each matching line. -# It uses 'grep' to find all occurrences of '#ifdef T8_ENABLE_' in the file located -# at the path stored in the variable 'file_path'. The '-n' option with 'grep' +# It uses 'grep' to find all occurrences of '#ifdef T8_ENABLE_' in the file located +# at the path stored in the variable 'file_path'. The '-n' option with 'grep' # ensures that the line numbers of the matching lines are included in the output. -# The output of 'grep' is then piped into a 'while' loop, which reads each line +# The output of 'grep' is then piped into a 'while' loop, which reads each line # and splits it into the line number and the line content using ':' as the delimiter. # Variables: # - file_path: The path to the file to be searched. # - line_number: The line number where the macro definition is found. # - line: The content of the line where the macro definition is found. -# +# found_macros=FALSE diff --git a/scripts/pre-commit b/scripts/pre-commit index 19b160f9d9..cf062bdace 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -38,7 +38,7 @@ GIT_REPO_PATH=$(git rev-parse --show-toplevel) # Set paths to check scripts CHECK_INDENT=$GIT_REPO_PATH/scripts/check_if_file_indented.sh -CHECK_MACROS=$GIT_REPO_PATH/scripts/check_macros.sh +CHECK_MACROS=$GIT_REPO_PATH/scripts/internal/check_macros.sh TYPOS=`which typos 2> /dev/null` TYPOS_CONFIG_FILE=./.typos.toml @@ -92,7 +92,7 @@ do if ! [ -z "$status" ]; then echo "File $file contains typos." nocontinue=1 - fi + fi # We only indent .c, .cxx, .h and .hxx files #-a ${file: -2} != ".h" ] @@ -102,7 +102,7 @@ do echo "Checking file $file" $CHECK_INDENT $file > /dev/null 2>&1 status=$? - if test $status -ne 0 + if test $status -ne 0 then echo "File $file is not indented." nocontinue=1 @@ -116,7 +116,7 @@ do # - nocontinue: Flag set to 1 if the incorrect macro usage is found. $CHECK_MACROS $file status=$? - if test $status -ne 0 + if test $status -ne 0 then nocontinue=1 fi From 7d84416697fe14c6fc6be706edcc5443fdbc8829 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:05:47 +0100 Subject: [PATCH 04/21] make check_all_test_binaries_valgrind.sh executable --- scripts/check_all_test_binaries_valgrind.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/check_all_test_binaries_valgrind.sh diff --git a/scripts/check_all_test_binaries_valgrind.sh b/scripts/check_all_test_binaries_valgrind.sh old mode 100644 new mode 100755 From 4653aa138c59450b48654398262947379e92f9a7 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:29:56 +0100 Subject: [PATCH 05/21] make file checking prettier --- scripts/check_valgrind.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/check_valgrind.sh b/scripts/check_valgrind.sh index 635bdfd34b..c33c685413 100644 --- a/scripts/check_valgrind.sh +++ b/scripts/check_valgrind.sh @@ -21,7 +21,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -# This script runs Valgrind on an input binary paths with specified memory leak detection flags. +# This script runs Valgrind on an input binary paths with specified memory leak detection flags. # The Valgrind output is parsed. If any errors are found, they are printed and the script exits with a status of 1. # If errors are found, the Valgrind output is kept in the file valgrind-output.log for further inspection. # Using "--supp=[FILE]", you can provide a path to a suppression file that is used by Valgrind to suppress certain errors. @@ -32,7 +32,7 @@ $0 [FILE] --supp=[SUPPRESSION_FILE] --ntasks=[NUM_TASKS]\n to run valgrind on FILE. Optionally you can provide a suppression file and the number of parallel processes to use with MPI.\n" # Check that an argument is given and that the argument is a file. -if [ ${1-x} = x ]; then +if [ -z "$1" ]; then echo "ERROR: Need to provide a file as first argument." echo -e "$USAGE" exit 1 From 2e2bd5241afbbf98b72b631cf045c69e8ba8b37c Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:30:29 +0100 Subject: [PATCH 06/21] make check_valgrind.sh executable --- scripts/check_valgrind.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/check_valgrind.sh diff --git a/scripts/check_valgrind.sh b/scripts/check_valgrind.sh old mode 100644 new mode 100755 From 6ab04cd4642d46ad931493785cd19669d26e4ca4 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:31:50 +0100 Subject: [PATCH 07/21] make find_all_test_binary_paths.sh executable --- scripts/find_all_test_binary_paths.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/find_all_test_binary_paths.sh diff --git a/scripts/find_all_test_binary_paths.sh b/scripts/find_all_test_binary_paths.sh old mode 100644 new mode 100755 From e8f3e2fc1a5a960d4d75e0556a0bc8ce8172f243 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:45:03 +0100 Subject: [PATCH 08/21] read exit code of subscript --- scripts/check_all_test_binaries_valgrind.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/check_all_test_binaries_valgrind.sh b/scripts/check_all_test_binaries_valgrind.sh index c4f5796b30..2c0a05302e 100755 --- a/scripts/check_all_test_binaries_valgrind.sh +++ b/scripts/check_all_test_binaries_valgrind.sh @@ -62,10 +62,18 @@ fi # Find all test binary paths. test_bin_paths=`bash ./find_all_test_binary_paths.sh` +status=$? + +if [ $status -ne 0 ]; then + echo "$test_bin_paths" + echo "Failed to collect test binaries." + exit $status +fi + num_paths=$(echo $test_bin_paths | wc -w) -# This is necessary because some tests use test files specified by relative paths. -# These tests only work when run from the build/test/ directory. +# This is necessary because some tests use test files specified by relative paths. +# These tests only work when run from the build/test/ directory. if [ -d ../build/test ]; then # The directory stack is automatically reset on script exit. pushd ../build/test/ > /dev/null From e229af06c33d4f1d57d721a94fa51f891966da1d Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:45:45 +0100 Subject: [PATCH 09/21] make valgrind check not assume any folder structures --- scripts/check_all_test_binaries_valgrind.sh | 25 ++++++++++++++++++--- scripts/find_all_test_binary_paths.sh | 14 ++++++------ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/scripts/check_all_test_binaries_valgrind.sh b/scripts/check_all_test_binaries_valgrind.sh index 2c0a05302e..e6cda5df04 100755 --- a/scripts/check_all_test_binaries_valgrind.sh +++ b/scripts/check_all_test_binaries_valgrind.sh @@ -23,16 +23,35 @@ # # This script performs a valgrind check on each test binary given by find_all_test_binary_paths.sh. # The valgrind check is done by the check_valgrind.sh script. -# The script returns 1 if an error is found and 0 otherwise. +# The script returns 1 if an error is found and 0 otherwise. # This script must be executed from the scripts/ folder. # It is assumed that the build folder ../build/test/ with the correct test binaries exists. # With "--ntasks=[NUMBER]", you can provide the number of processes to use with MPI for parallel tests (default is 1). # USAGE="\nUSAGE: This script executes valgrind in parallel on each test binary available. Use the syntax \n -$0 --ntasks=[NUM_TASKS]\n +$0 [TEST_BINARY_PATH] --ntasks=[NUM_TASKS]\n Providing the number of parallel processes to use with MPI for parallel tests is optional.\n" +# Check directory exists +if [ -z "$1" ]; then + echo "ERROR: Need to provide a directory as first argument." + echo -e "$USAGE" + exit 1 +fi + +# Check if it is a directory +if [ -d "$1" ]; then + TEST_BINARY_PATH="$1" +else + echo "ERROR: Directory does not exist: $1" + echo -e "$USAGE" + exit 1 +fi + +#convert to abspath +TEST_BINARY_ABSPATH=$(realpath $TEST_BINARY_PATH) + # Check if a number of processes is provided. If not, set to 1. num_procs=1 for arg in "$@"; do @@ -61,7 +80,7 @@ if [ `basename $PWD` != scripts ]; then fi # Find all test binary paths. -test_bin_paths=`bash ./find_all_test_binary_paths.sh` +test_bin_paths=$(bash ./find_all_test_binary_paths.sh "$TEST_BINARY_ABSPATH") status=$? if [ $status -ne 0 ]; then diff --git a/scripts/find_all_test_binary_paths.sh b/scripts/find_all_test_binary_paths.sh index 6abc889624..170cb3f98d 100755 --- a/scripts/find_all_test_binary_paths.sh +++ b/scripts/find_all_test_binary_paths.sh @@ -26,16 +26,16 @@ # The paths are relative paths assuming an execution from the test/ folder in the build directory. # -build_test_directory="../build/test/" +TEST_BINARY_PATH="$1" # Check that path to test folder in build directory is correct. -if [ ! -d "$build_test_directory" ]; then - echo "Directory build/test/ not found!" +if [ ! -d "$TEST_BINARY_PATH" ]; then + echo "Directory $TEST_BINARY_PATH not found!" exit 1 fi -# Find all executables in the build/test/ directory (that do not have a .so file ending) -# and store the relative paths to the build_test_directory with leading "./". -test_bin_paths=$(find "$build_test_directory" -type f -executable -not -name "*.so" -exec realpath --relative-to="$build_test_directory" {} \; | sed 's|^|./|') +# Find all executables in the build/test/ directory (that do not have a .so file ending) +# and store the relative paths to the TEST_BINARY_PATH with leading "./". +test_bin_paths=$(find "$TEST_BINARY_PATH" -type f -executable -not -name "*.so" -exec realpath --relative-to="$TEST_BINARY_PATH" {} \; | sed 's|^|./|') -echo $test_bin_paths +echo "$test_bin_paths" From b0e3b205d4f9a0b97ccad7baed97d50f7930da30 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:48:16 +0100 Subject: [PATCH 10/21] move find_all_test_binary_paths.sh to internal/ --- scripts/check_all_test_binaries_valgrind.sh | 4 ++-- scripts/{ => internal}/find_all_test_binary_paths.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename scripts/{ => internal}/find_all_test_binary_paths.sh (97%) diff --git a/scripts/check_all_test_binaries_valgrind.sh b/scripts/check_all_test_binaries_valgrind.sh index e6cda5df04..0eec54daa2 100755 --- a/scripts/check_all_test_binaries_valgrind.sh +++ b/scripts/check_all_test_binaries_valgrind.sh @@ -4,7 +4,7 @@ # t8code is a C library to manage a collection (a forest) of multiple # connected adaptive space-trees of general element classes in parallel. # -# Copyright (C) 2025 the developers +# Copyright (C) 2026 the developers # # t8code is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -97,7 +97,7 @@ if [ -d ../build/test ]; then # The directory stack is automatically reset on script exit. pushd ../build/test/ > /dev/null else - echo "ERROR: Couldn't find a the directory ../build/test/." + echo "ERROR: Couldn't find the directory ../build/test/." echo -e "$USAGE" exit 1 fi diff --git a/scripts/find_all_test_binary_paths.sh b/scripts/internal/find_all_test_binary_paths.sh similarity index 97% rename from scripts/find_all_test_binary_paths.sh rename to scripts/internal/find_all_test_binary_paths.sh index 170cb3f98d..6984067bba 100755 --- a/scripts/find_all_test_binary_paths.sh +++ b/scripts/internal/find_all_test_binary_paths.sh @@ -4,7 +4,7 @@ # t8code is a C library to manage a collection (a forest) of multiple # connected adaptive space-trees of general element classes in parallel. # -# Copyright (C) 2025 the developers +# Copyright (C) 2026 the developers # # t8code is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by From 60a3eb4fcd4cd8e390b6d3741de5e1a430a0dba6 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:50:26 +0100 Subject: [PATCH 11/21] make license prettier --- scripts/find_disabled_tests.sh | 39 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/scripts/find_disabled_tests.sh b/scripts/find_disabled_tests.sh index efa3460aa3..0fa60081f5 100755 --- a/scripts/find_disabled_tests.sh +++ b/scripts/find_disabled_tests.sh @@ -1,25 +1,24 @@ #!/bin/bash - -#This file is part of t8code. -#t8code is a C library to manage a collection (a forest) of multiple -#connected adaptive space-trees of general element classes in parallel. - -#Copyright (C) 2024 the developers - -#t8code is free software; you can redistribute it and/or modify -#it under the terms of the GNU General Public License as published by -#the Free Software Foundation; either version 2 of the License, or -#(at your option) any later version. - -#t8code is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -#GNU General Public License for more details. - -#You should have received a copy of the GNU General Public License -#along with t8code; if not, write to the Free Software Foundation, Inc., -#51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# This file is part of t8code. +# t8code is a C library to manage a collection (a forest) of multiple +# connected adaptive space-trees of general element classes in parallel. +# +# Copyright (C) 2024 the developers +# +# t8code is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# t8code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with t8code; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. From 0fdb769bdb96ce75bc9c3bfc699c96398deb33c0 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:51:28 +0100 Subject: [PATCH 12/21] move find_all_source_files.sh to internal/ --- scripts/check_if_all_files_indented.sh | 2 +- scripts/indent_all_files.sh | 2 +- scripts/{ => internal}/find_all_source_files.sh | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename scripts/{ => internal}/find_all_source_files.sh (100%) diff --git a/scripts/check_if_all_files_indented.sh b/scripts/check_if_all_files_indented.sh index dca7f1a81c..4c8208c3bf 100755 --- a/scripts/check_if_all_files_indented.sh +++ b/scripts/check_if_all_files_indented.sh @@ -44,7 +44,7 @@ fi # Find all files with the appropriate suffix. # Excluding the sc/ and p4est/ subfolders. -files=`./find_all_source_files.sh` +files=`./internal/find_all_source_files.sh` notallindented=0 for file in $files diff --git a/scripts/indent_all_files.sh b/scripts/indent_all_files.sh index 71f3ef96f9..a1fbca41f7 100755 --- a/scripts/indent_all_files.sh +++ b/scripts/indent_all_files.sh @@ -43,7 +43,7 @@ fi # Find all files with the appropriate suffix. # Excluding the sc/ and p4est/ subfolders. -files=`./find_all_source_files.sh` +files=`./internal/find_all_source_files.sh` notallindented=0 diff --git a/scripts/find_all_source_files.sh b/scripts/internal/find_all_source_files.sh similarity index 100% rename from scripts/find_all_source_files.sh rename to scripts/internal/find_all_source_files.sh From 544b1a1e220a119637cba22ceb56c73960b027c7 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:51:50 +0100 Subject: [PATCH 13/21] update path --- pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pull_request_template.md b/pull_request_template.md index 9487fb68b8..9b7346fbe5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -25,7 +25,7 @@ If the Pull request introduces code that is not covered by the github action (fo - [ ] Should this use case be added to the github action? - [ ] If not, does the specific use case compile and all tests pass (check manually). #### Scripts and Wiki -- [ ] If a new directory with source files is added, it must be covered by the `script/find_all_source_files.scp` to check the indentation of these files. +- [ ] If a new directory with source files is added, it must be covered by the `scripts/find_all_source_files.scp` to check the indentation of these files. - [ ] If this PR introduces a new feature, it must be covered in an example or tutorial and a Wiki article. #### License - [ ] The author added a BSD statement to `doc/` (or already has one). \ No newline at end of file From 62580013679a5a792f7e3a0df1e33c269d50088a Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:52:06 +0100 Subject: [PATCH 14/21] update readme to new folder structure --- scripts/README.md | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index c573496467..d1ee18813e 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -14,15 +14,10 @@ You can also provide a list of files and all will get indented. This script uses the `clang-format` program with t8code specific settings. Sometimes `t8indent.sh` does produce undesired results. Therefore, after indenting use `git add -p` or similar to check all changes before committing. You can protect code lines from being changed by the script by enclosing them in `/* clang-format off */` and `/* clang-format on */` comments. - -#### t8indent_ignore.sh +#### internal/t8indent_ignore.sh A list of files that will be ignored by `t8indent.sh`. -#### pre-commit - -This script should be copied to your `.git/hooks` folder. `git` then automatically checks the indentation of committed files and prevents you from committing wrongly indented files. See [Git indentation workflow](https://github.com/DLR-AMR/t8code/wiki/Coding-Guideline#git-indentation-workflow). - #### check_if_file_indented.sh Check for a single source file whether it is indented according to `t8indent.sh`. @@ -35,30 +30,23 @@ Check whether all t8code source files are properly indented. This script indents all t8code source files at once. This script should only be used by the main developers of t8code. Handle with care. -#### find_all_source_files.sh +## Software development + +#### pre-commit -List all source files of t8code in the `src/`, `example/` and `test/` subfolders. +This script should be copied to your `.git/hooks` folder. `git` then automatically checks the indentation of committed files and prevents you from committing wrongly indented files. See [Git indentation workflow](https://github.com/DLR-AMR/t8code/wiki/Coding-Guideline#git-indentation-workflow). #### check_valgrind.sh This script runs Valgrind on a binary path provided as a parameter with specified memory leak detection flags. The Valgrind output is parsed. Using `--supp=[FILE]`, you can provide a path to a suppression file that is used by Valgrind to suppress certain errors (e.g. [valgrind_suppressions_file](valgrind_suppressions_file.supp)). With `--ntasks=[NUMBER]`, you can provide the number of processes to use with mpi (default is 1). -#### find_all_test_binary_paths.sh - -This file lists all paths to test binaries that exist in the build/test directory. -The paths are relative paths assuming an execution from the test/ folder in the build directory. - #### check_all_test_binaries_valgrind.sh -This script performs a valgrind check on each test binary found by [find_all_test_binary_paths.sh](find_all_test_binary_paths.sh). +This script performs a valgrind check on each test binary found by [find_all_test_binary_paths.sh](internal/find_all_test_binary_paths.sh). The valgrind check is done by [check_valgrind.sh](check_valgrind.sh). It is assumed that the build folder ../build/test/ with the correct test binaries exists. With `--ntasks=[NUMBER]`, you can provide the number of processes to use with mpi for parallel tests (default is 1). ## Others -#### su2_mesh_to_gmsh.py - -Used to convert coarse meshes from an su2 format into msh format. - #### create_todo_list.sh Parses through the code and collects comments containing the `TODO` keyword. From 749d42c796898c0008fab0c5552b65a0ef3f1a5c Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:56:51 +0100 Subject: [PATCH 15/21] fix argument of valgrind action --- .github/workflows/test_valgrind.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_valgrind.yml b/.github/workflows/test_valgrind.yml index 91dd1f6be4..4225171d18 100644 --- a/.github/workflows/test_valgrind.yml +++ b/.github/workflows/test_valgrind.yml @@ -122,4 +122,4 @@ jobs: # Execute script that runs a Valgrind check for all test binaries. # We use 4 parallel processes to run the binaries in parallel with MPI. - name: Valgrind check - run: cd scripts && bash ./check_all_test_binaries_valgrind.sh --ntasks=4 + run: cd scripts && bash ./check_all_test_binaries_valgrind.sh ../build/test/ --ntasks=4 From 5cf2f1b1fbf12820a86f2647d8132cea4ac02062 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:59:16 +0100 Subject: [PATCH 16/21] rename t8indent to indent to match other scripts --- scripts/{t8indent.sh => indent.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{t8indent.sh => indent.sh} (100%) diff --git a/scripts/t8indent.sh b/scripts/indent.sh similarity index 100% rename from scripts/t8indent.sh rename to scripts/indent.sh From d939d8d20f2ef7ce9622a69b99375002fb67eacc Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 13:59:41 +0100 Subject: [PATCH 17/21] rename t8spell_check_and_indent.sh to spell_check_and_indent.sh to match other scripts --- .../{t8spell_check_and_indent.sh => spell_check_and_indent.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{t8spell_check_and_indent.sh => spell_check_and_indent.sh} (100%) diff --git a/scripts/t8spell_check_and_indent.sh b/scripts/spell_check_and_indent.sh similarity index 100% rename from scripts/t8spell_check_and_indent.sh rename to scripts/spell_check_and_indent.sh From f4222a5a6c218ef237028a29b3535a0898475e22 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 14:02:34 +0100 Subject: [PATCH 18/21] rename other occurences of t8indent to indent --- .typos.toml | 2 +- scripts/README.md | 10 +++++----- scripts/check_if_file_indented.sh | 8 ++++---- scripts/indent.sh | 2 +- scripts/indent_all_files.sh | 2 +- .../internal/{t8indent_ignore.sh => indent_ignore.sh} | 4 ++-- scripts/spell_check_and_indent.sh | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) rename scripts/internal/{t8indent_ignore.sh => indent_ignore.sh} (91%) diff --git a/.typos.toml b/.typos.toml index 11d8700b70..b956ef5a00 100644 --- a/.typos.toml +++ b/.typos.toml @@ -3,4 +3,4 @@ eles = "eles" packageid = "packageid" [files] -extend-exclude = ["scripts/t8indent.sh", "thirdparty/", "t8code_logo.png", "cmake/FindOpenCASCADE.cmake", "src/t8_misc/t8_with_macro_error.h", "doc/Doxyfile.in"] +extend-exclude = ["scripts/indent.sh", "thirdparty/", "t8code_logo.png", "cmake/FindOpenCASCADE.cmake", "src/t8_misc/t8_with_macro_error.h", "doc/Doxyfile.in"] diff --git a/scripts/README.md b/scripts/README.md index d1ee18813e..17922aeb7f 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -6,21 +6,21 @@ This folder contains several scripts that are useful for t8code users and develo The purpose of the indentation scripts is to help t8code developers to indent their code according to the t8code [indentation guidelines](https://github.com/DLR-AMR/t8code/wiki/Coding-Guideline#indentation). Please read these guidelines before using these scripts. -#### t8indent.sh +#### indent.sh Apply this script to a `.c`, `.cxx`, `.h` or `.hxx` file to indent it according to the guidelines. You can also provide a list of files and all will get indented. This script uses the `clang-format` program with t8code specific settings. -Sometimes `t8indent.sh` does produce undesired results. Therefore, after indenting use `git add -p` or similar to check all changes before committing. You can protect code lines from being changed by the script by enclosing them in `/* clang-format off */` and `/* clang-format on */` comments. +Sometimes `indent.sh` does produce undesired results. Therefore, after indenting use `git add -p` or similar to check all changes before committing. You can protect code lines from being changed by the script by enclosing them in `/* clang-format off */` and `/* clang-format on */` comments. -#### internal/t8indent_ignore.sh +#### internal/indent_ignore.sh -A list of files that will be ignored by `t8indent.sh`. +A list of files that will be ignored by `indent.sh`. #### check_if_file_indented.sh -Check for a single source file whether it is indented according to `t8indent.sh`. +Check for a single source file whether it is indented according to `indent.sh`. #### check_if_all_files_indented.sh diff --git a/scripts/check_if_file_indented.sh b/scripts/check_if_file_indented.sh index be7c55b3c5..ca23327d56 100755 --- a/scripts/check_if_file_indented.sh +++ b/scripts/check_if_file_indented.sh @@ -21,14 +21,14 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -# This script checks if a given file is correctly indented according to the t8indent.sh script. -# +# This script checks if a given file is correctly indented according to the indent.sh script. +# GIT_REPO_PATH=$(git rev-parse --show-toplevel) -INDENT_SCRIPT=${GIT_REPO_PATH}/scripts/t8indent.sh +INDENT_SCRIPT=${GIT_REPO_PATH}/scripts/indent.sh -usage="USAGE:$0 [FILE_TO_CHECK]\n\nWill check if [FILE_TO_CHECK] is correctly indentend according to the script t8indent.sh." +usage="USAGE:$0 [FILE_TO_CHECK]\n\nWill check if [FILE_TO_CHECK] is correctly indentend according to the script indent.sh." # Check if first argument given if [ ${1-x} = x ] diff --git a/scripts/indent.sh b/scripts/indent.sh index 32808451ef..287580b703 100755 --- a/scripts/indent.sh +++ b/scripts/indent.sh @@ -71,7 +71,7 @@ fi # Determine base directory of git repo GIT_REPO_PATH=$(git rev-parse --show-toplevel) -IGNORE_FILE=${GIT_REPO_PATH}/scripts/internal/t8indent_ignore.sh +IGNORE_FILE=${GIT_REPO_PATH}/scripts/internal/indent_ignore.sh files_to_ignore=() while read line; do if [[ ${line:0:1} != "#" ]] && [[ $line != "" ]] diff --git a/scripts/indent_all_files.sh b/scripts/indent_all_files.sh index a1fbca41f7..4d7a7b4acf 100755 --- a/scripts/indent_all_files.sh +++ b/scripts/indent_all_files.sh @@ -47,7 +47,7 @@ files=`./internal/find_all_source_files.sh` notallindented=0 -INDENT=./t8indent.sh +INDENT=./indent.sh echo This script will change all source files found in echo $PWD/../src/ diff --git a/scripts/internal/t8indent_ignore.sh b/scripts/internal/indent_ignore.sh similarity index 91% rename from scripts/internal/t8indent_ignore.sh rename to scripts/internal/indent_ignore.sh index fadec42ce0..2c33ee86fb 100755 --- a/scripts/internal/t8indent_ignore.sh +++ b/scripts/internal/indent_ignore.sh @@ -19,11 +19,11 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # This is t8code's indentation ignore file. -# All files listed here are ignored by out t8indent.sh script and thus not +# All files listed here are ignored by out indent.sh script and thus not # indented according to our indentation guidelines. # Since we rely on clang-format version 17 and clang-format.ignored files # have only been introduced in version 18, we need to manually parse -# this list and throw out the matching files. This happens in t8indent.sh +# this list and throw out the matching files. This happens in indent.sh # Each file that is listed here must have a comment describing why # it is necessary to ignore indentation for this file. diff --git a/scripts/spell_check_and_indent.sh b/scripts/spell_check_and_indent.sh index 600b7bfb9e..f1ab9687a5 100755 --- a/scripts/spell_check_and_indent.sh +++ b/scripts/spell_check_and_indent.sh @@ -70,7 +70,7 @@ then if [[ $REPLY =~ ^[Yy]$ ]] then echo Indenting all files... - (cd $repo_main_dir && ./scripts/t8indent.sh $changed_files) + (cd $repo_main_dir && ./scripts/indent.sh $changed_files) echo done. else echo Aborted. From d7d8d3b3ffb37a681931a57261442bf2d46f26d0 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 14:03:59 +0100 Subject: [PATCH 19/21] make indent_ignore not executable, since it isnt a script --- scripts/README.md | 2 +- scripts/indent.sh | 2 +- scripts/internal/{indent_ignore.sh => indent_ignore} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename scripts/internal/{indent_ignore.sh => indent_ignore} (100%) mode change 100755 => 100644 diff --git a/scripts/README.md b/scripts/README.md index 17922aeb7f..6fc8c255bd 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -14,7 +14,7 @@ You can also provide a list of files and all will get indented. This script uses the `clang-format` program with t8code specific settings. Sometimes `indent.sh` does produce undesired results. Therefore, after indenting use `git add -p` or similar to check all changes before committing. You can protect code lines from being changed by the script by enclosing them in `/* clang-format off */` and `/* clang-format on */` comments. -#### internal/indent_ignore.sh +#### internal/indent_ignore A list of files that will be ignored by `indent.sh`. diff --git a/scripts/indent.sh b/scripts/indent.sh index 287580b703..e091533c8b 100755 --- a/scripts/indent.sh +++ b/scripts/indent.sh @@ -71,7 +71,7 @@ fi # Determine base directory of git repo GIT_REPO_PATH=$(git rev-parse --show-toplevel) -IGNORE_FILE=${GIT_REPO_PATH}/scripts/internal/indent_ignore.sh +IGNORE_FILE=${GIT_REPO_PATH}/scripts/internal/indent_ignore files_to_ignore=() while read line; do if [[ ${line:0:1} != "#" ]] && [[ $line != "" ]] diff --git a/scripts/internal/indent_ignore.sh b/scripts/internal/indent_ignore old mode 100755 new mode 100644 similarity index 100% rename from scripts/internal/indent_ignore.sh rename to scripts/internal/indent_ignore From 7f8df0e11c157d97282e8e25199e6f17687d6596 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 14:10:47 +0100 Subject: [PATCH 20/21] remove hard coded folder --- scripts/check_all_test_binaries_valgrind.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/scripts/check_all_test_binaries_valgrind.sh b/scripts/check_all_test_binaries_valgrind.sh index 0eec54daa2..0431d30f67 100755 --- a/scripts/check_all_test_binaries_valgrind.sh +++ b/scripts/check_all_test_binaries_valgrind.sh @@ -92,15 +92,9 @@ fi num_paths=$(echo $test_bin_paths | wc -w) # This is necessary because some tests use test files specified by relative paths. -# These tests only work when run from the build/test/ directory. -if [ -d ../build/test ]; then - # The directory stack is automatically reset on script exit. - pushd ../build/test/ > /dev/null -else - echo "ERROR: Couldn't find the directory ../build/test/." - echo -e "$USAGE" - exit 1 -fi +# These tests only work when run from the test directory. +# The directory stack is automatically reset on script exit. +pushd $TEST_BINARY_ABSPATH > /dev/null status=0 counter=0 From 02f48e8987cedcc43064afd6c22e628987cdfcdb Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 24 Feb 2026 14:11:18 +0100 Subject: [PATCH 21/21] let script return to old wd --- scripts/configure_for_rtd.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/configure_for_rtd.sh b/scripts/configure_for_rtd.sh index b5e96a024d..c728d4ee62 100755 --- a/scripts/configure_for_rtd.sh +++ b/scripts/configure_for_rtd.sh @@ -20,7 +20,7 @@ # along with t8code; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -cd "$(git rev-parse --show-toplevel)" +pushd "$(git rev-parse --show-toplevel)" > /dev/null git submodule init git submodule update