diff options
author | Helmut Grohne <helmut@subdivi.de> | 2022-12-31 07:34:10 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2022-12-31 07:37:06 +0100 |
commit | 45a8428a30c2aebeb5163913c8167b318ff65c81 (patch) | |
tree | 96c5acba0384e030908f35f400baa69dc562f961 /tests/create-and-run.sh | |
parent | b7af04e9262142e953e487e75d91b610f1001ab4 (diff) | |
download | debvm-45a8428a30c2aebeb5163913c8167b318ff65c81.tar.gz |
tests: rework common code
Turn try-ssh.sh script into a shell function library.
Diffstat (limited to 'tests/create-and-run.sh')
-rwxr-xr-x | tests/create-and-run.sh | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tests/create-and-run.sh b/tests/create-and-run.sh index 6e8e075..c92ce1f 100755 --- a/tests/create-and-run.sh +++ b/tests/create-and-run.sh @@ -4,8 +4,12 @@ if test "$#" -ne 2; then echo "$(basename "$0") takes two positional arguments. architecture and release" 1>&2 exit 1 fi +ARCHITECTURE=$1 +RELEASE=$2 -set -ex +set -eux + +. "$(dirname "$0")/test_common.sh" cleanup() { rm -f ssh_id ssh_id.pub test.ext4 @@ -13,11 +17,14 @@ cleanup() { 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" +SSH_KEYPATH=ssh_id +ssh-keygen -f "$SSH_KEYPATH" -N '' +debvm-create -k "$SSH_KEYPATH.pub" -o test.ext4 -a "$ARCHITECTURE" -r "$RELEASE" -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 +SSH_PORT=2222 +timeout 240s debvm-run -s "$SSH_PORT" -i test.ext4 & +set -- localhost +test "$RELEASE" = jessie && set -- -o PubkeyAcceptedKeyTypes=+ssh-rsa "$@" +wait_ssh "$@" +run_ssh "$@" poweroff wait |