-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrick-check-make-example.sh
More file actions
executable file
·98 lines (77 loc) · 2.94 KB
/
rick-check-make-example.sh
File metadata and controls
executable file
·98 lines (77 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
#-|
#/ Usage:
#/ Description:
#/ Examples:
#/ Options:
#/ --help: Display this help message
usage() { grep '^#/' "$0" | cut -c4- ; exit 0 ; }
expr "$*" : ".*--help" > /dev/null && usage
#-|
readonly LOG_FILE="/tmp/$(basename "$0").log"
sLog() { echo "[LOG] $*" >> "$LOG_FILE"; }
sInfo() { echo "[INFO] $*" | tee -a "$LOG_FILE" >&2 ; }
sWarning() { echo "[WARNING] $*" | tee -a "$LOG_FILE" >&2 ; }
sError() { echo "[ERROR] $*" | tee -a "$LOG_FILE" >&2 ; }
sFatal() { echo "[FATAL] $*" | tee -a "$LOG_FILE" >&2 ; exit 1 ; }
is_empty() { local var=$1 ; [[ -z $var ]] ; }
is_not_empty() { local var=$1 ; [[ -n $var ]] ; }
is_file() { local file=$1 ; [[ -f $file ]] ; }
is_dir() { local dir=$1 ; [[ -d $dir ]] ; }
cleanup() {
# Remove temporary files
# Restart services
# ...
true # you can't have an empty funciton.
}
if [[ "${BASH_SOURCE[0]}" = "$0" ]]; then
trap cleanup EXIT
# Script goes here
# ...
#find ./ -maxdepth 6 -type d -name atlas -print0 | xargs -0 -n 1 -P 5 sub_stub
#date +'%Y-%m-%d_%H_%M_%S'
#TODO: make script have optional arg for user trick version
NumCores="$(grep processor /proc/cpuinfo | wc -l)"
#echo "$NumCores"
export MAKEFLAGS="-j $NumCores"
date
#TODO: check all of the exit codes
is_dir ./UserTrick && cd ./UserTrick && export TRICK_HOME="$(pwd)" && cd ../
is_dir ./UserProject && cd ./UserProject/SIM_Ball++_L1/ && make spotless && $TRICK_HOME/bin/trick-CP && exit 0
mkdir UserProject
echo "Git Trick"
git clone https://github.com/nasa/trick UserTrick >& /dev/null
cd ./UserTrick
#git checkout tags/19.6.0 -b 19.6.0
git checkout tags/19.3.1 -b 19.3.1
echo "Configure Trick"
./configure >& ./config.out.out
echo "Build Trick"
make -j $NumCores >& ./build.out.out
export TRICK_HOME="$(pwd)"
echo $TRICK_HOME
cp -r ./trick_sims/SIM_Ball++_L1/ ../UserProject/
cd ..
echo "RUN_test/input.py" > ./test.rc.cfg
echo "RUN_Rick_Other/input.py" >> ./test.rc.cfg
cd ./UserProject/
cd ./SIM_Ball++_L1/
echo "Build Sim"
$TRICK_HOME/bin/trick-CP >& ./sim.build.out.out
cp -r ./RUN_test/ ./RUN_Rick_Other
echo "Seding"
sed -i 's/drg0 = trick.DRAscii("Ball")/drg0 = trick.DRBinary("Ball")/g' ./RUN_Rick_Other/input.py
sed -i 's/trick.stop(300.0)/trick.stop(42.0)/g' ./RUN_Rick_Other/input.py
sed -i 's/#trick.checkpoint_post_init(True)/trick.checkpoint_post_init(True)/g' ./RUN_Rick_Other/input.py
sed -i 's/#trick.checkpoint_end(True)/trick.checkpoint_end(True)/g' ./RUN_Rick_Other/input.py
#sed -i 's/old-text/new-text/g' ./RUN_Rick_Other/input.py
echo "Run Sim Run 01"
find ./ -maxdepth 1 -type f -iname "S_main*.exe" -exec {} ./RUN_test/input.py \; >& ./RUN_test/run.out.out
echo "Run Sim Run 02"
find ./ -maxdepth 1 -type f -iname "S_main*.exe" -exec {} ./RUN_Rick_Other/input.py \; >& ./RUN_Rick_Other/run.out.out
echo "Done"
date
#TODO: Generate config file
fi