forked from Nu-NSDI23/Nu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshared.sh
executable file
·51 lines (41 loc) · 905 Bytes
/
shared.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
#!/bin/bash
SHARED_SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
CALADAN_PATH=$SHARED_SCRIPT_DIR/caladan
function say_failed() {
echo -e "----\e[31mFailed\e[0m"
}
function say_passed() {
echo -e "----\e[32mPassed\e[0m"
}
function assert_success {
if [[ $? -ne 0 ]]; then
say_failed
exit -1
fi
}
function kill_process {
pid=`pgrep $1`
if [ -n "$pid" ]; then
{ sudo kill $pid && sudo wait $pid; } 2>/dev/null
fi
}
function kill_iokerneld {
kill_process iokerneld
}
function run_iokerneld {
kill_iokerneld
sleep 3
sudo bash -c "$CALADAN_PATH/iokerneld $@ > /dev/null 2>&1 &"
assert_success
sleep 5
}
function rerun_iokerneld {
kill_iokerneld
run_iokerneld ias
}
function run_controller {
sudo stdbuf -o0 sh -c "bin/ctrl_main"
}
function kill_controller {
kill_process ctrl_main
}