-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_write_frequency.sh
More file actions
executable file
·53 lines (46 loc) · 1.36 KB
/
test_write_frequency.sh
File metadata and controls
executable file
·53 lines (46 loc) · 1.36 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
#!/bin/sh
# Testing Write Frequency other than 1
source ./utils.sh
filename=test_file.txt
maxversions=5
mount_point=/mnt/bkpfs/
# Setting write frequency of two
writefrequency=2
number_of_backups=6
# build user program if not present; mount bkpfs; and create master data and backups
init_test $mount_point $maxversions $writefrequency $filename $number_of_backups
versions=(1 2 3)
expected=$(get_versions_list "${versions[@]}")
# test both the versions and contents from each versions
actual=$(./bkpctl -l "$mount_point$filename")
retval=$?
if [ $retval -ne 0 ]; then
echo "Non zero ret value Test Case Failed"
exit $retval
else
actual=$(echo $actual)
if [[ "$expected" == "$actual" ]]; then
version_to_read=3
expected_text="12345"
actual=$(./bkpctl -v "$version_to_read" "$mount_point$filename")
retval=$?
if [ $retval -ne 0 ]; then
echo "Test Case Failed"
exit $retval
else
actual=$(echo $actual)
if [[ "$expected_text" == "$actual" ]]; then
echo "Test Case Passed"
else
echo "Test Case Failed"
exit -1
fi
fi
else
echo "Test Case Failed"
exit -1
fi
fi
# delete all the backup files and the main file created during the run
teardown_test $filename $mount_point $number_of_backups
exit 0