From nobody Tue Apr 15 04:26:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1685473470; cv=none; d=zohomail.com; s=zohoarc; b=KWj24sAc0JeL6cGTAdgcQvbuD3insS6op19THNlUZlvAz2noF8AwcpiBoMOGAZZawyuKaOVIX7KhzDTIhjNOfJoMiCbLOOYoulxDeI1mwrpjWWo+LIdb7RGtWI8F+P1DODNsrSUIgnTYaLEigZDQl6aHwukMa3HiXe5hwtO4/jU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1685473470; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mpuLQvPVxoSrCp/Ta2mdl/Aq9ROqTlZL3minDuEWys8=; b=Q3Pb3fgh6qxu4eeFpuE64eUrXbS5vaRsLdXfwzm2OX1jec8X/nb8njCjdUVZuJ+DiQMiEQlHJn44on46VQt6m5d0KO0JWNbbtNE0Wlfi3Cvohj8TDEjZgqf8OuWmhq9iP+v4YK30YhYzxn0WTddwMUKr9nlFLp+RL9isdb69aUk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1685473470907576.4493040099776; Tue, 30 May 2023 12:04:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q44aK-00013K-Hu; Tue, 30 May 2023 15:00:46 -0400 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 1q44Zu-0000uF-Pq for qemu-devel@nongnu.org; Tue, 30 May 2023 15:00:18 -0400 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q44Zs-0000sb-QW for qemu-devel@nongnu.org; Tue, 30 May 2023 15:00:18 -0400 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-64fd7723836so2037979b3a.1 for ; Tue, 30 May 2023 12:00:14 -0700 (PDT) Received: from stoup.. ([2602:ae:1598:4c01:35a2:c45d:7485:f488]) by smtp.gmail.com with ESMTPSA id g18-20020a63fa52000000b0051f14839bf3sm9128496pgk.34.2023.05.30.12.00.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 12:00:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685473214; x=1688065214; 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=mpuLQvPVxoSrCp/Ta2mdl/Aq9ROqTlZL3minDuEWys8=; b=UkGjlJZDCQAacmofgnkrm8SCQ7iCfo0nfQqSrl+yiFIgiHK0g1ahz0NSe438PCoxeh ZWsMH0FHbA1YNACW3FyXmoROmsOYpccTnopfwWz62N3/wS6+ZoZfHwgeWPMuAoJLi9Dl NTTE+FNf0NgojzC7qQe4Od2NCh6A8M5bO7XlbAobrWlzed/r8IEph2hKpE9RKE/EqieE okgomLoOEphbJzEgHtG15rYpzbeNg7KH2g1SdiR5TxtMOeeA91ADoGa4DDQ5lpVRd7QC oAhlJM+7x42EP+iqmN5sKV/w1YtY4lMEl9Wu6zMQyAPNzGVfTCAU11Qb0CWgZNa2lRI1 0A6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685473214; x=1688065214; 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=mpuLQvPVxoSrCp/Ta2mdl/Aq9ROqTlZL3minDuEWys8=; b=EIkkK8NuSyd5/Ng5d0egi2PsesDptLQdybieE4WgsTPuY3hVGMlAcXLkyQtLjEWc3Z tuqWNQg9q/D5yh25vOLUyMGUeQgoGcPuWpVqtxLhTCbQnhpTw4kHeUv5jOTpKsNnWHzK zGKT/zKOQIBX4qNvA/3vdhCGs9RJd0KIocC9sHeE97tlAp6iHVZNSnQrfWjuzD1i9gU6 encqfC6HoxaS9ixgoR44aqRI8z/kuXReOlxQqq2Vi/U7k4KeJYrkX9KsMV0qZoJsKuxS 79N/bVPjAKY5B9eY2RtXRu4cU5ZBsn1mpBTDUspDVztomjdbdDzGdWxNFFj5ADXCjPPk thmQ== X-Gm-Message-State: AC+VfDyhfXUF2cRH3kCHmbt3w0vLlDU9LYTPWHEtjypcpSQj9M1Z7ror z0K2KuuITFi+0+b50f4WK4HV2kqe9JabUXtUNsk= X-Google-Smtp-Source: ACHHUZ7xbh/Z2lam1U2MSWNDplLpFgv4UCHv0N4NwA+Tb6GQiE7PDbO8F14A8FTte3bTD3L3i4S8Aw== X-Received: by 2002:a05:6a20:9c8f:b0:110:9210:f6af with SMTP id mj15-20020a056a209c8f00b001109210f6afmr3303734pzb.27.1685473214574; Tue, 30 May 2023 12:00:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 27/27] tests/decode: Add tests for various named-field cases Date: Tue, 30 May 2023 11:59:49 -0700 Message-Id: <20230530185949.410208-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230530185949.410208-1-richard.henderson@linaro.org> References: <20230530185949.410208-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42e.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1685473472993100007 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Add some tests for various cases of named-field use, both ones that should work and ones that should be diagnosed as errors. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Message-Id: <20230523120447.728365-7-peter.maydell@linaro.org> --- tests/decode/err_field10.decode | 7 +++++++ tests/decode/err_field7.decode | 7 +++++++ tests/decode/err_field8.decode | 8 ++++++++ tests/decode/err_field9.decode | 14 ++++++++++++++ tests/decode/succ_named_field.decode | 19 +++++++++++++++++++ tests/decode/meson.build | 5 +++++ 6 files changed, 60 insertions(+) create mode 100644 tests/decode/err_field10.decode create mode 100644 tests/decode/err_field7.decode create mode 100644 tests/decode/err_field8.decode create mode 100644 tests/decode/err_field9.decode create mode 100644 tests/decode/succ_named_field.decode diff --git a/tests/decode/err_field10.decode b/tests/decode/err_field10.dec= ode new file mode 100644 index 0000000000..3e672b7459 --- /dev/null +++ b/tests/decode/err_field10.decode @@ -0,0 +1,7 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or late= r. +# See the COPYING.LIB file in the top-level directory. + +# Diagnose formats which refer to undefined fields +%field1 field2:3 +@fmt ........ ........ ........ ........ %field1 +insn 00000000 00000000 00000000 00000000 @fmt diff --git a/tests/decode/err_field7.decode b/tests/decode/err_field7.decode new file mode 100644 index 0000000000..51fad7ccea --- /dev/null +++ b/tests/decode/err_field7.decode @@ -0,0 +1,7 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or late= r. +# See the COPYING.LIB file in the top-level directory. + +# Diagnose fields whose definitions form a loop +%field1 field2:3 +%field2 field1:4 +insn 00000000 00000000 00000000 00000000 %field1 %field2 diff --git a/tests/decode/err_field8.decode b/tests/decode/err_field8.decode new file mode 100644 index 0000000000..cc47c08a45 --- /dev/null +++ b/tests/decode/err_field8.decode @@ -0,0 +1,8 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or late= r. +# See the COPYING.LIB file in the top-level directory. + +# Diagnose patterns which refer to undefined fields +&f1 f1 a +%field1 field2:3 +@fmt ........ ........ ........ .... a:4 &f1 +insn 00000000 00000000 00000000 0000 .... @fmt f1=3D%field1 diff --git a/tests/decode/err_field9.decode b/tests/decode/err_field9.decode new file mode 100644 index 0000000000..e7361d521b --- /dev/null +++ b/tests/decode/err_field9.decode @@ -0,0 +1,14 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or late= r. +# See the COPYING.LIB file in the top-level directory. + +# Diagnose fields where the format refers to a field defined in the +# pattern and the pattern refers to a field defined in the format. +# This is theoretically not impossible to implement, but is not +# supported by the script at this time. +&abcd a b c d +%refa a:3 +%refc c:4 +# Format defines 'c' and sets 'b' to an indirect ref to 'a' +@fmt ........ ........ ........ c:8 &abcd b=3D%refa +# Pattern defines 'a' and sets 'd' to an indirect ref to 'c' +insn 00000000 00000000 00000000 ........ @fmt d=3D%refc a=3D6 diff --git a/tests/decode/succ_named_field.decode b/tests/decode/succ_named= _field.decode new file mode 100644 index 0000000000..e64b3f9356 --- /dev/null +++ b/tests/decode/succ_named_field.decode @@ -0,0 +1,19 @@ +# This work is licensed under the terms of the GNU LGPL, version 2 or late= r. +# See the COPYING.LIB file in the top-level directory. + +# field using a named_field +%imm_sz 8:8 sz:3 +insn 00000000 00000000 ........ 00000000 imm_sz=3D%imm_sz sz=3D1 + +# Ditto, via a format. Here a field in the format +# references a named field defined in the insn pattern: +&imm_a imm alpha +%foo 0:16 alpha:4 +@foo 00000001 ........ ........ ........ &imm_a imm=3D%foo +i1 ........ 00000000 ........ ........ @foo alpha=3D1 +i2 ........ 00000001 ........ ........ @foo alpha=3D2 + +# Here the named field is defined in the format and referenced +# from the insn pattern: +@bar 00000010 ........ ........ ........ &imm_a alpha=3D4 +i3 ........ 00000000 ........ ........ @bar imm=3D%foo diff --git a/tests/decode/meson.build b/tests/decode/meson.build index b4850562f9..38a0629d67 100644 --- a/tests/decode/meson.build +++ b/tests/decode/meson.build @@ -7,6 +7,10 @@ err_tests =3D [ 'err_field4.decode', 'err_field5.decode', 'err_field6.decode', + 'err_field7.decode', + 'err_field8.decode', + 'err_field9.decode', + 'err_field10.decode', 'err_init1.decode', 'err_init2.decode', 'err_init3.decode', @@ -37,6 +41,7 @@ succ_tests =3D [ 'succ_argset_type1.decode', 'succ_function.decode', 'succ_ident1.decode', + 'succ_named_field.decode', 'succ_pattern_group_nest1.decode', 'succ_pattern_group_nest2.decode', 'succ_pattern_group_nest3.decode', --=20 2.34.1