-
Notifications
You must be signed in to change notification settings - Fork 64
Other: Script improvements #2189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
855c01b
d362435
6ff81ad
7d84416
4653aa1
2e2bd52
6ab04cd
e8f3e2f
e229af0
b0e3b20
60a3eb4
0fdb769
544b1a1
6258001
749d42c
5cf2f1b
d939d8d
f4222a5
d7d8d3b
7f8df0e
02f48e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||
|
|
@@ -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. | ||||||
|
Comment on lines
27
to
28
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adapt pls |
||||||
| # 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,20 +80,22 @@ if [ `basename $PWD` != scripts ]; then | |||||
| fi | ||||||
|
|
||||||
| # Find all test binary paths. | ||||||
| test_bin_paths=`bash ./find_all_test_binary_paths.sh` | ||||||
| num_paths=$(echo $test_bin_paths | wc -w) | ||||||
| test_bin_paths=$(bash ./find_all_test_binary_paths.sh "$TEST_BINARY_ABSPATH") | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| status=$? | ||||||
|
|
||||||
| # 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 a the directory ../build/test/." | ||||||
| echo -e "$USAGE" | ||||||
| exit 1 | ||||||
| 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. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hopefully this is not necessary anymore if #2167 is merged |
||||||
| # 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 | ||||||
| valgrind_suppressions_file=../../scripts/valgrind_suppressions_file.supp | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recently asked myself if we need this sh script |
||
|
|
||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,19 +35,19 @@ then | |
| exit 0 | ||
| fi | ||
|
|
||
| # | ||
| # This script searches for lines containing a macro definition in the style of '#ifdef T8_ENABLE_' | ||
| # | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think one could argue if this is really an " internal file", a user could use this to check if all macros are used correctly in their code, |
||
| # This script searches for lines containing a macro definition in the style of '#ifdef T8_ENABLE_' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But i think the valgrind_suppressions_file.supp could be moved to the internal folder |
||
| # 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 | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.