From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Hildenbrand Subject: [kvm-unit-tests PATCH v3 2/7] s390x: basic self test Date: Mon, 22 May 2017 10:56:57 +0200 Message-ID: <20170522085702.17856-3-david@redhat.com> References: <20170522085702.17856-1-david@redhat.com> Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Huth , david@redhat.com, Christian Borntraeger , Cornelia Huck To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:49276 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753127AbdEVI5M (ORCPT ); Mon, 22 May 2017 04:57:12 -0400 In-Reply-To: <20170522085702.17856-1-david@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Test if the general infrastructure is working. The test will fail until we have proper sclp console output. Signed-off-by: David Hildenbrand --- 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 + * David Hildenbrand + * + * 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 +#include + +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 = ############################################################################## + +[selftest-setup] +file = selftest.elf +groups = selftest +extra_params = -append 'test 123' -- 2.9.3