From: Alexander Smirnov <asmirnov@ilbers.de>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>
Subject: [PATCH v2 1/3] scripts/vm_smoke_test: Add quite parameter
Date: Fri, 4 May 2018 15:27:12 +0300 [thread overview]
Message-ID: <20180504122714.1201-2-asmirnov@ilbers.de> (raw)
In-Reply-To: <20180504122714.1201-1-asmirnov@ilbers.de>
Due to this script is used for QA needs only, it's OK that it has verbose
output enabled by default. This patch adds option to supress excessive
output. But the boot log for specific configuration will be anyway shown
if respective test case failed.
Also this patch fixes an issue that the same boot log could be displayed
multiple times.
Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
scripts/vm_smoke_test | 68 ++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 56 insertions(+), 12 deletions(-)
diff --git a/scripts/vm_smoke_test b/scripts/vm_smoke_test
index 274ec1d..76db97d 100755
--- a/scripts/vm_smoke_test
+++ b/scripts/vm_smoke_test
@@ -5,13 +5,19 @@
CONSOLE_OUTPUT=/tmp/isar_console
PID_FILE=/tmp/qemu.pid
+VERBOSE=1
-RET=0
+# Error codes:
+ES_OK=0
+ES_FAIL=1
+ES_BUG=3
+
+RET=$ES_OK
dump_boot_log() {
- echo "Boot log: 8<--"
+ echo "Boot log:\n8<--"
cat $CONSOLE_OUTPUT
- echo -e "\n8<--"
+ echo "\n8<--"
}
check_login_prompt() {
@@ -23,8 +29,8 @@ check_login_prompt() {
echo "PASSED"
else
echo "FAIL"
- dump_boot_log
- RET=1
+ RET=$ES_FAIL
+ FAIL=1
fi
}
@@ -37,8 +43,8 @@ check_example_module() {
echo "PASSED"
else
echo "FAIL"
- dump_boot_log
- RET=1
+ RET=$ES_FAIL
+ FAIL=1
fi
}
@@ -49,24 +55,62 @@ run_test () {
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 60
kill `cat $PID_FILE`
- # Check login prompt
+ FAIL=0
+
check_login_prompt
- # Check kernel module
check_example_module
- dump_boot_log
+ [ $VERBOSE -eq 1 -o $FAIL -eq 1 ] && dump_boot_log
- # Clean up test artifacts
rm $CONSOLE_OUTPUT
rm $PID_FILE
}
+show_help() {
+ echo "This script tests all the default Isar images in QEMU."
+ echo
+ echo "Usage:"
+ echo " $0 [params]"
+ echo
+ echo "Parameters:"
+ echo " -q, --quite do not display boot logs for all the targets."
+ echo " If test failed for the specific configuration,"
+ echo " the respective boot log will be printed anyway."
+ echo " -h, --help display this message and exit."
+ echo
+ echo "Exit status:"
+ echo " 0 if OK,"
+ echo " 1 if test failed,"
+ echo " 3 if invalid parameters are passed."
+}
+
+# Parse command line to get user configuration
+while [ $# -gt 0 ]
+do
+ key="$1"
+
+ case $key in
+ -h|--help)
+ show_help
+ exit 0
+ ;;
+ -q|--quite)
+ VERBOSE=0
+ ;;
+ *)
+ echo "error: invalid parameter '$key', please try '--help' to get list of supported parameters"
+ exit $ES_BUG
+ ;;
+ esac
+
+ shift
+done
+
# ARM machine
run_test arm wheezy
run_test arm jessie
--
2.1.4
next prev parent reply other threads:[~2018-05-04 12:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-04 12:27 [PATCH v2 0/3] Update scripts Alexander Smirnov
2018-05-04 12:27 ` Alexander Smirnov [this message]
2018-05-04 12:27 ` [PATCH v2 2/3] scripts/vm_smoke_test: Check if QEMU didn't start Alexander Smirnov
2018-05-04 12:27 ` [PATCH v2 3/3] scripts/ci_build: Make CI script more generic Alexander Smirnov
2018-05-04 18:23 ` [PATCH v2 0/3] Update scripts Henning Schild
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=20180504122714.1201-2-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