3 # Test ssh image creation
5 # Copyright (C) 2018 Red Hat, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
22 owner
=kwolf@redhat.com
25 echo "QA output created by $seq"
28 status
=1 # failure is the default!
30 # get standard environment, filters and checks
38 function do_run_qemu
()
41 $QEMU -nographic -qmp stdio
-serial none
"$@"
47 do_run_qemu
"$@" 2>&1 | _filter_testdir | _filter_qmp \
48 | _filter_qemu | _filter_imgfmt \
49 | _filter_actual_image_size
53 echo "=== Successful image creation (defaults) ==="
57 { "execute": "qmp_capabilities" }
58 { "execute": "x-blockdev-create",
62 "path": "$TEST_IMG_FILE",
74 _img_info | _filter_img_info
76 TEST_IMG
=$TEST_IMG_FILE _img_info | _filter_img_info
79 echo "=== Test host-key-check options ==="
83 { "execute": "qmp_capabilities" }
84 { "execute": "x-blockdev-create",
88 "path": "$TEST_IMG_FILE",
100 { "execute": "quit" }
103 _img_info | _filter_img_info
106 { "execute": "qmp_capabilities" }
107 { "execute": "x-blockdev-create",
111 "path": "$TEST_IMG_FILE",
117 "mode": "known_hosts"
123 { "execute": "quit" }
126 _img_info | _filter_img_info
129 key
=$
(ssh-keyscan
-t rsa
127.0.0.1 2>/dev
/null |
grep -v "\\^#" |
130 cut
-d" " -f3 | base64
-d |
md5sum -b | cut
-d" " -f1)
133 { "execute": "qmp_capabilities" }
134 { "execute": "x-blockdev-create",
138 "path": "$TEST_IMG_FILE",
152 { "execute": "x-blockdev-create",
156 "path": "$TEST_IMG_FILE",
170 { "execute": "quit" }
173 _img_info | _filter_img_info
176 key
=$
(ssh-keyscan
-t rsa
127.0.0.1 2>/dev
/null |
grep -v "\\^#" |
177 cut
-d" " -f3 | base64
-d |
sha1sum -b | cut
-d" " -f1)
180 { "execute": "qmp_capabilities" }
181 { "execute": "x-blockdev-create",
185 "path": "$TEST_IMG_FILE",
199 { "execute": "x-blockdev-create",
203 "path": "$TEST_IMG_FILE",
217 { "execute": "quit" }
220 _img_info | _filter_img_info
223 echo "=== Invalid path and user ==="
227 { "execute": "qmp_capabilities" }
228 { "execute": "x-blockdev-create",
232 "path": "/this/is/not/an/existing/path",
241 { "execute": "x-blockdev-create",
245 "path": "$TEST_IMG_FILE",
246 "user": "invalid user",
255 { "execute": "quit" }