From patchwork Mon Feb 19 01:17:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Kambalin X-Patchwork-Id: 13562122 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E3399C48BC4 for ; Mon, 19 Feb 2024 01:25:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rbsJS-0005BE-TW; Sun, 18 Feb 2024 20:19:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rbsIg-0003Zi-Rm; Sun, 18 Feb 2024 20:18:33 -0500 Received: from mail-yw1-x112d.google.com ([2607:f8b0:4864:20::112d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rbsIe-0004L2-N7; Sun, 18 Feb 2024 20:18:30 -0500 Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-6080a3eecd4so16645997b3.2; Sun, 18 Feb 2024 17:18:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708305506; x=1708910306; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kP3rP5kDO6a2F7RySUKQZtGqTq+p08N2Zl2emdCf9Jg=; b=DtsuwPzS9320XgK1GXMbILQYF1mg0bz1zde+3meZxwh5gtaYdXei8K3jNrJyHyF8aM 7oWVHth/Ic0ojDj4W7ddkldFbJ6UQ+AONnQXSdrzJRYSQ0ewy+RzVx107f2VIaCuOiTi j/1IdY30+t0jOXhPLnxA4MvEnTVp1W7B7IAgBGSt1OektwTGuvyhlhXMXVzGDR5Z5swP kh7VE/NuwzOG6X8H/kMzMCACTUfqslM9jjDrHZGzu6X/y+8cnU/0wZolFySSQjglePP/ AdHr5+jbOPCRf2/oOYxTao3NsYD727VufMPLDpi+6ZL5gVUzaXdaPueBu2jsdv+tSOyW UKZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708305506; x=1708910306; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kP3rP5kDO6a2F7RySUKQZtGqTq+p08N2Zl2emdCf9Jg=; b=e+4K3gR5ZxkExDQ+6ax5xPeruYEKoH1H+ZmvRmt8RznVv7JPaifiXiG5lDsaMey+Fo Na6z19bgbohgL2fqoKdnNBZYjzGTCmZOUxVyo1As4wudfvzOy//1xydgm2mGCxNGL81N zWhSoum0PvEwgQ50P+qs1xNqeEHRjjV22LV9nPC7aJx7btTN5+wglNfoUImej+mJO1WF fNAVYA1tJ5a37+4fug1Oc3mWz3EwZnO/9ExOv2YU54tJKwMUvSHmCNkHv8nq6RMwXsbk aFoWSNixj6KyDaq4Xhv7MHmZJWprPLE249hYxFMQ0NZ8g0y9RVwVf3mcflG2szFZPjDw +Adg== X-Gm-Message-State: AOJu0Yz3D/nkWxdE4ypenue7QXU/6NJuP8cldfEriBv4oHGiCGgkHqJz Mv1qtlWCxIvqwf5X1b7JC4xXtPWp1bc0rPI3K6dZvV+haDENcBUmSZhLiqaCHU0= X-Google-Smtp-Source: AGHT+IEIL2m9lUVUqTgxHSV9QFUhf/Mpacy0rwhvpOdAtWqgDb8OGsgmva8CS1nb2TsF+hwHvX152A== X-Received: by 2002:a81:ad1f:0:b0:607:b0d3:ebc0 with SMTP id l31-20020a81ad1f000000b00607b0d3ebc0mr10602186ywh.21.1708305505974; Sun, 18 Feb 2024 17:18:25 -0800 (PST) Received: from localhost.localdomain ([201.203.117.224]) by smtp.gmail.com with ESMTPSA id m12-20020a819e0c000000b00607ff905ed3sm1204704ywj.58.2024.02.18.17.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 17:18:25 -0800 (PST) From: Sergey Kambalin X-Google-Original-From: Sergey Kambalin To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, Sergey Kambalin Subject: [PATCH v5 37/41] Add mailbox property tests. Part 2 Date: Sun, 18 Feb 2024 19:17:35 -0600 Message-Id: <20240219011739.2316619-38-sergey.kambalin@auriga.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240219011739.2316619-1-sergey.kambalin@auriga.com> References: <20240219011739.2316619-1-sergey.kambalin@auriga.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::112d; envelope-from=serg.oker@gmail.com; helo=mail-yw1-x112d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, UPPERCASE_50_75=0.008 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Signed-off-by: Sergey Kambalin --- tests/qtest/bcm2838-mbox-property-test.c | 196 ++++++++++++++++++++++- 1 file changed, 195 insertions(+), 1 deletion(-) diff --git a/tests/qtest/bcm2838-mbox-property-test.c b/tests/qtest/bcm2838-mbox-property-test.c index acb421915b..b251d3f552 100644 --- a/tests/qtest/bcm2838-mbox-property-test.c +++ b/tests/qtest/bcm2838-mbox-property-test.c @@ -50,7 +50,8 @@ FIELD(GET_CLOCK_STATE_CMD, NPRES, 1, 1) (TEST_TAG_TYPE(testname) * tag); \ static void CHECK_FN_NAME(testname, __VA_ARGS__) \ (TEST_TAG_TYPE(testname) *tag); \ - static void TEST_FN_NAME(testname, __VA_ARGS__)(void) { \ + static void TEST_FN_NAME(testname, __VA_ARGS__)(void) \ + { \ struct { \ MboxBufHeader header; \ TEST_TAG_TYPE(testname) tag; \ @@ -189,6 +190,179 @@ DECLARE_TEST_CASE_SETUP(GET_MIN_CLOCK_RATE, EMMC) { } /*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_CLOCK_RATE, UART) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UART); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_UART); +} +DECLARE_TEST_CASE_SETUP(GET_CLOCK_RATE, UART) { + tag->request.value.clock_id = CLOCK_ID_UART; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MAX_CLOCK_RATE, UART) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UART); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_UART); +} +DECLARE_TEST_CASE_SETUP(GET_MAX_CLOCK_RATE, UART) { + tag->request.value.clock_id = CLOCK_ID_UART; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MIN_CLOCK_RATE, UART) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UART); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_UART); +} +DECLARE_TEST_CASE_SETUP(GET_MIN_CLOCK_RATE, UART) { + tag->request.value.clock_id = CLOCK_ID_UART; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_CLOCK_RATE, CORE) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_CORE); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_CORE); +} +DECLARE_TEST_CASE_SETUP(GET_CLOCK_RATE, CORE) { + tag->request.value.clock_id = CLOCK_ID_CORE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MAX_CLOCK_RATE, CORE) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_CORE); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_CORE); +} +DECLARE_TEST_CASE_SETUP(GET_MAX_CLOCK_RATE, CORE) { + tag->request.value.clock_id = CLOCK_ID_CORE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MIN_CLOCK_RATE, CORE) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_CORE); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_CORE); +} +DECLARE_TEST_CASE_SETUP(GET_MIN_CLOCK_RATE, CORE) { + tag->request.value.clock_id = CLOCK_ID_CORE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_CLOCK_RATE, ANY) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UNDEFINED); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_ANY); +} +DECLARE_TEST_CASE_SETUP(GET_CLOCK_RATE, ANY) { + tag->request.value.clock_id = CLOCK_ID_UNDEFINED; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MAX_CLOCK_RATE, ANY) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UNDEFINED); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_ANY); +} +DECLARE_TEST_CASE_SETUP(GET_MAX_CLOCK_RATE, ANY) { + tag->request.value.clock_id = CLOCK_ID_UNDEFINED; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MIN_CLOCK_RATE, ANY) { + g_assert_cmphex(tag->response.value.clock_id, ==, CLOCK_ID_UNDEFINED); + g_assert_cmphex(tag->response.value.rate, ==, CLOCK_RATE_ANY); +} +DECLARE_TEST_CASE_SETUP(GET_MIN_CLOCK_RATE, ANY) { + tag->request.value.clock_id = CLOCK_ID_UNDEFINED; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_TEMPERATURE) { + g_assert_cmphex(tag->response.value.temperature_id, ==, TEMPERATURE_ID_SOC); + g_assert_cmpint(tag->response.value.temperature, ==, TEMPERATURE_SOC); +} +DECLARE_TEST_CASE_SETUP(GET_TEMPERATURE) { + tag->request.value.temperature_id = TEMPERATURE_ID_SOC; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(GET_MAX_TEMPERATURE) { + g_assert_cmphex(tag->response.value.temperature_id, ==, TEMPERATURE_ID_SOC); + g_assert_cmpint(tag->response.value.temperature, ==, TEMPERATURE_SOC_MAX); +} +DECLARE_TEST_CASE_SETUP(GET_MAX_TEMPERATURE) { + tag->request.value.temperature_id = TEMPERATURE_ID_SOC; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_ALLOCATE) { + g_assert_cmphex(tag->response.value.base, ==, VC_FB_BASE); + g_assert_cmphex(tag->response.value.size, ==, VC_FB_SIZE); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_ALLOCATE) { + tag->request.value.alignment = ALIGN_4K; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_RELEASE) { + /* No special checks are needed for this test */ +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_BLANK) { + g_assert_cmphex(tag->response.value.on, ==, 0); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_BLANK) { + tag->request.value.on = 0; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT) { + g_assert_cmpint(tag->response.value.width, ==, DUMMY_VALUE); + g_assert_cmpint(tag->response.value.height, ==, DUMMY_VALUE); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT) { + tag->request.value.width = DUMMY_VALUE; + tag->request.value.height = DUMMY_VALUE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT, INITIAL) { + g_assert_cmpint(tag->response.value.width, ==, 640); + g_assert_cmpint(tag->response.value.height, ==, 480); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT) { + g_assert_cmpint(tag->response.value.width, ==, 800); + g_assert_cmpint(tag->response.value.height, ==, 600); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT) { + tag->request.value.width = 800; + tag->request.value.height = 600; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT) { + g_assert_cmpint(tag->response.value.width, ==, DUMMY_VALUE); + g_assert_cmpint(tag->response.value.height, ==, DUMMY_VALUE); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT) { + tag->request.value.width = DUMMY_VALUE; + tag->request.value.height = DUMMY_VALUE; +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_GET_VIRTUAL_WIDTH_HEIGHT, INITIAL) { + g_assert_cmpint(tag->response.value.width, ==, 640); + g_assert_cmpint(tag->response.value.height, ==, 480); +} + +/*----------------------------------------------------------------------------*/ +DECLARE_TEST_CASE(FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT) { + g_assert_cmpint(tag->response.value.width, ==, 800); + g_assert_cmpint(tag->response.value.height, ==, 600); +} +DECLARE_TEST_CASE_SETUP(FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT) { + tag->request.value.width = 800; + tag->request.value.height = 600; +} + +//============================================================================== int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -202,6 +376,26 @@ int main(int argc, char **argv) QTEST_ADD_TEST_CASE(GET_CLOCK_RATE, EMMC); QTEST_ADD_TEST_CASE(GET_MAX_CLOCK_RATE, EMMC); QTEST_ADD_TEST_CASE(GET_MIN_CLOCK_RATE, EMMC); + QTEST_ADD_TEST_CASE(GET_CLOCK_RATE, UART); + QTEST_ADD_TEST_CASE(GET_MAX_CLOCK_RATE, UART); + QTEST_ADD_TEST_CASE(GET_MIN_CLOCK_RATE, UART); + QTEST_ADD_TEST_CASE(GET_CLOCK_RATE, CORE); + QTEST_ADD_TEST_CASE(GET_MAX_CLOCK_RATE, CORE); + QTEST_ADD_TEST_CASE(GET_MIN_CLOCK_RATE, CORE); + QTEST_ADD_TEST_CASE(GET_CLOCK_RATE, ANY); + QTEST_ADD_TEST_CASE(GET_MAX_CLOCK_RATE, ANY); + QTEST_ADD_TEST_CASE(GET_MIN_CLOCK_RATE, ANY); + QTEST_ADD_TEST_CASE(GET_TEMPERATURE); + QTEST_ADD_TEST_CASE(GET_MAX_TEMPERATURE); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_ALLOCATE); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_RELEASE); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_BLANK); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_PHYSICAL_WIDTH_HEIGHT, INITIAL); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_GET_VIRTUAL_WIDTH_HEIGHT, INITIAL); + QTEST_ADD_TEST_CASE(FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT); return g_test_run(); }