Package: lizardfs / 3.12.0+dfsg-3

tests.patch Patch series | download
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
Last-Update: 2015-03-18
Forwarded: no
Author: Dmitry Smirnov <onlyjob@member.fsf.org>
Description: test suite adaptations

--- a/tests/setup_machine.sh
+++ b/tests/setup_machine.sh
@@ -6,9 +6,8 @@
 
 This scripts prepares the machine to run LizardFS tests here.
 Specifically:
 * creates users lizardfstest, lizardfstest_0, ..., lizardfstest_9
-* adds all lizardfstest users to the fuse group
 * grants all users rights to run programs as lizardfstest users
 * grants all users rights to run 'pkill -9 -u <some lizardfstest user>'
 * allows all users to mount fuse filesystem with allow_other option
 * creates a 2G ramdisk in /mnt/ramdisk
@@ -30,11 +29,8 @@
 echo ; echo Add user lizardfstest
 if ! getent passwd lizardfstest > /dev/null; then
 	useradd --system --user-group --home /var/lib/lizardfstest lizardfstest
 fi
-if ! groups lizardfstest | grep -w fuse > /dev/null; then
-	usermod -a -G fuse lizardfstest # allow this user to mount fuse filesystem
-fi
 if ! groups lizardfstest | grep -w adm > /dev/null; then
 	usermod -a -G adm lizardfstest # allow this user to read files from /var/log
 fi
 
@@ -81,17 +77,18 @@
 echo ; echo 'Add users lizardfstest_{0..9}'
 for username in lizardfstest_{0..9}; do
 	if ! getent passwd $username > /dev/null; then
 		useradd --system --user-group --home /var/lib/$username --create-home \
-				--groups fuse,lizardfstest $username
+				--groups lizardfstest $username
 		cat >>/etc/sudoers.d/lizardfstest <<-END
 
 			ALL ALL = ($username) NOPASSWD: ALL
 			ALL ALL = NOPASSWD: /usr/bin/pkill -9 -u $username
 		END
 	fi
 done
 
+if false; then
 echo ; echo 'Fixing GIDs of users'
 for name in lizardfstest lizardfstest_{0..9}; do
 	uid=$(getent passwd "$name" | cut -d: -f3)
 	gid=$(getent group  "$name" | cut -d: -f3)
@@ -107,8 +104,9 @@
 		done
 		groupmod -g $newgid $name
 	fi
 done
+fi
 
 echo ; echo Prepare /etc/fuse.conf
 if ! grep '^[[:blank:]]*user_allow_other' /etc/fuse.conf >/dev/null; then
 	echo "user_allow_other" >> /etc/fuse.conf
@@ -118,10 +116,12 @@
 if ! [[ -f /etc/lizardfs_tests.conf ]]; then
 	cat >/etc/lizardfs_tests.conf <<-END
 		: \${LIZARDFS_DISKS:="$*"}
 		# : \${TEMP_DIR:=/tmp/LizardFS-autotests}
-		# : \${LIZARDFS_ROOT:=$HOME/local}
+		# : \${LIZARDFS_ROOT:=$HOME/usr}
 		# : \${FIRST_PORT_TO_USE:=25000}
+		# : ${AUTO_SHADOW_MASTER:="no"}
+		 : ${SOURCE_DIR:="/usr/share/lizardfs"}
 	END
 fi
 
 echo ; echo Prepare ramdisk
@@ -133,8 +133,9 @@
 	echo ': ${RAMDISK_DIR:=/mnt/ramdisk}' >> /etc/lizardfs_tests.conf
 fi
 
 echo ; echo Prepare loop devices
+modprobe -v loop
 if ! grep lizardfstest_loop /etc/fstab >/dev/null; then
 	i=0
 	devices=6
 	loops=()
@@ -143,14 +144,15 @@
 		if (( i == devices )); then
 			break
 		fi
 		mkdir -p "$disk/lizardfstest_images"
