Skip to content

Commit

Permalink
Improved target and target behavior of makefile for example simulation
Browse files Browse the repository at this point in the history
- new target "clean_example" to delete output and input artifacts of the example simulation

- targets that run the example simulation gain the "-r" option which automatically renames the domain template file in nc-mode
  • Loading branch information
dschlaep committed Aug 29, 2024
1 parent 5ec7eb6 commit 67cb40a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
10 changes: 9 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
# does not clean artifacts from code coverage or documentation
# make clean_bin delete 'bin/' (binary and test executables and library)
# make clean_build delete binary executable build artifacts
# make clean_example delete output and input artifacts of example simulation
# make clean_test delete test executable build artifacts
# make clean_cov delete code coverage artifacts
# make clean_doc delete documentation
Expand Down Expand Up @@ -509,7 +510,7 @@ $(dir_bin) $(dir_build_sw2) $(dir_build_test):
#--- Convenience targets for testing
.PHONY : bin_run
bin_run : all
$(bin_sw2) -d ./tests/example -f files.in
$(bin_sw2) -d ./tests/example -f files.in -r

.PHONY : test_run
test_run : test
Expand Down Expand Up @@ -590,6 +591,13 @@ clean_build:
-@$(RM) -r $(dir_build_sw2)
-@$(RM) -f $(bin_sw2) $(lib_sw2) $(lib_rsw2)

.PHONY : clean_example
clean_example:
-@$(RM) -r tests/example/Output
-@$(RM) -f tests/example/Input_nc/domain_template.nc
-@$(RM) -f tests/example/Input_nc/domain.nc
-@$(RM) -f tests/example/Input_nc/progress.nc

.PHONY : clean_test
clean_test:
-@$(RM) -r $(dir_build_test)
Expand Down
14 changes: 1 addition & 13 deletions tools/check_functionality.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,6 @@ exists() {
command -v "$1" > /dev/null 2>&1
}

#--- Function to clean example inputs
clean_example_inputs() {
rm tests/example/Input_nc/progress.nc
rm tests/example/Input_nc/domain.nc
rm tests/example/Input_nc/domain_template.nc
}

#--- Function to delete example output
clean_example_outputs() {
rm -r tests/example/Output
}

#--- Function to run example SOILWAT2 simulation with fresh inputs
# $1 Compiler, e.g., CC=clang, CXX=g++, or (if not specify a compiler) CC=
Expand Down Expand Up @@ -59,8 +48,7 @@ run_fresh_sw2() {
mflags+=("CPPFLAGS=-DSWNC")
fi

clean_example_inputs > /dev/null 2>&1
clean_example_outputs > /dev/null 2>&1
res=$(make clean_example)

res=$(make "${mflags[@]}" clean "${target}" 2>&1)
status=$?
Expand Down
2 changes: 1 addition & 1 deletion tools/check_outputModes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if [[ "${res}" == *"make failed"* ]]; then
else
cp -R tests/example/Output tests/example/Output_comps-nc > /dev/null 2>&1
fi
clean_example_inputs > /dev/null 2>&1
res=$(make clean_example)

unset noflags

Expand Down
2 changes: 1 addition & 1 deletion tools/run_bin_leaks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# or via makefile
# run as `CC=clang make clean bin_leaks`

MallocStackLogging=1 MallocStackLoggingNoCompact=1 MallocScribble=1 MallocPreScribble=1 MallocCheckHeapStart=0 MallocCheckHeapEach=0 leaks -quiet -atExit -- bin/SOILWAT2 -d ./tests/example -f files.in
MallocStackLogging=1 MallocStackLoggingNoCompact=1 MallocScribble=1 MallocPreScribble=1 MallocCheckHeapStart=0 MallocCheckHeapEach=0 leaks -quiet -atExit -- bin/SOILWAT2 -d ./tests/example -f files.in -r
2 changes: 1 addition & 1 deletion tools/run_bin_sanitizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ instr_flags_severe="\


# Note: # Apple clang does not support "AddressSanitizer: detect_leaks" (at least as of clang-1200.0.32.29)
ASAN_OPTIONS=detect_leaks=1:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 LSAN_OPTIONS=suppressions=../.LSAN_suppr.txt SW2_FLAGS=""$debug_flags" "$warning_flags_severe_cc" "$instr_flags_severe"" make bin_run
ASAN_OPTIONS=detect_leaks=1:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 LSAN_OPTIONS=suppressions=../.LSAN_suppr.txt SW2_FLAGS=""$debug_flags" "$warning_flags_severe_cc" "$instr_flags_severe"" make bin_run -r

0 comments on commit 67cb40a

Please sign in to comment.