Skip to content
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

Fix script to run examples locally #285

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions examples/run-examples.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
#!/bin/bash
# Testscript running all examples from example-list.txt
#
# Copyright (c) 2017 Christoph Niethammer <[email protected]>
# Copyright (c) 2017-2024 Christoph Niethammer <[email protected]>
#

MARDYN_EXE="mpirun -np 1 $PWD/../src/MarDyn"
MARDYN_EXE="mpirun -np 2 $PWD/../src/MarDyn"
MARDYN_OPTIONS="--steps 10 -v"
EXAMPLE_LIST_FILE=${EXAMPLE_LIST_FILE:=example-list.txt}
LOGFILE=${LOGFILE:=$PWD/run-examples.log}
cniethammer marked this conversation as resolved.
Show resolved Hide resolved

#mapfile -t all_examples < $EXAMPLE_LIST_FILE # requires bash4 ...
declare -a all_examples
while IFS= read -r; do all_examples+=("$REPLY"); done < $EXAMPLE_LIST_FILE

all_examples=()
failed_examples=()

# definitions for esear color output to display
while IFS= read -r line ; do
[[ "$line" =~ ^#.*$ ]] && continue
[[ "$line" =~ ^$ ]] && continue
cniethammer marked this conversation as resolved.
Show resolved Hide resolved

example="$line"
echo "Going to run example file $example"
all_examples+=("$example")
done < "$EXAMPLE_LIST_FILE"


# definitions for easy color output
Color_Off='\e[0m' # Text Reset
IGreen='\e[0;92m' # Intense Green
IRed='\e[0;91m' # Intense Red
IMagenta='\e[0;95m' # magenta

logfile=$LOGFILE
date > $logfile
for example in ${all_examples[@]}
do
for example in ${all_examples[@]} ; do
example_dir=$(dirname $example)
example_inp_file=$(basename $example)
echo -e -n "Running example ${IMagenta}$example_inp_file${Color_Off} in $example_dir ... "
echo -e -n "Running example ${IMagenta}$example_inp_file${Color_Off} in ${IMagenta}$example_dir${Color_Off} ... "
echo "Running example $example_inp_file in $example_dir" >> $logfile
pushd "$example_dir" >/dev/null
cmd="$MARDYN_EXE $MARDYN_OPTIONS $example_inp_file"
Expand Down
Loading