-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-ros3fs.sh
executable file
·61 lines (50 loc) · 1.58 KB
/
test-ros3fs.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
#! /bin/bash -u
cd $(git rev-parse --show-toplevel)/build
exit_code=0
echo "=========== ls test =========="
ROS3FS_TMPFILE=$(mktemp)
NORMALFS_TMPFILE=$(mktemp)
ls ros3fs_mountpoint >& ${ROS3FS_TMPFILE}
ls ros3fs_mountpoint_answer >& ${NORMALFS_TMPFILE}
if [[ $(diff ${ROS3FS_TMPFILE} ${NORMALFS_TMPFILE}) ]]; then
diff ${ROS3FS_TMPFILE} ${NORMALFS_TMPFILE}
echo "test failed"
exit_code=1
fi
echo "=========== ls -F test =========="
ROS3FS_TMPFILE=$(mktemp)
NORMALFS_TMPFILE=$(mktemp)
ls -F ros3fs_mountpoint >& ${ROS3FS_TMPFILE}
ls -F ros3fs_mountpoint_answer >& ${NORMALFS_TMPFILE}
if [[ $(diff ${ROS3FS_TMPFILE} ${NORMALFS_TMPFILE}) ]]; then
diff ${ROS3FS_TMPFILE} ${NORMALFS_TMPFILE}
echo "test failed"
exit_code=1
fi
echo "=========== cat test =========="
ROS3FS_TMPFILE=$(mktemp)
NORMALFS_TMPFILE=$(mktemp)
cat ros3fs_mountpoint/testfile_a >& ${ROS3FS_TMPFILE}
cat ros3fs_mountpoint_answer/testfile_a >& ${NORMALFS_TMPFILE}
if [[ $(diff ${ROS3FS_TMPFILE} ${NORMALFS_TMPFILE}) ]]; then
diff ${ROS3FS_TMPFILE} ${NORMALFS_TMPFILE}
echo "test failed"
exit_code=1
fi
echo "=========== grep -r test =========="
ROS3FS_TMPFILE=$(mktemp)
NORMALFS_TMPFILE=$(mktemp)
pushd ros3fs_mountpoint
grep -r aa . | sort >& ${ROS3FS_TMPFILE}
popd
pushd ros3fs_mountpoint_answer
grep -r aa . |sort >& ${NORMALFS_TMPFILE}
popd
if [[ $(diff ${ROS3FS_TMPFILE} ${NORMALFS_TMPFILE}) ]]; then
diff ${ROS3FS_TMPFILE} ${NORMALFS_TMPFILE}
echo "test failed"
exit_code=1
fi
# TODO
# find build/ros3fs_mountpoint -type f | xargs -n 1 -P 4 grep -in 1111 --with-filename
exit ${exit_code}