-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·57 lines (44 loc) · 1.28 KB
/
test.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
#!/bin/bash
mkdir test_setup
cp RepeatedTimer.py test_setup/
for i in {1..4}; do
cp client.py "test_setup/client_${i}.py"
cp server.py "test_setup/server.py"
sed -i "s/\"files\"/\"files_${i}\"/g" "test_setup/client_${i}.py"
mkdir test_setup/files_${i}
done
for i in {1..10}; do
touch "test_setup/files_1/${i}.txt"
done
for i in {11..16}; do
touch "test_setup/files_2/${i}.txt"
done
cd test_setup
if [ "$1" = "tmux" ];
then
gnome-terminal -- bash -c "
tmux new-session -d -s torrent;
tmux split-window -h;
tmux split-window -h;
tmux split-window -v;
tmux select-pane -t 1;
tmux split-window -v;
tmux select-pane -t 0;
tmux send-keys 'python3 server.py' C-m;
tmux select-pane -t 1;
tmux send-keys 'python3 client_1.py' C-m;
tmux select-pane -t 2;
tmux send-keys 'python3 client_2.py' C-m;
tmux select-pane -t 3;
tmux send-keys 'python3 client_3.py' C-m;
tmux select-pane -t 4;
tmux send-keys 'python3 client_4.py' C-m;
tmux attach-session -d;
";
else
gnome-terminal -- bash -c "python3 server.py;";
gnome-terminal -- bash -c "python3 client_1.py;";
gnome-terminal -- bash -c "python3 client_2.py;";
gnome-terminal -- bash -c "python3 client_3.py;";
gnome-terminal -- bash -c "python3 client_4.py;";
fi