public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Alexander Smirnov <asmirnov@ilbers.de>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>
Subject: [PATCH 4/4] scripts: Add simple smoke test
Date: Fri,  6 Oct 2017 13:34:22 +0300	[thread overview]
Message-ID: <20171006103422.25393-5-asmirnov@ilbers.de> (raw)
In-Reply-To: <20171006103422.25393-1-asmirnov@ilbers.de>

This simple smoke test checks if newly Isar image boots in QEMU to
login prompt. That's the first check that will be performes after
successfull build.

Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
 scripts/vm_smoke_test | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100755 scripts/vm_smoke_test

diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test
new file mode 100755
index 0000000..3bcfd5a
--- /dev/null
+++ b/scripts/vm_smoke_test
@@ -0,0 +1,50 @@
+#!/bin/sh
+#
+# This software is a part of ISAR.
+# Copyright (C) 2015-2017 ilbers GmbH
+
+CONSOLE_OUTPUT=/tmp/isar_console
+PID_FILE=/tmp/qemu.pid
+
+check_output() {
+    str=$(tail -1 $CONSOLE_OUTPUT)
+
+    if [ "$str" = "isar login: " ]; then
+        echo "Test: PASSED"
+    else
+        echo "Test: FAIL"
+    fi
+}
+
+run_test () {
+    ARCH=$1
+    DISTRO=$2
+
+    echo "-------------------------------------------------"
+    echo "Testing Isar [$DISTRO] image for [$ARCH] machine:"
+
+    # Start QEMU with Isar image
+    start_vm -a $ARCH -d $DISTRO -o $CONSOLE_OUTPUT -p $PID_FILE > /dev/null 2>&1 &
+    sleep 30
+    kill `cat $PID_FILE`
+
+    # Check output
+    check_output
+
+    # Clean up test artifacts
+    rm $CONSOLE_OUTPUT
+    rm $PID_FILE
+}
+
+# ARM machine
+run_test arm wheezy
+run_test arm jessie
+run_test arm stretch
+
+# AMD64 machine
+run_test amd64 jessie
+run_test amd64 stretch
+
+# i386 machine
+run_test i386 jessie
+run_test i386 stretch
-- 
2.1.4


      parent reply	other threads:[~2017-10-06 10:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 10:34 [PATCH 0/4] Simple smoke test for QEMU Alexander Smirnov
2017-10-06 10:34 ` [PATCH 1/4] scripts: Remove bashism from sh script Alexander Smirnov
2017-10-06 10:34 ` [PATCH 2/4] scripts: Add option to route start_vm output to file Alexander Smirnov
2017-10-06 10:34 ` [PATCH 3/4] scripts: Add option to store QEMU pid Alexander Smirnov
2017-10-06 10:34 ` Alexander Smirnov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171006103422.25393-5-asmirnov@ilbers.de \
    --to=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox