-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharcoder_test.sh
More file actions
executable file
·62 lines (52 loc) · 1.18 KB
/
arcoder_test.sh
File metadata and controls
executable file
·62 lines (52 loc) · 1.18 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
54
55
56
57
58
59
60
61
62
#!/bin/bash
if [ "$1" == "" ]
then
echo "Path to binary is not provided, exiting"
exit 1
fi
PATH_TO_BINARY=$1
CURRENT_DIRECTORY=`pwd`
TEST_FILE_NAME=$CURRENT_DIRECTORY"/testfile"
ENCODED_TEST_FILE_NAME=$CURRENT_DIRECTORY"/testfile_encoded"
DECODED_TEST_FILE_NAME=$CURRENT_DIRECTORY"/testfile_decoded"
if [ ! -f $PATH_TO_BINARY ]
then
echo "Couldn't find binary" $PATH_TO_BINARY
exit 1
fi
if [ -f $TEST_FILE_NAME ]
then
echo Error: test file exists
exit 2
fi
CYCLES_COUNT=100
for (( i = 1 ; i <= CYCLES_COUNT; i++ ))
do
dd if=/dev/urandom of=$TEST_FILE_NAME count=10 status=noxfer 2>/dev/null
$PATH_TO_BINARY e $TEST_FILE_NAME $ENCODED_TEST_FILE_NAME
$PATH_TO_BINARY d $ENCODED_TEST_FILE_NAME $DECODED_TEST_FILE_NAME
cmp -s $TEST_FILE_NAME $DECODED_TEST_FILE_NAME > /dev/null
if [ $? -eq 1 ]
then
echo Files are not equal, exiting
rm $TEST_FILE_NAME
rm $ENCODED_TEST_FILE_NAME
rm $DECODED_TEST_FILE_NAME
exit 3
fi
echo -ne "\r $i / $CYCLES_COUNT ["
for (( j = 1 ; j <= i; j++ ))
do
echo -n "#"
done
for (( j = i + 1; j <= CYCLES_COUNT; j++ ))
do
echo -n " "
done
echo -n "]"
done
echo
rm $TEST_FILE_NAME
rm $ENCODED_TEST_FILE_NAME
rm $DECODED_TEST_FILE_NAME
exit 0