summaryrefslogtreecommitdiff
path: root/tests/create-and-run.sh
blob: 6e8e0755380224e94ea7cbc772b90e1720715504 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

if test "$#" -ne 2; then
	echo "$(basename "$0") takes two positional arguments. architecture and release" 1>&2
	exit 1
fi

set -ex

cleanup() {
	rm -f ssh_id ssh_id.pub test.ext4
}

trap cleanup EXIT INT TERM QUIT

ssh-keygen -f ssh_id -N ''
debvm-create -k ssh_id.pub -o test.ext4 -a "$1" -r "$2"

timeout 240s debvm-run -s 2222 -i test.ext4 &
SSHOPT="-o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
test "$2" = jessie && SSHOPT="${SSHOPT} -o PubkeyAcceptedKeyTypes=+ssh-rsa"
tests/try-ssh.sh "$SSHOPT -i ssh_id -p 2222 root@localhost" poweroff
wait