diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2016-01-15 17:41:35 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2016-01-15 17:41:35 +0100 |
commit | 7f60d25a516f38a4d512e12e042a75a36dede2b8 (patch) | |
tree | ada9077e38ef332aa7c904c3ad274c1616104ac1 /recipes-append/systest-runner/files/tests/virt-test | |
parent | 31ce2d1a14de6d8439829dc8a046aeaeef734461 (diff) | |
download | meta-vt-7f60d25a516f38a4d512e12e042a75a36dede2b8.tar.gz |
initial commit for Enea Linux 5.0-ppcdizzy-enea
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'recipes-append/systest-runner/files/tests/virt-test')
-rwxr-xr-x | recipes-append/systest-runner/files/tests/virt-test | 247 |
1 files changed, 0 insertions, 247 deletions
diff --git a/recipes-append/systest-runner/files/tests/virt-test b/recipes-append/systest-runner/files/tests/virt-test deleted file mode 100755 index 44bd79f..0000000 --- a/recipes-append/systest-runner/files/tests/virt-test +++ /dev/null | |||
@@ -1,247 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | filter_output() { | ||
4 | test_name="$1" | ||
5 | debug_dir="" | ||
6 | while read row; do | ||
7 | echo "# $row" | ||
8 | # Output is colorized; remove escape characters | ||
9 | row_cleaned=`echo "$row" | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"` | ||
10 | # Transform "SETUP: PASS|FAIL" to "SETUP ($test_name): PASS|FAIL" | ||
11 | row_cleaned=`echo "$row_cleaned" | sed "s/^SETUP:/SETUP ($test_name):/"` | ||
12 | if echo "$row_cleaned" | grep -q '^[^:]*: \(PASS\|FAIL\|ERROR\)\( \[result=[^]]*\]\)\? ([0-9\.]\{1,\} s)$'; then | ||
13 | # The row is a test result | ||
14 | test_case=`echo "$row_cleaned" | grep -o '^\(SETUP\|([0-9]\{1,\}/[0-9]\{1,\})\)[^:]*' | sed 's|^([0-9]\{1,\}/[0-9]\{1,\}) ||'` | ||
15 | status=`echo "$row_cleaned" | grep -o ': \(PASS\|FAIL\|ERROR\)' | sed -e 's/^: //' -e 's/ERROR/FAIL/'` | ||
16 | echo -n "$status: $test_case" | ||
17 | # Are there any textual results to be appended? | ||
18 | keyval_file="$debug_dir/$test_case/keyval" | ||
19 | if [ -n "$debug_dir" -a -e "$keyval_file" ]; then | ||
20 | result=`grep '^result=' $keyval_file | sed 's/^result=//'` | ||
21 | if [ -n "$result" ]; then | ||
22 | echo -n " [result=$result]" | ||
23 | fi | ||
24 | fi | ||
25 | echo "" | ||
26 | elif echo "$row_cleaned" | grep -q '^DEBUG LOG: '; then | ||
27 | # The row specifies the path to the debug log: Extract the debug directory and save it | ||
28 | debug_dir=`echo "$row_cleaned" | sed -e 's,^DEBUG LOG: ,,' -e 's,/debug\.log$,,'` | ||
29 | fi | ||
30 | done | ||
31 | } | ||
32 | |||
33 | create_empty_image() { | ||
34 | IMAGE_NAME="$1" | ||
35 | COMPRESSION_TYPE="$2" | ||
36 | |||
37 | COMPRESSED_IMAGE_NAME="${IMAGE_NAME}.${COMPRESSION_TYPE}" | ||
38 | if [ -z "$COMPRESSION_TYPE" ]; then | ||
39 | COMPRESSED_IMAGE_NAME="${IMAGE_NAME}" | ||
40 | fi | ||
41 | SHA1_NAME="${COMPRESSED_IMAGE_NAME}.sha1" | ||
42 | |||
43 | pushd /opt/virt-test/shared/data/images/ &> /dev/null | ||
44 | |||
45 | rm -f "$IMAGE_NAME" "$SHA1_NAME" "$COMPRESSED_IMAGE_NAME" | ||
46 | rm -f "${IMAGE_NAME}.backup" | ||
47 | |||
48 | echo "# Creating empty image ${IMAGE_NAME}" | ||
49 | qemu-img create -f qcow2 ${IMAGE_NAME} 10M | ||
50 | case "$COMPRESSION_TYPE" in | ||
51 | bz2) | ||
52 | bzip2 -c "$IMAGE_NAME" > "$COMPRESSED_IMAGE_NAME" | ||
53 | ;; | ||
54 | gz) | ||
55 | gzip -c "$IMAGE_NAME" > "$COMPRESSED_IMAGE_NAME" | ||
56 | ;; | ||
57 | xz) | ||
58 | xz -c "$IMAGE_NAME" > "$COMPRESSED_IMAGE_NAME" | ||
59 | ;; | ||
60 | *) | ||
61 | echo "ERROR: Invalid compression type: $COMPRESSION_TYPE" | ||
62 | popd | ||
63 | exit 1 | ||
64 | ;; | ||
65 | esac | ||
66 | sha1sum "$COMPRESSED_IMAGE_NAME" > "$SHA1_NAME" | ||
67 | |||
68 | cp "$IMAGE_NAME" "${IMAGE_NAME}.backup" | ||
69 | |||
70 | echo "# Empty image $IMAGE_NAME created" | ||
71 | echo | ||
72 | |||
73 | popd &> /dev/null | ||
74 | } | ||
75 | |||
76 | get_image() { | ||
77 | URL_BASE="$1" | ||
78 | IMAGE_NAME="$2" | ||
79 | COMPRESSION_TYPE="$3" | ||
80 | |||
81 | COMPRESSED_IMAGE_NAME="${IMAGE_NAME}.${COMPRESSION_TYPE}" | ||
82 | if [ -z "$COMPRESSION_TYPE" ]; then | ||
83 | COMPRESSED_IMAGE_NAME="${IMAGE_NAME}" | ||
84 | fi | ||
85 | SHA1_NAME="${COMPRESSED_IMAGE_NAME}.sha1" | ||
86 | COMPRESSED_IMAGE_URL="${URL_BASE}/${COMPRESSED_IMAGE_NAME}" | ||
87 | SHA1_URL="${URL_BASE}/${SHA1_NAME}" | ||
88 | |||
89 | pushd /opt/virt-test/shared/data/images/ &> /dev/null | ||
90 | |||
91 | rm -f "$IMAGE_NAME" "$SHA1_NAME" "$COMPRESSED_IMAGE_NAME" | ||
92 | rm -f "${IMAGE_NAME}.backup" | ||
93 | |||
94 | echo "# Downloading $COMPRESSED_IMAGE_URL" | ||
95 | wget $COMPRESSED_IMAGE_URL | ||
96 | wget $SHA1_URL | ||
97 | |||
98 | if ! sha1sum -c "$SHA1_NAME" > /dev/null; then | ||
99 | echo "ERROR: Invalid sha1 sum!" | ||
100 | exit 1 | ||
101 | fi | ||
102 | |||
103 | echo "# Uncompressing $COMPRESSED_IMAGE_NAME -> $IMAGE_NAME" | ||
104 | case "$COMPRESSION_TYPE" in | ||
105 | bz2) | ||
106 | bunzip2 -c "$COMPRESSED_IMAGE_NAME" > "$IMAGE_NAME" | ||
107 | ;; | ||
108 | gz) | ||
109 | gunzip -c "$COMPRESSED_IMAGE_NAME" > "$IMAGE_NAME" | ||
110 | ;; | ||
111 | xz) | ||
112 | unxz -c "$COMPRESSED_IMAGE_NAME" > "$IMAGE_NAME" | ||
113 | ;; | ||
114 | "") | ||
115 | ;; | ||
116 | *) | ||
117 | echo "ERROR: Invalid compression type: $COMPRESSION_TYPE" | ||
118 | popd | ||
119 | exit 1 | ||
120 | ;; | ||
121 | esac | ||
122 | |||
123 | cp "$IMAGE_NAME" "${IMAGE_NAME}.backup" | ||
124 | |||
125 | echo "# Download of $IMAGE_NAME completed" | ||
126 | echo | ||
127 | |||
128 | popd &> /dev/null | ||
129 | } | ||
130 | |||
131 | # Verbose? | ||
132 | VERBOSE= | ||
133 | if [ "$1" = '-v' ]; then | ||
134 | VERBOSE=1 | ||
135 | set -x | ||
136 | fi | ||
137 | |||
138 | # Servers | ||
139 | NTP_SERVER=ntp.enea.se | ||
140 | |||
141 | # Architecture | ||
142 | ARCH=`uname -m` | ||
143 | |||
144 | # Needed by virt-test | ||
145 | export AUTOTEST_PATH="/opt/autotest/" | ||
146 | |||
147 | # Init LVM | ||
148 | DEST_DIR=/opt/virt-test/shared/data | ||
149 | if ! [ -e /dev/rootvg ]; then | ||
150 | vgchange -ay | ||
151 | udevadm settle # Wait for device nodes | ||
152 | fi | ||
153 | if [ -e /dev/rootvg ]; then | ||
154 | if ! [ -e /dev/rootvg/virttestdatalv ]; then | ||
155 | if ! lvcreate -L30G -n virttestdatalv /dev/rootvg; then | ||
156 | echo "ERROR: Unable to create virttestdatalv!" >&2 | ||
157 | exit 1 | ||
158 | fi | ||
159 | udevadm settle | ||
160 | if ! mkfs.ext4 /dev/rootvg/virttestdatalv; then | ||
161 | echo "ERROR: Unable to format virttestdatalv!" >&2 | ||
162 | exit 1 | ||
163 | fi | ||
164 | fi | ||
165 | |||
166 | # Mount the virttestdatalv | ||
167 | mkdir -p $DEST_DIR | ||
168 | if ! mountpoint -q $DEST_DIR; then | ||
169 | if ! mount /dev/rootvg/virttestdatalv $DEST_DIR; then | ||
170 | echo "ERROR: Unable to mount virttestdatalv!" >&2 | ||
171 | exit 1 | ||
172 | fi | ||
173 | fi | ||
174 | else | ||
175 | echo "WARNING: No rootvg volume group! Continuing anyway" >&2 | ||
176 | fi | ||
177 | ( | ||
178 | cd $DEST_DIR | ||
179 | mkdir -p gpg images isos steps_data | ||
180 | ) | ||
181 | |||
182 | # Sync the clock before starting tests, as some tests will do this, and thereby | ||
183 | # cause tests that run for a negative amount of time unless the time is synced | ||
184 | # from the very beginning | ||
185 | ntpdate $NTP_SERVER | ||
186 | |||
187 | # Download/create images, kernel, initrd | ||
188 | JEOS_VERSION="19-64" | ||
189 | ENEA_VERSION="4.0" | ||
190 | # virt-test will try to unpack the images for all architectures, even though | ||
191 | # they are not used, so always create the (empty) images. | ||
192 | create_empty_image "enea-${ENEA_VERSION}-x86_64.qcow2" "gz" | ||
193 | create_empty_image "enea-${ENEA_VERSION}-ppc.qcow2" "gz" | ||
194 | create_empty_image "enea-${ENEA_VERSION}-ppc64.qcow2" "gz" | ||
195 | if [ "$ARCH" = "x86_64" ]; then | ||
196 | #get_image "http://172.21.3.124/~jori/jeos/" "jeos-${JEOS_VERSION}.qcow2" "bz2" | ||
197 | get_image "http://172.21.3.124/~jori/enea/" "enea-${ENEA_VERSION}-${ARCH}.qcow2" "gz" | ||
198 | elif [ "$ARCH" = "ppc" -o "$ARCH" = "ppc64" ]; then | ||
199 | get_image "http://172.21.3.124/~jori/enea/" "enea-${ENEA_VERSION}-${ARCH}.uImage" "" | ||
200 | get_image "http://172.21.3.124/~jori/enea/" "enea-${ENEA_VERSION}-${ARCH}.cpio.gz" "" | ||
201 | else | ||
202 | echo "ERROR: Architecture '$ARCH' not supported" | ||
203 | exit 1 | ||
204 | fi | ||
205 | |||
206 | # Create virbr0 | ||
207 | if ! [ -e /sys/class/net/virbr0 ]; then | ||
208 | ip link add virbr0 type bridge | ||
209 | ip addr add dev virbr0 10.99.99.1/24 | ||
210 | ip link set virbr0 up | ||
211 | /etc/init.d/dnsmasq stop | ||
212 | sleep 5 | ||
213 | /etc/init.d/dnsmasq start | ||
214 | fi | ||
215 | |||
216 | # Run tests | ||
217 | cd /opt/virt-test/ | ||
218 | QEMU_BIN=`which qemu-system-$ARCH` | ||
219 | OPTS="--qemu-bin=$QEMU_BIN --qemu_sandbox=off --no-downloads" | ||
220 | if ! [ "$VERBOSE" = "" ]; then | ||
221 | OPTS="$OPTS -v" | ||
222 | fi | ||
223 | |||
224 | declare -a TEST_SUITE TEST_SUITE_EXTRAOPTS TEST_CASES | ||
225 | |||
226 | TEST_SUITE[0]="qemu" | ||
227 | TEST_SUITE_EXTRAOPTS[0]="" | ||
228 | TEST_CASES[0]="check_clock_offset.with_syscall,migrate.default.fd,pong" | ||
229 | |||
230 | TEST_SUITE[1]="libvirt" | ||
231 | TEST_SUITE_EXTRAOPTS[1]="" | ||
232 | if [ "$ARCH" = "x86_64" ]; then | ||
233 | TEST_SUITE_EXTRAOPTS[1]="--machine-type=q35" | ||
234 | fi | ||
235 | TEST_CASES[1]="virsh.volume" | ||
236 | |||
237 | for (( i=0; i<${#TEST_SUITE[@]}; i++ )); do | ||
238 | # Update machine.cfg | ||
239 | cp /opt/virt-test/shared/cfg/machines.cfg \ | ||
240 | /opt/virt-test/backends/${TEST_SUITE[$i]}/cfg/ | ||
241 | |||
242 | # Run tests | ||
243 | echo "# Running ${TEST_SUITE[$i]} tests ${TEST_CASES[$i]}" | ||
244 | ./run $OPTS ${TEST_SUITE_EXTRAOPTS[$i]} -g Enea -t "${TEST_SUITE[$i]}" \ | ||
245 | --tests="${TEST_CASES[$i]}" --arch=$ARCH 2>&1 \ | ||
246 | | filter_output "${TEST_SUITE[$i]}" | ||
247 | done | ||