From: David Hildenbrand <david@redhat.com>
To: kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
david@redhat.com,
"Christian Borntraeger" <borntraeger@de.ibm.com>,
"Cornelia Huck" <cornelia.huck@de.ibm.com>
Subject: [kvm-unit-tests PATCH v3 2/7] s390x: basic self test
Date: Mon, 22 May 2017 10:56:57 +0200 [thread overview]
Message-ID: <20170522085702.17856-3-david@redhat.com> (raw)
In-Reply-To: <20170522085702.17856-1-david@redhat.com>
Test if the general infrastructure is working. The test will fail until
we have proper sclp console output.
Signed-off-by: David Hildenbrand <david@redhat.com>
---
s390x/Makefile | 2 ++
s390x/selftest.c | 41 +++++++++++++++++++++++++++++++++++++++++
s390x/unittests.cfg | 5 +++++
3 files changed, 48 insertions(+)
create mode 100644 s390x/selftest.c
diff --git a/s390x/Makefile b/s390x/Makefile
index 575956b..d468029 100644
--- a/s390x/Makefile
+++ b/s390x/Makefile
@@ -1,3 +1,5 @@
+tests = $(TEST_DIR)/selftest.elf
+
all: directories test_cases
test_cases: $(tests)
diff --git a/s390x/selftest.c b/s390x/selftest.c
new file mode 100644
index 0000000..4558e47
--- /dev/null
+++ b/s390x/selftest.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017 Red Hat Inc
+ *
+ * Authors:
+ * Thomas Huth <thuth@redhat.com>
+ * David Hildenbrand <david@redhat.com>
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Library General Public License version 2.
+ */
+#include <libcflat.h>
+#include <util.h>
+
+static void test_fp(void)
+{
+ double a = 3.0;
+ double b = 2.0;
+ double c;
+
+ asm volatile(
+ " ddb %1, %2\n"
+ " std %1, %0\n"
+ : "=m" (c) : "f" (a), "m" (b));
+
+ report("3.0/2.0 == 1.5", c == 1.5);
+}
+
+int main(int argc, char**argv)
+{
+ report_prefix_push("selftest");
+
+ report("true", true);
+ report("argc == 3", argc == 3);
+ report("argv[0] == PROGNAME", !strcmp(argv[0], "s390x/selftest.elf"));
+ report("argv[1] == test", !strcmp(argv[1], "test"));
+ report("argv[2] == 123", !strcmp(argv[2], "123"));
+
+ test_fp();
+
+ return report_summary();
+}
diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
index b1e0b1e..92e01ab 100644
--- a/s390x/unittests.cfg
+++ b/s390x/unittests.cfg
@@ -17,3 +17,8 @@
# # to check separated by a space but each check
# # parameter needs to be of the form <path>=<value>
##############################################################################
+
+[selftest-setup]
+file = selftest.elf
+groups = selftest
+extra_params = -append 'test 123'
--
2.9.3
next prev parent reply other threads:[~2017-05-22 8:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 8:56 [kvm-unit-tests PATCH v3 0/7] s390x: basic test infrastructure David Hildenbrand
2017-05-22 8:56 ` [kvm-unit-tests PATCH v3 1/7] s390x: initial infrastructure David Hildenbrand
2017-05-22 8:56 ` David Hildenbrand [this message]
2017-05-22 9:39 ` [kvm-unit-tests PATCH v3 2/7] s390x: basic self test Thomas Huth
2017-05-22 8:56 ` [kvm-unit-tests PATCH v3 3/7] s390x: copy sclp.h and sclp-ascii.c from QEMU David Hildenbrand
2017-05-22 9:45 ` Thomas Huth
2017-05-22 8:56 ` [kvm-unit-tests PATCH v3 4/7] s390x: compile sclp-ascii.c David Hildenbrand
2017-05-22 9:47 ` Thomas Huth
2017-05-22 8:57 ` [kvm-unit-tests PATCH v3 5/7] s390x: wire up sclp console output David Hildenbrand
2017-05-22 8:57 ` [kvm-unit-tests PATCH v3 6/7] .travis.yml: add s390x David Hildenbrand
2017-05-22 8:57 ` [kvm-unit-tests PATCH v3 7/7] MAINTAINERS: add s390x maintainers David Hildenbrand
2017-05-25 16:37 ` [kvm-unit-tests PATCH v3 0/7] s390x: basic test infrastructure Paolo Bonzini
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=20170522085702.17856-3-david@redhat.com \
--to=david@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=thuth@redhat.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