-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_files.sh
executable file
·67 lines (57 loc) · 1.61 KB
/
generate_files.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
#!/bin/bash
LINE_UP='\033[A'
CWD=$(realpath $(dirname $0))
echo -e "Controllo che siano presenti i file di test\n"
mkdir ${CWD}/test &> /dev/null
mkdir ${CWD}/test/small_files &> /dev/null
for i in {0..99}
do
if [[ -f ${CWD}/test/small_files/small_${i}.txt ]]
then
continue
fi
base64 /dev/urandom | head -c 1024 > ${CWD}/test/small_files/small_${i}.txt
NUM=$((i+1))
echo -e "${LINE_UP}Generati ${NUM} file piccoli"
done
chmod 777 -R ${CWD}/test/small_files/
echo ""
mkdir ${CWD}/test/medium_files &> /dev/null
for i in {0..9}
do
if [[ -f ${CWD}/test/medium_files/medium_${i}.txt ]]
then
continue
fi
base64 /dev/urandom | head -c 1000000 > ${CWD}/test/medium_files/medium_${i}.txt
NUM=$((i+1))
echo -e "${LINE_UP}Generati ${NUM} file medi"
done
chmod 777 -R ${CWD}/test/medium_files
echo ""
mkdir ${CWD}/test/large_files &> /dev/null
if ! [[ -f ${CWD}/test/large_files/large_0.txt ]]
then
base64 /dev/urandom | head -c 30000000 > ${CWD}/test/large_files/large_0.txt
echo -e "${LINE_UP}Generato 1 file grande"
chmod 777 -R ${CWD}/test/large_files
echo ""
fi
mkdir ${CWD}/test/test_2 &> /dev/null
for i in {0..9}
do
if [[ -f ${CWD}/test/large_files/eviction_file_${i}.txt ]]
then
continue
fi
base64 /dev/urandom | head -c 100000 > ${CWD}/test/test_2/eviction_file_${i}.txt
done
if ! [[ -f ${CWD}/test/test_2/initial_file_0.txt ]]
then
base64 /dev/urandom | head -c 400000 > ${CWD}/test/test_2/initial_file_0.txt
echo -e "${LINE_UP}Generati i file per il test 2"
fi
chmod 777 -R ${CWD}/test/test_2/
mkdir ${CWD}/test/output_stress_test &> /dev/null
mkdir ${CWD}/test/test_output &> /dev/null
echo -e "Fatto!\n"