From nobody Mon Nov 25 05:46:33 2024 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=1717068260; cv=none; d=zohomail.com; s=zohoarc; b=fkvOCfsMflfHSK568m/wAxFM7CJvOld69u7Vk1Pl+TPQd14oKkibbXeiBWPbjYcSLcb395jnKMbm7/QFeBCNnFvtKtKZByGgcNdcivCC5zN+SqqShTeR1UA92kq0MTKjFa9jQrKWXNwetr43hMsGmEJaBRkZsQhFip2UpWucUd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717068260; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=oZxIGZlTq6Y3xT2BvJ15fFream5O9L7a1aAvj3sA9CY=; b=FHyQK78jb9CnkUbtGZIQsr5/nZylnfJ/Re5PinKd0coVttdHQoUV4gH0/jAn0F9kVBkGEoJDdA8EYkx8UMtiLfv67j6yeHyFZrlP1j2zo3U92AM1qE1hT1e45Olmoh1kcZ12dc1iQ6+UfJ4hGzUs+KyeiYac5IXRYbAwiBfSLxg= 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 1717068260780490.1120993904725; Thu, 30 May 2024 04:24:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCdsl-00055v-N2; Thu, 30 May 2024 07:23:43 -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 1sCdsj-0004yz-RS for qemu-devel@nongnu.org; Thu, 30 May 2024 07:23:41 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCdse-0002gF-Hd for qemu-devel@nongnu.org; Thu, 30 May 2024 07:23:41 -0400 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-52b7ebb2668so685039e87.2 for ; Thu, 30 May 2024 04:23:35 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626cc8b980sm808318366b.154.2024.05.30.04.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 04:23:33 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id C287C5F8D5; Thu, 30 May 2024 12:23:32 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717068214; x=1717673014; 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=oZxIGZlTq6Y3xT2BvJ15fFream5O9L7a1aAvj3sA9CY=; b=SUSiDT3xEk0RxK9BzlFio2IMaRyfMsRjc3nx6IKbODfUPkSLq8C7V6oGvZITxJeAMF 0szo29diFUBt1/ivOTrGlTvec0RzEy54ZrG6uaHOLQqQImGDe31W4PMfnS36TvpCT5/i nl3OUsIZe6rU9Ljyd7MAg+7BY4/FTog0SIOjtecnJYZtDXFbHY98bxcTpGKgmXD5Ls7m P8FIsepf0xEmaB+Qf9UfLiF52/iVNsfj/zyB7XII0qzAGe5QQzHFJZI4DcCWOzm4KjRF qalmr1f9EXlutComIr89GtkKIJ838kuFJavSlthT56JKkSiJa1zhifxEjVTKFefmvA+L YzlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717068214; x=1717673014; 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=oZxIGZlTq6Y3xT2BvJ15fFream5O9L7a1aAvj3sA9CY=; b=twmW6+kX96upb34cmU5VO6GMUfenaQLW3isYkP4H+5OhEuhU5FvOsjlNDLZy7g7RKA by0gxjBxtQ5h1aOwxUXQP7qrhQbANYmWTcKeuPgwgCzTj0VQSDI3Ak19F/QmjGbEUcJ6 Z7cIPm4eVGV4hGUV1AGS6P5jqTyGL1eIlKGUyev7w0J+WdAhcMsuKBh9/BssgIZjrJ4g rIjZsvSob6w2dzAoX2oc2azICQVT3zwOREVVtDKyACVoDs+5PLsN93GQmZwRZT1Axuti s8dE6nhMAykvnBKZ68XWCX74oiu0k4X5p3ICUfLqvj3gp64DMWVyO0gOvSyQYPd+faJ4 WFHQ== X-Gm-Message-State: AOJu0Yw0cIlmKhgcl3IU7TjGQfLAnA+PzrTET+Co/IUHx3pgALw3nXeK rEcWlD6Xz27XXuyQ23QX1eLHdiYPAmK2+5wqZNhtp1cbnasUK/6BKiPOcnJ4ZWI= X-Google-Smtp-Source: AGHT+IHz+5QSXgu3C7cPewo9Wd0ndcHczrM83YQnZZdCVJYBllnyUP95R0fARidB6uBbgzS6ZHy3OA== X-Received: by 2002:a19:8c51:0:b0:51f:9549:9c0d with SMTP id 2adb3069b0e04-52b7d49970cmr1427260e87.48.1717068213909; Thu, 30 May 2024 04:23:33 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: Peter Maydell Cc: qemu-devel@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [Semihosting Tests PATCH v2 1/3] .editorconfig: add code conventions for tooling Date: Thu, 30 May 2024 12:23:30 +0100 Message-Id: <20240530112332.1439238-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240530112332.1439238-1-alex.bennee@linaro.org> References: <20240530112332.1439238-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::130; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x130.google.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 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, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01, URIBL_SBL_A=0.1 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: 1717068261857100007 It's a pain when you come back to a code base you haven't touched in a while and realise whatever indent settings you were using having carried over. Add an editorconfig and be done with it. Signed-off-by: Alex Benn=C3=A9e --- v2 - drop mention of custom major modes (not needed here) - include section for assembly --- .editorconfig | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c72a55c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,29 @@ +# EditorConfig is a file format and collection of text editor plugins +# for maintaining consistent coding styles between different editors +# and IDEs. Most popular editors support this either natively or via +# plugin. +# +# Check https://editorconfig.org for details. +# + +root =3D true + +[*] +end_of_line =3D lf +insert_final_newline =3D true +charset =3D utf-8 + +[Makefile*] +indent_style =3D tab +indent_size =3D 8 +emacs_mode =3D makefile + +[*.{c,h}] +indent_style =3D space +indent_size =3D 4 +emacs_mode =3D c + +[*.{s,S}] +indent_style =3D tab +indent_size =3D 8 +emacs_mode =3D asm --=20 2.39.2 From nobody Mon Nov 25 05:46:33 2024 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=1717068279; cv=none; d=zohomail.com; s=zohoarc; b=BZJMQSHmDth5w0++ooMdsQmFRBtU+yZfLgs8ZS283eGKk4SB8teZ/DAM1h/QzaH+oERuVKOxiDmzRiVMRxtNlQoGNFYERPe1/8nUPcfnm2fZx+1d6+J4j5487YghioIpjvlKI1aWPlL2NlHqIM5/TB2J4ZNs4l4QOQMZGXjjzgI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717068279; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RGoFF8PPa/BpM4KP9BeBmjTmucakXvrHPoIh46UpeKY=; b=EKSxy8oEeJvff76+ciAStyeARHLCFJFswdymoXsQBnYm3/DB/RAaiPK/dW040jNsccAD5OfiGKA0s0ZzO77rWC17ZCCe8EMd7m1E+sQst1KSECSRnC550503/IDor9FZw15DPQ5NGQIKEZrIGYYBtmf4LlNsHij80kfu3MKQtcc= 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 1717068279386199.03250182480872; Thu, 30 May 2024 04:24:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCdsj-0004wa-Cw; Thu, 30 May 2024 07:23:41 -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 1sCdsh-0004uN-5x for qemu-devel@nongnu.org; Thu, 30 May 2024 07:23:39 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCdsf-0002gE-JB for qemu-devel@nongnu.org; Thu, 30 May 2024 07:23:38 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-57a1fe63a98so523765a12.1 for ; Thu, 30 May 2024 04:23:35 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-578523cba01sm9798275a12.35.2024.05.30.04.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 04:23:33 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id CF6DE5F8E3; Thu, 30 May 2024 12:23:32 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717068214; x=1717673014; 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=RGoFF8PPa/BpM4KP9BeBmjTmucakXvrHPoIh46UpeKY=; b=r/4SYbx8a5PNeWKCS+vcaAQPfc/7aAPQ4Lbz7sPDb9qYSkF6a0/gooKhgWofgyYuL+ I1UVAplYSiibvqx0EUYolcTvOeH7dcrdtfrSLCKhxL8WWlgJBMlNLhxBxOdU78UJa2hk cI9VWVpaWttpPopVZEEnNUyLCxsXKGoymrJ5p7ijhnnZMyfhRFCPPfrIyiutl+I6DiR3 HzxvkTueXCdDk9i4XAUdai7fwjgIit7AipBG7lxpYL/TA4L0HhIx+8erfJu+5MOsjvW4 Ean7/sBUZA1FztNbg/nnlDmWCbYUZAykqLmJvfbe3lDoJiXDGAd3bkl328g8QdlJhd4I TE/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717068214; x=1717673014; 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=RGoFF8PPa/BpM4KP9BeBmjTmucakXvrHPoIh46UpeKY=; b=ROwXBeitzNZKoiyvKWae90OT8/0Ow8HlSILjuU6f0H98ep6AkEUITF03omfi+oMwDx +MtznZfmvFK/Mi4+0oXrGBm1HoulTHu9eeybcuSVvZ0hKv5ZJchvOti0E3Q2ZF+jYxCP ekk0/dJGGUktA3iOSwpUi02STk9LWQeewJnYOP0Ai63Jjs8NC881l5h4ZCuJIw1TPFE6 V9mFn2QTXm2kXZQK0XJLt+KPD76BHqax1wIPcA+vjuzedCGtCQh0T6v0NDcxS1acpj9u dqMzRvBA9XhRq5JvEYMmzzbbKMOYPCxYzszVDGN2wZrOU1S4BJgsqMTCpcHGbD8hr9QK 8WhQ== X-Gm-Message-State: AOJu0Yyehkgud5EqlJdd8jh6uwNhxQAR2A1ueo6tJjD+9XZfsuGF8H3a DE9RHXoBs0dIpbF2Ka3HkfmhztqfLHrq3IhQpRn+xeZKjWCve/rzVHJff0eMwkU3/mz5LXM87Px N X-Google-Smtp-Source: AGHT+IEw2j6h6ipAB3UcU3pjLCg35Hdcl8dxUzdGnzI9kUReOXQR2+1GPoL2TKZ7MWBWXXsBT2vVjw== X-Received: by 2002:a50:8ad8:0:b0:572:d082:79fa with SMTP id 4fb4d7f45d1cf-57a177aaa3bmr1274039a12.14.1717068213685; Thu, 30 May 2024 04:23:33 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: Peter Maydell Cc: qemu-devel@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [Semihosting Tests PATCH v2 2/3] update includes for bare metal compiling Date: Thu, 30 May 2024 12:23:31 +0100 Message-Id: <20240530112332.1439238-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240530112332.1439238-1-alex.bennee@linaro.org> References: <20240530112332.1439238-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::52b; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52b.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: 1717068280020100013 We shouldn't use for our own implementation. Also the base types we need live in as doesn't exist for the bare metal compilers. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Peter Maydell --- semihosting.c | 4 ++-- semihosting.h | 2 +- string.c | 2 +- usertest.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/semihosting.c b/semihosting.c index 7a0ee0c..27dafbe 100644 --- a/semihosting.c +++ b/semihosting.c @@ -16,8 +16,8 @@ * from this software without specific prior written permission. */ =20 -#include -#include +#include +#include "string.h" #include "semihosting.h" =20 int semi_open(char const *filename, int mode) diff --git a/semihosting.h b/semihosting.h index 06cda8d..68344fb 100644 --- a/semihosting.h +++ b/semihosting.h @@ -19,7 +19,7 @@ #ifndef SEMIHOSTING_H #define SEMIHOSTING_H =20 -#include +#include =20 #define SYS_OPEN 1 #define OPEN_RDONLY 1 diff --git a/string.c b/string.c index 045d71b..c289aa1 100644 --- a/string.c +++ b/string.c @@ -16,7 +16,7 @@ * from this software without specific prior written permission. */ =20 -#include +#include "string.h" =20 static void *__memmove_down(void *__dest, __const void *__src, size_t __n) { diff --git a/usertest.c b/usertest.c index ce0f61d..5df95f3 100644 --- a/usertest.c +++ b/usertest.c @@ -20,7 +20,7 @@ * from this software without specific prior written permission. */ =20 -#include +#include "string.h" #include "semihosting.h" #include "printf/printf.h" =20 --=20 2.39.2 From nobody Mon Nov 25 05:46:33 2024 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=1717068274; cv=none; d=zohomail.com; s=zohoarc; b=g2swRX2ZbB65+iT18NSJV9Xtb414FGmNmBPoLkd0/Rvc0qz6kHXlih1cJy9OJ8cTJAHzL1iCIR1vFNBFd+BvkpN35cfUCCkILPiX9LSxGrRjS+aOI6Q13J8ejs9a15emv8GwbMiKuEO12xfNKIc2D4ac7u3lalpQLyd/Ov/4l6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717068274; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BUuBTVNvgV45jAw2FZGNm/bzWVNk+iprBbeI4k7zOec=; b=YysXVykngDVZJuTWtA0GcZJZAVVDpqhoJ6J+c8PC0jmUZHaKEWkBIgMyEsRLhoZIb1poyHuMe3oDBKfrZBp631MBlTJgLQQ7XT2CjbhQtsO7tRXx4XjgM9zbSaF9YALTW8b8mhClbG94jkV+ey/2iL/09Gq6w0yAVClnDU/1goY= 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 1717068274305931.6489466351702; Thu, 30 May 2024 04:24:34 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sCdsl-00053e-2g; Thu, 30 May 2024 07:23:43 -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 1sCdsj-0004yu-LS for qemu-devel@nongnu.org; Thu, 30 May 2024 07:23:41 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sCdsf-0002gH-Sq for qemu-devel@nongnu.org; Thu, 30 May 2024 07:23:41 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-579cd80450fso1781684a12.0 for ; Thu, 30 May 2024 04:23:35 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a667bf48673sm27419066b.60.2024.05.30.04.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 04:23:33 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id DCD1B5F8E5; Thu, 30 May 2024 12:23:32 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717068214; x=1717673014; 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=BUuBTVNvgV45jAw2FZGNm/bzWVNk+iprBbeI4k7zOec=; b=b/0VfhQop0ABwzUOeN37WtqewZD7Ng/MdOvCY1DgpJ758/LRA+ksylUh6J3gqKAlZT 2wWZbbIEDLO1xdNnbNIn/xY/y7J18d7EdBr/skvnyih1PhAuTPOt/sUgdq9QBMttLPuF UP6XYdsYjFHXIN9Y4cDx08DpJFbHEbxx1ELZ9X9oKIRwwGgXGkKMFmZ4X0/smC6PRrmJ O0Lg5xk88zoKVikbBfYsS66eVshMcBJ7ZwVBdH68jL++9ad4icJMZ+1H5+yoRJaoCQ+U yrJ7OxQNoT5EIQNaJ7XOQ77273Mqxgeire4Z3KUTm9jnSpNw9JiylFVpiwZ+16lTdm0Q OpHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717068214; x=1717673014; 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=BUuBTVNvgV45jAw2FZGNm/bzWVNk+iprBbeI4k7zOec=; b=Gq6qQQtGwdfRzfp/5Tj9+JRfHdiY/Sv4++0kl51z2bS+0xsgB5/X007J3a3DFF2l0j 0asx2EbCQ31k6eNBXfRglcgnLLnIlMf9NYV4SE9U2Jwbk0xR9Qk1p07KIvYXN44Jd+Pt d1BoEXtTGmz0jH2rB0J3s7TdOaxfEtHPm3DuQL0Frs9knyVEWtpBsE4QmmVfObcYvr3q d/AQd8nrwt6xva0n3VhgTtNy2eEr4BOku2LYQFIL8ka0J09gjhM21VT/BM28cBUMxuei IlJFrvfqGoOw+qgVKxJb22V68RMrzBTvvin8zYnnj7+OdssjQsltqHyJzdezP4drgCFJ ESKQ== X-Gm-Message-State: AOJu0Yw9wAUqp+UEN/J2st6vIqlOrsUgAg11VR8Ys1ifIzU34VbVA/fL Qt/Lye58WKo1GdsrxqXoAr6KHhER+710s9hLIHaYloteYxlhwcC5neEPqg0fI4s= X-Google-Smtp-Source: AGHT+IE5JlisWqE5qyrd+TDLIeC43UX5znM6qP91fDIfF4PIgEpDa0/52gBC/PVNObXbvb7tv105Cg== X-Received: by 2002:a17:906:1c41:b0:a5a:8cc0:8c23 with SMTP id a640c23a62f3a-a65f0bd69cemr132733966b.27.1717068214174; Thu, 30 May 2024 04:23:34 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: Peter Maydell Cc: qemu-devel@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Subject: [Semihosting Tests PATCH v2 3/3] add SYS_GET_CMDLINE test Date: Thu, 30 May 2024 12:23:32 +0100 Message-Id: <20240530112332.1439238-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240530112332.1439238-1-alex.bennee@linaro.org> References: <20240530112332.1439238-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::52b; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52b.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: 1717068275900100003 Adds a new test case for the semihosting SYS_GET_CMDLINE call. We can use the existing previously unused semi_get_cmdline helper and we then verify: - the call succeeds - the call returns the expected length string - the call returns the expected binary name as arg0 The most fiddly bit was exposing the binary name into the program so we can validate the result. Signed-off-by: Alex Benn=C3=A9e --- v2 - add return leg on failing test - check returned length is sane - s/could/couldn't/ - just let array reference decay to the pointer - rewrite the commit message to be less terse --- Makefile | 22 +++++++++++----------- usertest.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 59fd831..f77665f 100644 --- a/Makefile +++ b/Makefile @@ -85,37 +85,37 @@ systest-srcs =3D start.S string.c $(usertest-srcs) microbit-systest-srcs =3D start-microbit.S string.c $(usertest-srcs) =20 usertest-a32: $(usertest-srcs) - $(A32GCC) --static -o $@ $^ + $(A32GCC) -DBINARY_NAME=3D"\"$@\"" --static -o $@ $^ =20 usertest-t32: $(usertest-srcs) - $(T32GCC) --static -o $@ $^ + $(T32GCC) -DBINARY_NAME=3D"\"$@\"" --static -o $@ $^ =20 usertest-a32-hlt: $(usertest-srcs) - $(A32GCC) -DUSE_HLT --static -o $@ $^ + $(A32GCC) -DBINARY_NAME=3D"\"$@\"" -DUSE_HLT --static -o $@ $^ =20 usertest-t32-hlt: $(usertest-srcs) - $(T32GCC) -DUSE_HLT --static -o $@ $^ + $(T32GCC) -DBINARY_NAME=3D"\"$@\"" -DUSE_HLT --static -o $@ $^ =20 usertest-a64: $(usertest-srcs) - $(A64GCC) --static -o $@ $^ + $(A64GCC) -DBINARY_NAME=3D"\"$@\"" --static -o $@ $^ =20 systest-a32.axf: $(systest-srcs) - $(A32GCC) -o $@ $^ $(A32LINKOPTS) + $(A32GCC) -DBINARY_NAME=3D"\"$@\"" -o $@ $^ $(A32LINKOPTS) =20 systest-t32.axf: $(systest-srcs) - $(T32GCC) -o $@ $^ $(A32LINKOPTS) + $(T32GCC) -DBINARY_NAME=3D"\"$@\"" -o $@ $^ $(A32LINKOPTS) =20 systest-a32-hlt.axf: $(systest-srcs) - $(A32GCC) -DUSE_HLT -o $@ $^ $(A32LINKOPTS) + $(A32GCC) -DBINARY_NAME=3D"\"$@\"" -DUSE_HLT -o $@ $^ $(A32LINKOPTS) =20 systest-t32-hlt.axf: $(systest-srcs) - $(T32GCC) -DUSE_HLT -o $@ $^ $(A32LINKOPTS) + $(T32GCC) -DBINARY_NAME=3D"\"$@\"" -DUSE_HLT -o $@ $^ $(A32LINKOPTS) =20 systest-t32-bkpt.axf: $(microbit-systest-srcs) - $(V7MGCC) -DUSE_BKPT -o $@ $^ $(AV7MLINKOPTS) + $(V7MGCC) -DBINARY_NAME=3D"\"$@\"" -DUSE_BKPT -o $@ $^ $(AV7MLINKOPTS) =20 systest-a64.axf: $(systest-srcs) - $(A64GCC) -nostdlib -o $@ $^ $(A64LINKOPTS) + $(A64GCC) -DBINARY_NAME=3D"\"$@\"" -nostdlib -o $@ $^ $(A64LINKOPTS) =20 run-usertest-a32: usertest-a32 $(QEMU_ARM) usertest-a32 diff --git a/usertest.c b/usertest.c index 5df95f3..7a12896 100644 --- a/usertest.c +++ b/usertest.c @@ -315,6 +315,33 @@ static int test_feature_detect(void) return 0; } =20 +static int test_cmdline(void) +{ + char cmdline[256]; + int actual; + const char *s, *c; + + if (semi_get_cmdline(cmdline, sizeof(cmdline), &actual)) { + semi_write0("FAIL couldn't recover command line\n"); + return 1; + } + + if (strlen(BINARY_NAME) !=3D actual) { + semi_write0("FAIL cmdline length not what expected: "); + semi_write0(cmdline); + return 1; + } + + if (strcmp(cmdline, BINARY_NAME) !=3D 0) { + semi_write0("FAIL unexpected command line: "); + semi_write0(cmdline); + return 1; + } + + semi_write0("PASS command line test\n"); + return 0; +} + int main(void) { void *bufp; @@ -366,6 +393,10 @@ int main(void) return 1; } =20 + if (test_cmdline()) { + return 1; + } + semi_write0("ALL TESTS PASSED\n"); =20 /* If we have EXIT_EXTENDED then use it */ --=20 2.39.2