From patchwork Thu May 18 11:34:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 9733797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6BEE1601C8 for ; Thu, 18 May 2017 11:35:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BFF728711 for ; Thu, 18 May 2017 11:35:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 511772874F; Thu, 18 May 2017 11:35:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A61E328711 for ; Thu, 18 May 2017 11:35:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933825AbdERLek (ORCPT ); Thu, 18 May 2017 07:34:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54470 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932441AbdERLeh (ORCPT ); Thu, 18 May 2017 07:34:37 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC77A20B13; Thu, 18 May 2017 11:34:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DC77A20B13 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DC77A20B13 Received: from t460s.redhat.com (ovpn-117-232.ams2.redhat.com [10.36.117.232]) by smtp.corp.redhat.com (Postfix) with ESMTP id 352D15C461; Thu, 18 May 2017 11:34:35 +0000 (UTC) From: David Hildenbrand To: kvm@vger.kernel.org Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Huth , david@redhat.com, Christian Borntraeger , Cornelia Huck Subject: [kvm-unit-tests PATCH v2 2/6] s390x: basic self test Date: Thu, 18 May 2017 13:34:23 +0200 Message-Id: <20170518113427.18387-3-david@redhat.com> In-Reply-To: <20170518113427.18387-1-david@redhat.com> References: <20170518113427.18387-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 18 May 2017 11:34:37 +0000 (UTC) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 193c3a0..4c6f9b5 100644 --- a/s390x/Makefile +++ b/s390x/Makefile @@ -1,3 +1,5 @@ +tests = $(TEST_DIR)/selftest.elf + all: test_cases test_cases: $(tests) diff --git a/s390x/selftest.c b/s390x/selftest.c new file mode 100644 index 0000000..d6d4167 --- /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'