This repository has been archived by the owner on Sep 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-green-castalia.sh
85 lines (78 loc) · 1.87 KB
/
update-green-castalia.sh
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
#!/bin/bash
# Script to be run from within the vagrant VM to update Green Castalia
# VM installation with development files and build
# Options:
# -b : Build Castalia
# -d : Build debug
# -t : Build a test executable and run
# Move to the Catalia folder
cd /home/vagrant/Castalia/Castalia
# Make sure the test dir exist (if this is a new installation they may not)
# -p to ignore errors
mkdir -p ./test
# Copy files to the Castalia folders
# use --update so it only copies if newer (avoids unnecessary recompiling of all files)
echo "Copying simulations"
cp --recursive /vagrant/Simulations/* ./Simulations/
echo "Copying src"
cp --recursive --update /vagrant/src/* ./src/
echo "Copying test"
cp --recursive --update /vagrant/test/* ./test
echo "Copying makemake file"
cp /vagrant/makemake ./
echo "Copying bin"
cp --recursive --update /vagrant/bin/* ./bin/
while getopts "brdti" option; do
case "${option}" in
b)
# Build Castalia
echo "Building Castalia" >&2
make
;;
r)
# Reuild Castalia
echo "Rebuilding Castalia" >&2
make clean
./makemake
make
;;
d)
# Debug Castalia
echo "Building debug Castalia" >&2
make clean
./makemake -d
make
;;
t)
# Test Castalia
echo "Testing Castalia" >&2
make clean
# -d means build debug
# -t means build test executable instead of simulation executable
./makemake -d -t
make
# Run the test executable
if [ $? -eq 0 ]; then
out/gcc-debug/CastaliaTest
else
echo "Build failed, not running tests"
exit 1
fi
;;
i)
# ! Must have made make file for test (-t) before calling this!
# Test without full rebuild (incremental)
make
# Run the test executable if the build passed
if [ $? -eq 0 ]; then
out/gcc-debug/CastaliaTest
else
echo "Build failed, not running tests"
exit 1
fi
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done