+		chmod -c a+w "$disk"
 		# Create image file
 		image="$disk/lizardfstest_images/image_$i"
 		truncate -s 1G "$image"
 		mkfs.ext4 -Fq "$image"
 		# Add it to fstab
-		echo "$(readlink -m "$image") /mnt/lizardfstest_loop_$i  ext4  loop" >> /etc/fstab
+		echo "$(readlink -m "$image") /mnt/lizardfstest_loop_$i  ext4  loop,noauto" >> /etc/fstab
 		mkdir -p /mnt/lizardfstest_loop_$i
 		# Mount and set permissions
 		mount /mnt/lizardfstest_loop_$i
 		chmod 1777 /mnt/lizardfstest_loop_$i
--- a/tests/tools/test_main.sh
+++ b/tests/tools/test_main.sh
@@ -10,9 +10,9 @@
 	alias $i="\${command_prefix} $i"
 done
 
 . tools/config.sh # This has to be the first one
-. $(which set_lizardfs_constants.sh)
+. /usr/share/lizardfs/set_lizardfs_constants.sh
 . tools/stack_trace.sh
 . tools/assert.sh
 . tools/moosefs.sh
 . tools/lizardfs.sh
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -25,9 +25,9 @@
 install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/set_lizardfs_constants.sh DESTINATION ${BIN_SUBDIR})
 
 # Build executable running all the test cases
 include_directories(${CMAKE_CURRENT_BINARY_DIR}) # test_cases.h is located here
-add_definitions(-DTEST_DATA_PATH=${CMAKE_CURRENT_SOURCE_DIR})
+add_definitions(-DTEST_DATA_PATH=/usr/share/lizardfs)
 add_executable(lizardfs-tests lizardfs-tests.cc)
 add_dependencies(lizardfs-tests list_of_test_cases)
 target_link_libraries(lizardfs-tests gtest_main)
 install(TARGETS lizardfs-tests RUNTIME DESTINATION ${BIN_SUBDIR})
--- a/tests/tools/config.sh
+++ b/tests/tools/config.sh
@@ -9,9 +9,9 @@
 : ${LIZARDFS_LOOP_DISKS:=}
 : ${TEMP_DIR:=/tmp/LizardFS-autotests}
 : ${MOOSEFS_DIR:=/tmp/LizardFS-autotests-mfs}
 : ${LIZARDFSXX_DIR_BASE:=/tmp/LizardFS-autotests-old}
-: ${LIZARDFS_ROOT:=$HOME/local}
+: ${LIZARDFS_ROOT:=/usr}
 : ${FIRST_PORT_TO_USE:=9600}
 : ${ERROR_FILE:=}
 : ${RAMDISK_DIR:=/mnt/ramdisk}
 : ${TEST_OUTPUT_DIR:=$TEMP_DIR}
--- a/tests/run-test.sh
+++ b/tests/run-test.sh
@@ -34,9 +34,9 @@
 if [[ $# != 1 ]]; then
 	echo "Usage: $0 <test_case>" >&2
 	exit 1
 fi
-export SOURCE_DIR=$(readlink -m "$(dirname "$0")/..")
+#export SOURCE_DIR=$(readlink -m "$(dirname "$0")/..")
 export ERROR_DIR=/tmp/lizardfs_error_dir
 export LIZARDFS_LOG_ORIGIN=yes # adds file:line:function to debug logs
 umask 0022
 rm -rf "${ERROR_DIR}"
--- a/tests/tools/valgrind.sh
+++ b/tests/tools/valgrind.sh
@@ -15,9 +15,9 @@
 		valgrind_enabled_=1
 
 		# Build a valgrind invocation which will properly run memcheck.
 		local valgrind_command="valgrind -q --tool=memcheck --leak-check=full`
-				` --suppressions=$SOURCE_DIR/tests/tools/valgrind.supp"
+				` --suppressions=$SOURCE_DIR/tools/valgrind.supp"
 
 		# New ( >= 3.9) versions of valgrind support some nice heuristics which remove
 		# a couple of false positives (eg. leak reports when there is a reachable std::string).
 		# Use the heuristics if available.