From nobody Fri Oct 31 09:32:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1747774393; cv=none; d=zohomail.com; s=zohoarc; b=Nja+dRHj2TOH2HLR+xCjBR2L+Qu1wH26hsKXQT0mIYt2suROP5tx9ixaLGehOnHVzvojzg7AwgGSXfip74lbkLQT6BCPl71wP9CLC30rAD39nME4BxfPp2O7v89QIohiwGEaxT6dha5E+uIZVDEyrdESl7kj+KxKvh40i8UMXY4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747774393; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QF2CENVJm5m7t+V0Pvc5Nc5BgJ21+f+zzmuztZZAqXo=; b=j9UfPydk6SkBdHunHRLwu2l2kNuvHhMrVbREqvVHxhGOvJT/ReYLpBbt5A80kvthS+BEyxt0eSV1dmTX+qVfBQevxiWvxFoJ4haAUslhL/zU2KfrF6o9S8Y3oiaV2HDUhIaR3g5M1AovnVDg0fazRvQsM9lBSWrwLK0WpaKXh9Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1747774393436596.4240085793365; Tue, 20 May 2025 13:53:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.991132.1375045 (Exim 4.92) (envelope-from ) id 1uHTx8-0006aT-J1; Tue, 20 May 2025 20:52:46 +0000 Received: by outflank-mailman (output) from mailman id 991132.1375045; Tue, 20 May 2025 20:52:46 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uHTx8-0006aK-Ex; Tue, 20 May 2025 20:52:46 +0000 Received: by outflank-mailman (input) for mailman id 991132; Tue, 20 May 2025 20:52:45 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uHTx6-0006MJ-W7 for xen-devel@lists.xenproject.org; Tue, 20 May 2025 20:52:45 +0000 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [2a00:1450:4864:20::332]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 606472f9-35bc-11f0-a2fa-13f23c93f187; Tue, 20 May 2025 22:52:43 +0200 (CEST) Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-442ec3ce724so49974645e9.0 for ; Tue, 20 May 2025 13:52:43 -0700 (PDT) Received: from localhost.localdomain (host-92-26-98-202.as13285.net. [92.26.98.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a3674fed67sm13346626f8f.89.2025.05.20.13.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 May 2025 13:52:42 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 606472f9-35bc-11f0-a2fa-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1747774363; x=1748379163; darn=lists.xenproject.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=QF2CENVJm5m7t+V0Pvc5Nc5BgJ21+f+zzmuztZZAqXo=; b=lv0SzLuWD82UcZyH7XSMupV8IxvHOxfI+l9OLlHIR81D/jgYQEBRmaACV/vZjx7qkq B9iqt5M+j0egK+OchiF0FEbVdn6MJwvjsqxa/vW8iEv9M6ui8V+4ef22dU9eR7yTeehs B22Cz2GnYZvX1RJUkZjF3ijiv+f7jcbb8+pRs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747774363; x=1748379163; 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=QF2CENVJm5m7t+V0Pvc5Nc5BgJ21+f+zzmuztZZAqXo=; b=KEqZyxTAlAK7t5alHhMfVm1PWvcGQ5PgD4X8MEx8sPIaTiRHHj/dzROOmmDPMmTWyX kiFBDh3UMDrkosRGLpbg148FAf/EFAsud4N3byjQdRK4HUCdKhXlX4Ouioj5oFAZRd+v m063WCBoQUtIpxUGXRtN2+DazpyZUqTw8czwnUKPQ0uedW43BkQuPdapqg5nhyvko8Zx appgp0cGMjLSOVr76fq9RBkMKG+8ht6CJJKQgUPYE1Tj5SgNpoi0yYlvqkZSG/hMd70T rfRqSVcetmsQbfA0CSSerMvSAp94Ni0QklFDamdVVVUqowikMWwyQVrE1t6Lk10akCQb 1l0Q== X-Gm-Message-State: AOJu0YzGufoI0lXEtG9dTJa8G4tjomV5OmB8ZmnQrIIo5vb1+EAHc3LV Vl59tkZV/fOzPia0GPYxYxlY2zIHT7NdVlSu4cRHxWFXiBOl5UsTLQJ5jT5BiaJka666j6qZ9UR frfQy X-Gm-Gg: ASbGncs01d8BXNOVjDoN35tzIv1bFjJ1cVjL0m6VtxlRys0gEG5WLhGVjG8DgnUsP29 4nR03w0INcbbi52l23YwqOntLGppxZ2FlPlw427JbPgt5uGDSZ1Y+Ft0DNU6teFO9V7fLR+qnzX QZzuc1IhfwHXms7cs/oFz/dXLcxB1fnYAHp2uwa4oNU8DtjwQKSA6OysoQP/d/Hs/PJJj5oM5VM lesGA10brdiUcFHsjnAFeLRa2Bl9y4CzioYW/IRE2x0gnn2TvC2dWnkHFLn9mjrdNJ2dYUFqViV ISaA91BFHOVOIyaJy/6hHnbvTDeUTVohpA4lcydXNXGyOhftdUYhIN4XmnpYuwB3VGSejnNVWe0 xFl4hF1ZX0JpdnpGELvBIBN+Q X-Google-Smtp-Source: AGHT+IF6XfNakqFYxe0RQsn+F/j9c/CDgReDYbe2WRBYgz2TEaGBtLigippEMa+Dd+EUc5kkkbvFdw== X-Received: by 2002:a05:6000:4024:b0:3a3:6afd:f2dd with SMTP id ffacd0b85a97d-3a36afdf4demr8835081f8f.50.1747774362730; Tue, 20 May 2025 13:52:42 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Anthony PERARD , Stefano Stabellini , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Subject: [PATCH 1/3] tools/tests: Drop depriv-fd-checker Date: Tue, 20 May 2025 21:52:37 +0100 Message-Id: <20250520205239.203253-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250520205239.203253-1-andrew.cooper3@citrix.com> References: <20250520205239.203253-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1747774394691116600 Unlike the other tests, this is not standalone. It requires poking at a li= ve system, making it unweildly to use. It hasn't been touched in 7 years, despite changes in libraries and kernel devices using the deprivilege infrastructure. Signed-off-by: Andrew Cooper Acked-by: Anthony PERARD Acked-by: Stefano Stabellini Reviewed-by: Denis Mukhin --- CC: Anthony PERARD CC: Stefano Stabellini CC: Marek Marczykowski-G=C3=B3recki --- .gitignore | 1 - tools/tests/Makefile | 1 - tools/tests/depriv/Makefile | 52 --- tools/tests/depriv/depriv-fd-checker.c | 436 ------------------------- 4 files changed, 490 deletions(-) delete mode 100644 tools/tests/depriv/Makefile delete mode 100644 tools/tests/depriv/depriv-fd-checker.c diff --git a/.gitignore b/.gitignore index 53f5df000383..4a4e20680464 100644 --- a/.gitignore +++ b/.gitignore @@ -165,7 +165,6 @@ tools/misc/xencov tools/pkg-config/* tools/qemu-xen-build tools/xentrace/xenalyze -tools/tests/depriv/depriv-fd-checker tools/tests/x86_emulator/*.bin tools/tests/x86_emulator/*.tmp tools/tests/x86_emulator/32/x86_emulate diff --git a/tools/tests/Makefile b/tools/tests/Makefile index 3e60ab6b268d..36928676a666 100644 --- a/tools/tests/Makefile +++ b/tools/tests/Makefile @@ -9,7 +9,6 @@ ifneq ($(clang),y) SUBDIRS-$(CONFIG_X86) +=3D x86_emulator endif SUBDIRS-y +=3D xenstore -SUBDIRS-y +=3D depriv SUBDIRS-y +=3D rangeset SUBDIRS-y +=3D vpci SUBDIRS-y +=3D paging-mempool diff --git a/tools/tests/depriv/Makefile b/tools/tests/depriv/Makefile deleted file mode 100644 index 5404a12f4780..000000000000 --- a/tools/tests/depriv/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -XEN_ROOT=3D$(CURDIR)/../../.. -include $(XEN_ROOT)/tools/Rules.mk - -CFLAGS +=3D $(CFLAGS_xeninclude) -CFLAGS +=3D $(CFLAGS_libxenctrl) -CFLAGS +=3D $(CFLAGS_libxencall) -CFLAGS +=3D $(CFLAGS_libxenevtchn) -CFLAGS +=3D $(CFLAGS_libxengnttab) -CFLAGS +=3D $(CFLAGS_libxenforeignmemory) -CFLAGS +=3D $(CFLAGS_libxendevicemodel) -CFLAGS +=3D $(CFLAGS_libxentoolcore) -CFLAGS +=3D $(CFLAGS_libxentoollog) - -LDLIBS +=3D $(LDLIBS_xeninclude) -LDLIBS +=3D $(LDLIBS_libxenctrl) -LDLIBS +=3D $(LDLIBS_libxencall) -LDLIBS +=3D $(LDLIBS_libxenevtchn) -LDLIBS +=3D $(LDLIBS_libxengnttab) -LDLIBS +=3D $(LDLIBS_libxenforeignmemory) -LDLIBS +=3D $(LDLIBS_libxendevicemodel) -LDLIBS +=3D $(LDLIBS_libxentoolcore) -LDLIBS +=3D $(LDLIBS_libxentoollog) - -INSTALL_PRIVBIN-y +=3D depriv-fd-checker -INSTALL_PRIVBIN :=3D $(INSTALL_PRIVBIN-y) -TARGETS +=3D $(INSTALL_PRIVBIN) - -.PHONY: all -all: build - -.PHONY: build -build: $(TARGETS) - -.PHONY: clean -clean: - $(RM) *.o $(TARGETS) *~ $(DEPS_RM) - -.PHONY: distclean -distclean: clean - -depriv-fd-checker: depriv-fd-checker.o - $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS) - -install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) - $(INSTALL_PROG) $(INSTALL_PRIVBIN) $(DESTDIR)$(LIBEXEC_BIN) - -.PHONY: uninstall -uninstall: - rm -f $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/, $(INSTALL_PRIVBIN)) - --include $(DEPS_INCLUDE) diff --git a/tools/tests/depriv/depriv-fd-checker.c b/tools/tests/depriv/de= priv-fd-checker.c deleted file mode 100644 index 98a27a03d543..000000000000 --- a/tools/tests/depriv/depriv-fd-checker.c +++ /dev/null @@ -1,436 +0,0 @@ -/* - * depriv-fd-checker - * - * utility to check whether file descriptor(s) are deprivileged - * - * usage: - * .../depriv-fd-checker CLASS FD X-INFO [CLASS FD X-INFO...] - * - * CLASS is one of: - * privcmd gntdev evtchn FD should be appropriate Xen control fd - * readonly FD is expected to be readonly - * appendonly FD is expected to be append write only - # tun FD is expected to be an open tun device - * - * In each case FD is probably a reference to an open-file stolen - * from another process, eg by the use of fishdescriptor. - * - * X-INFO is simply appended to the discursive reportage. - * - * It is an error if depriv-fd-checker cannot open the control - * facilities itself, or something goes wrong with checking, or an FD - * is entirely the wrong kind for the specified CLASS. Otherwise: - * - * depriv-fd-checker will perhaps print, for each triplet: - * CLASS checking FD INFORMATION... X-INFO - * and in any case print, for each triplet, exactly one of: - * CLASS pass|fail FD INFORMATION... X-INFO - * tun maybe FD IFNAME X-INFO - * - * "pass" means that the descriptor was restricted as expected. - * "fail" means that the descriptor was unrestricted. - * "maybe" means that further information is printed, as detailed above, - * and the caller should check that it is as expected - */ -/* - * Copyright (C)2018 Citrix Systems R&D - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; version 2.1 of the - * License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; If not, see - * . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -/* - * Every class needs setup. setup is called once per class at program - * startup. - * - * Then it can have - * open test getfd close - * In which case the core code will for every fd - * open test getfd dup2 test close - * And test should call blocked or succeeded and then immediately - * return, or error out - * - * Or it can have - * check - * which should call report, or error out - * - * Errors: use trouble for simple syscall errors. Or use err or errx - * and maybe print fd_desc and test_which, according to the comments - * in struct classinfo. - */ - -static xentoollog_logger *logger; - -static int object_fd; -static const char *classname; -static const char *fd_desc; -static const char *test_which; - -static const char *test_wh_unrest =3D "test (unrestricted)"; -static const char *test_wh_rest =3D "test (restricted)"; - - -static void trouble(const char *what) __attribute__((noreturn)); -static void trouble(const char *what) { - fprintf(stderr, - "trouble: %s %s %d (%s) %s: %s\n", - classname, test_which, object_fd, fd_desc, what, strerror(errno)); - exit(-1); -} - -static void report(const char *pass_or_fail, const char *what, - const char *notes) { - printf("%s %s %d %s (%s) %s\n", - classname, pass_or_fail, - object_fd, what, notes, fd_desc); - if (ferror(stdout) || fflush(stdout)) err(16,"stdout"); -} - -static void succeeded(const char *what) { - if (test_which =3D=3D test_wh_unrest) { - /* ok */ - test_which =3D 0; - } else if (test_which =3D=3D test_wh_rest) { - report("fail",what,"unexpectedly succeeded"); - test_which =3D 0; - } else { - abort(); - } -} - -static void blocked(const char *what) { - if (test_which =3D=3D test_wh_rest) { - /* yay */ - report("pass", what,"blocked"); - test_which =3D 0; - } else if (test_which =3D=3D test_wh_unrest) { - err(4,"test blocked on unrestricted fd: %s {%s}",what,test_which); - } else { - abort(); - } -} - -/* privcmd */ - -static xc_interface *xch; -static void setup_privcmd(void) { } -static void open_privcmd(void) { - xch =3D xc_interface_open(logger,0,0); - if (!xch) trouble("xc_interface_open"); -} -static void test_privcmd(void) { - int r =3D xc_get_online_cpus(xch); - if (r>0) - succeeded("xc_get_online_cpus"); - else if (r=3D=3D0) - errx(-1,"xc_get_online_cpus{%s, %s}=3D0", test_which, fd_desc); - else if (errno=3D=3DEPERM || errno=3D=3DEACCES) - blocked("xc_get_online_cpus"); - else - trouble("xc_get_online_cpus"); -} -static int getfd_privcmd(void) { - return xencall_fd(xc_interface_xcall_handle(xch)); -} -static void close_privcmd(void) { - xc_interface_close(xch); -} - -/* gntdev */ - -static xengntshr_handle *xgs; -static uint32_t gntshr_gref; -static xengnttab_handle *xgt; -static void setup_gntdev(void) { - void *r; - xgs =3D xengntshr_open(logger,0); - if (!xgs) trouble("xengntshr_open"); - r =3D xengntshr_share_pages(xgs, 0, 1, &gntshr_gref, 1); - if (!r || r=3D=3D(void*)-1) trouble("xengntshr_share_pages"); - memset(r, 0x55, XC_PAGE_SIZE); -} -static void open_gntdev(void) { - xgt =3D xengnttab_open(logger,0); - if (!xgt) trouble("xengnttab_open"); -} -static void test_gntdev(void) { - char mybuf[XC_PAGE_SIZE]; - memset(mybuf, 0xaa, XC_PAGE_SIZE); - xengnttab_grant_copy_segment_t seg; - seg.source.foreign.ref =3D gntshr_gref; - seg.source.foreign.offset =3D 0; - seg.source.foreign.domid =3D 0; - seg.dest.virt =3D mybuf; - seg.len =3D 1; - seg.flags =3D GNTCOPY_source_gref; - for (;;) { - seg.status =3D 0; - int r =3D xengnttab_grant_copy(xgt,1,&seg); - if (r<0) { - if (errno=3D=3DEPERM || errno=3D=3DEACCES || errno=3D=3DENOTTY) - blocked("xengnttab_grant_copy"); - else - trouble("xengnttab_grant_copy"); - } else if (r=3D=3D0) { - if (seg.status=3D=3DGNTST_okay) - succeeded("xengnttab_grant_copy okay"); - else if (seg.status=3D=3DGNTST_eagain) - continue; - else errx(-1,"xengnttab_grant_copy=3D%d {%s, %s} but .status=3D%d", - r, test_which, fd_desc,(int)seg.status); - } else { - errx(-1,"xengnttab_grant_copy=3D%d {%s, %s}", - r, test_which, fd_desc); - } - break; - } -} -static int getfd_gntdev(void) { - return xengnttab_fd(xgt); -} -static void close_gntdev(void) { - xengnttab_close(xgt); -} - -/* evtchn */ - -static xenevtchn_handle *xce_recip, *xce; -static void setup_evtchn(void) { - xce_recip =3D xenevtchn_open(logger, 0); - if (!xce_recip) err(-1,"xenevtchn_open (donor)"); -} -static void open_evtchn(void) { - xce =3D xenevtchn_open(logger, 0); - if (!xce) err(-1,"xenevtchn_open"); -} -static void test_evtchn(void) { - xenevtchn_port_or_error_t - recip_port=3D-1, test_unbound_port=3D-1, test_send_port=3D-1; - - recip_port =3D xenevtchn_bind_unbound_port(xce_recip, 0); - if (recip_port < 0) trouble("xenevtchn_bind_unbound_port"); - - test_unbound_port =3D xenevtchn_bind_unbound_port(xce, 0); - if (test_unbound_port >=3D 0) { - succeeded("xenevtchn_bind_unbound_port"); - goto out; - } - - test_send_port =3D xenevtchn_bind_interdomain(xce, 0, recip_port); - /* bind_interdomain marks the channel pending */ - struct pollfd pfd; - for (;;) { - pfd.fd =3D xenevtchn_fd(xce_recip); - pfd.events =3D POLLIN; - pfd.revents =3D 0; - int r =3D poll(&pfd,1,0); - if (r>=3D0) break; - if (errno!=3DEINTR) err(-1,"poll(xce_recip)"); - } - if (pfd.revents & POLLIN) { - xenevtchn_port_or_error_t p3 =3D xenevtchn_pending(xce_recip); - if (p3 < 0) err(-1,"xenevtchn_pending(check)"); - if (p3 !=3D recip_port) - errx(-1,"xenevtchn_pending=3D%d expected %d",p3,recip_port); - xenevtchn_unmask(xce_recip, recip_port); - } - - if (test_send_port>=3D0 && (pfd.revents & POLLIN)) { - succeeded("xenevtchn_bind_interdomain/poll"); - /* we make no attempt to undo what we did to this stolen fd; - * the rightful owner will see a spurious event on test_send_port = */ - } else if (test_send_port=3D=3D-1 && !(pfd.revents & POLLIN) && - (errno=3D=3DEPERM || errno=3D=3DEACCES || errno=3D=3DENOTTY= )) { - blocked("xenevtchn_notify"); - } else { - err(-1,"%s %s xenevtchn_bind_interdomain=3D%d .revents=3D0x%x", - test_which, fd_desc, test_send_port, pfd.revents); - } - - out: - if (recip_port > 0) xenevtchn_unbind(xce, recip_port); - if (test_unbound_port > 0) xenevtchn_unbind(xce, test_unbound_port); - if (test_send_port > 0) xenevtchn_unbind(xce, test_send_port); -} -static int getfd_evtchn(void) { - return xenevtchn_fd(xce); -} -static void close_evtchn(void) { - xenevtchn_close(xce); -} - -/* fcntl */ - -#define CHECK_FCNTL(openmode) \ - int r =3D fcntl(object_fd, F_GETFL); \ - if (r < 0) trouble("fcntl F_GETFL"); \ - int m =3D r & (O_RDONLY | O_WRONLY | O_RDWR); \ - \ - char mbuf[100 + 30*3]; \ - snprintf(mbuf,sizeof(mbuf), \ - "F_GETFL=3D%#o m=3D%#o " #openmode "=3D%#o", \ - r,m,(int)openmode); \ - \ - if (m !=3D openmode) { \ - report("fail", #openmode, mbuf); \ - return; \ - } - -/* readonly */ - -static void setup_readonly(void) { } -static void check_readonly(void) { - CHECK_FCNTL(O_RDONLY); - report("pass", "fcntl", mbuf); -} - -/* appendonly */ - -static void setup_appendonly(void) { } -static void check_appendonly(void) { - CHECK_FCNTL(O_WRONLY); - if (!(r & O_APPEND)) { - report("fail", "O_APPEND", mbuf); - return; - } - report("pass", "fcntl", mbuf); -} - -#if defined(__linux__) -#include -#include -#include -#include -#include -#ifndef TUNGETIFF -#define TUNGETIFF _IOR('T', 210, unsigned int) -#endif - -/* linux tun */ - -static void setup_tun(void) { } -static void check_tun(void) { - struct ifreq ifr; - int r; - - memset(&ifr,0,sizeof(ifr)); - r =3D ioctl(object_fd, TUNGETIFF, (void*)&ifr); - if (r<0) trouble("TUNGETIFF"); - printf("tun maybe %d %.*s %s\n", object_fd, - (int)IFNAMSIZ, ifr.ifr_ifrn.ifrn_name, - fd_desc); -} - -#define PLATFORM_CLASSES \ - DEFCHECK(tun), - -#else /* !defined(__linux__) */ -#define PLATFORM_CLASSES /* empty */ -#endif - -/* class table and main program */ - -#define DEFCLASS(cl) \ - { #cl, setup_##cl, 0, open_##cl, test_##cl, getfd_##cl, close_##cl } -#define DEFCHECK(meth) \ - { #meth, setup_##meth, check_##meth } - -static const struct classinfo { - const char *name; /* errors: print fd_desc test_which */ - void (*setup)(void); /* best not best not */ - void (*check)(void); /* must may */ - void (*open)(void); /* must may */ - void (*test)(void); /* must must */ - int (*getfd)(void); /* must may */ - void (*close)(void); /* must may */ -} classinfos[] =3D { - DEFCLASS(privcmd), - DEFCLASS(gntdev), - DEFCLASS(evtchn), - DEFCHECK(readonly), - DEFCHECK(appendonly), - PLATFORM_CLASSES - { 0 } -}; - -int main(int argc, char **argv) { - const struct classinfo *cli; - int r; - - argv++; - - logger =3D (xentoollog_logger*)xtl_createlogger_stdiostream - (stderr, XTL_NOTICE, XTL_STDIOSTREAM_HIDE_PROGRESS); - - fd_desc =3D "setup"; - test_which =3D "setup"; - for (cli =3D classinfos; cli->name; cli++) - cli->setup(); - - while ((classname =3D *argv++)) { - if (!*argv) errx(8,"need fd after class"); - object_fd =3D atoi(*argv++); - - fd_desc =3D *argv++; - if (!fd_desc) errx(8,"need info after fd"); - - for (cli =3D classinfos; cli->name; cli++) - if (!strcmp(cli->name, classname)) - goto found; - report("fail","unknown class",""); - continue; - - found: - if (cli->check) { - report("checking","check","in progress"); - test_which =3D "check"; - cli->check(); - } else { - test_which =3D "open"; - report("checking","dup-hack","in progress"); - cli->open(); - - test_which =3D test_wh_unrest; cli->test(); - assert(!test_which); - - test_which =3D "getfd"; int intern_fd =3D cli->getfd(); - r =3D dup2(object_fd, intern_fd); - if (r !=3D intern_fd) err(-1, "dup2"); - - test_which =3D test_wh_rest; cli->test(); - assert(!test_which); - - test_which =3D "close"; cli->close(); - } - } - - return 0; -} --=20 2.39.5 From nobody Fri Oct 31 09:32:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1747774385; cv=none; d=zohomail.com; s=zohoarc; b=YrN1RAvQk7MEriJLAX5447HeBh+o065Xz18QSiYP/hx/obTxO5rtmdYVdFWrfyMKirN+lIYuIdNtNpP3yThLcItNlL1+hTUC4TzWvNv+zaD1LAcuLinIB2kqzuZf9Ccxwzf97E5oiOcj42wFMfG4UvGUtzJlwOdayOJEUqc2RX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747774385; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tYDHu2sNUHYKOZndg0ckJhy2AgiTG60/H+oM7p1zbrI=; b=ChG50tRgK41VVzn/nhVHHAsiGrZQhXSBl1+UImaxpYXt5nUkWBVeQsFUX4jImtG0pGKIDzFBZbsyvxe6uC9QoaX2QVekzT2sOXvW6XPFiYf1TI8s6w/l4U2QBmJqEIl0uXEBMiDO4+dwAHCvkc72m3r9xojPr8YX6Pmrp7J/FN8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1747774385586389.82799920296577; Tue, 20 May 2025 13:53:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.991133.1375055 (Exim 4.92) (envelope-from ) id 1uHTx9-0006ok-Qi; Tue, 20 May 2025 20:52:47 +0000 Received: by outflank-mailman (output) from mailman id 991133.1375055; Tue, 20 May 2025 20:52:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uHTx9-0006ob-M6; Tue, 20 May 2025 20:52:47 +0000 Received: by outflank-mailman (input) for mailman id 991133; Tue, 20 May 2025 20:52:46 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uHTx8-0006MJ-0A for xen-devel@lists.xenproject.org; Tue, 20 May 2025 20:52:46 +0000 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [2a00:1450:4864:20::42e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 60aad136-35bc-11f0-a2fa-13f23c93f187; Tue, 20 May 2025 22:52:44 +0200 (CEST) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3a36748920cso3388655f8f.2 for ; Tue, 20 May 2025 13:52:44 -0700 (PDT) Received: from localhost.localdomain (host-92-26-98-202.as13285.net. [92.26.98.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a3674fed67sm13346626f8f.89.2025.05.20.13.52.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 May 2025 13:52:43 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 60aad136-35bc-11f0-a2fa-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1747774363; x=1748379163; darn=lists.xenproject.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=tYDHu2sNUHYKOZndg0ckJhy2AgiTG60/H+oM7p1zbrI=; b=iDqy6fof3cPW6xIW0kMf6D2P7OTQ/TvdyOzjXzeJyg2R5knNy36RW59tWnYZ1vDmGU +PnkJcALYnA+eNKFul4/KJyrgfnx/zVmzy4yGYRbeL3Yz3/WIVwFwT+zbou+r8SgamRg UtVFs6t5/d6KFfSKEwnQyebaPsfqQ0py6Ehzw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747774363; x=1748379163; 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=tYDHu2sNUHYKOZndg0ckJhy2AgiTG60/H+oM7p1zbrI=; b=K+Y10e8I4LZCuvuz0ZEta3WUV1hH10lS/hHKfXSva5NrFK6IVRFXgTdfPy/AsPG8VO kDK0ouVBztaaKo9AFp5joRLwizz3b8p93dKpUkGWbgC3q+saU7HimCaZ/AcOnb7j474F 8u13omGPyzHDtkUFXEYjy4Ks92IgWOXYPiomon68h7Pr9V17zthK8wFJd35bdcXuHMOK 0TcpEUeWLZiOn0Fp3MDbwkKNwpwhvJOc4XlSu2MHQbSf59EGhSxs8wOLtlKB/lSBwl7a x8d7khOwPqnkhOhgYfRpZpWUF4Qm1Of9P7D4ywKzuP9cIVFrZni75qvGpprbWS6DRUzZ rN+g== X-Gm-Message-State: AOJu0Yzr0NCGcLneh8/ntzA4lg5m07OJgd6xhNj2YWr82NafE1dc1Ddo Z4GdwG6Ej7BxWYTncXkpcixWeR9/raGIRUK1FB6iUsE1mBKInM2oPRNWIM6CTrblvjMXSDRLIPl 2R47j X-Gm-Gg: ASbGncvWIYYzGlWJlJ+979HtIIW6fBi4B+TMcxGp6oMnD0VpeA8B8+33+q4uh6tkMOD Q1EY9a73kZFGzhYUIATPP6hZuo5DkZyEhOsS0CxIkOXWffNgAspq0hFpgLgfUDy2sZVJ4mxVodB Pm0qdJGxj/SnOJt9nwTNPbNg454MFXKajCyO8CxNc3RdiXxQXQFq7jmgjV4WvO4mo5pkkgv2e5H adLgCtBdo7RYsK7TQQTg1zp6K6d7pk9BchBdzhV/ke/EY7N2y+vkj444kwm6dr+Kn9D+pSAzusi hHeY+VvQ8MtBYab2MY2h1mPtaNcsRfF9tB8jTKwNURtv059Frp3RGGKInhzddPS1xqn2oL2nwhk /joIokarLPEqPfBLoThFgljJwAgdOPko0rTQ= X-Google-Smtp-Source: AGHT+IEm8qC0/Cw499LvGYeu6PTVrv6v4GMfM/V8kSQ0Tgoq7Ny42YSk/kZf0kJtD3FICrHJYPgKkA== X-Received: by 2002:a05:6000:4284:b0:3a2:244:67a4 with SMTP id ffacd0b85a97d-3a35ffd2acbmr14640201f8f.43.1747774363393; Tue, 20 May 2025 13:52:43 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Anthony PERARD , Stefano Stabellini , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Subject: [PATCH 2/3] tools/tests: Install tests into $(LIBEXEC)/tests Date: Tue, 20 May 2025 21:52:38 +0100 Message-Id: <20250520205239.203253-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250520205239.203253-1-andrew.cooper3@citrix.com> References: <20250520205239.203253-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1747774386304116600 $(LIBEXEC_BIN) is a dumping ground of many things. Separate the "clearly tests" from everything else so we can clean up how they're run in CI. Signed-off-by: Andrew Cooper Acked-by: Anthony PERARD Acked-by: Stefano Stabellini Reviewed-by: Denis Mukhin --- CC: Anthony PERARD CC: Stefano Stabellini CC: Marek Marczykowski-G=C3=B3recki --- tools/tests/cpu-policy/Makefile | 6 +++--- tools/tests/paging-mempool/Makefile | 6 +++--- tools/tests/rangeset/Makefile | 6 +++--- tools/tests/resource/Makefile | 6 +++--- tools/tests/tsx/Makefile | 6 +++--- tools/tests/xenstore/Makefile | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/tests/cpu-policy/Makefile b/tools/tests/cpu-policy/Makef= ile index 5df9b1ebbd7e..24f87e2eca2a 100644 --- a/tools/tests/cpu-policy/Makefile +++ b/tools/tests/cpu-policy/Makefile @@ -29,12 +29,12 @@ distclean: clean =20 .PHONY: install install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) - $(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN)) + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests + $(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC)/tests) =20 .PHONY: uninstall uninstall: - $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS)) + $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGETS)) =20 CFLAGS +=3D -D__XEN_TOOLS__ CFLAGS +=3D $(CFLAGS_xeninclude) diff --git a/tools/tests/paging-mempool/Makefile b/tools/tests/paging-mempo= ol/Makefile index a081b3baa514..a1e12584ce80 100644 --- a/tools/tests/paging-mempool/Makefile +++ b/tools/tests/paging-mempool/Makefile @@ -16,12 +16,12 @@ distclean: clean =20 .PHONY: install install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) - $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN) + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests + $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests =20 .PHONY: uninstall uninstall: - $(RM) -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET) + $(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET) =20 CFLAGS +=3D $(CFLAGS_xeninclude) CFLAGS +=3D $(CFLAGS_libxenctrl) diff --git a/tools/tests/rangeset/Makefile b/tools/tests/rangeset/Makefile index 3dafcbd0546c..e3bfce471cd3 100644 --- a/tools/tests/rangeset/Makefile +++ b/tools/tests/rangeset/Makefile @@ -20,12 +20,12 @@ distclean: clean =20 .PHONY: install install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) - $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN) + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests + $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests =20 .PHONY: uninstall uninstall: - $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGET)) + $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGET)) =20 list.h: $(XEN_ROOT)/xen/include/xen/list.h rangeset.h: $(XEN_ROOT)/xen/include/xen/rangeset.h diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile index a5856bf09590..09d678fffe3e 100644 --- a/tools/tests/resource/Makefile +++ b/tools/tests/resource/Makefile @@ -20,12 +20,12 @@ distclean: clean =20 .PHONY: install install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) - $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN) + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests + $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests =20 .PHONY: uninstall uninstall: - $(RM) -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET) + $(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET) =20 CFLAGS +=3D $(CFLAGS_xeninclude) CFLAGS +=3D $(CFLAGS_libxenctrl) diff --git a/tools/tests/tsx/Makefile b/tools/tests/tsx/Makefile index a4f516b72597..0bb7e7010347 100644 --- a/tools/tests/tsx/Makefile +++ b/tools/tests/tsx/Makefile @@ -16,12 +16,12 @@ distclean: clean =20 .PHONY: install install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) - $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN) + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests + $(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC)/tests =20 .PHONY: uninstall uninstall: - $(RM) -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET) + $(RM) -- $(DESTDIR)$(LIBEXEC)/tests/$(TARGET) =20 .PHONY: uninstall uninstall: diff --git a/tools/tests/xenstore/Makefile b/tools/tests/xenstore/Makefile index 202dda0d3c23..2ee4a1327e75 100644 --- a/tools/tests/xenstore/Makefile +++ b/tools/tests/xenstore/Makefile @@ -20,12 +20,12 @@ distclean: clean =20 .PHONY: install install: all - $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) - $(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN)) + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)/tests + $(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC)/tests) =20 .PHONY: uninstall uninstall: - $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS)) + $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC)/tests/,$(TARGETS)) =20 CFLAGS +=3D $(CFLAGS_libxenstore) CFLAGS +=3D $(APPEND_CFLAGS) --=20 2.39.5 From nobody Fri Oct 31 09:32:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1747774394; cv=none; d=zohomail.com; s=zohoarc; b=f5jJj73rmvLeIpJghto7zv7jJ1tVBVLSaN2g5X/XUDZPAePRIZbqev/K8RCz57gSHa0l4DZf/M/6xB7gyUshffn8+vpaxssey9x5MV1BQyli+y15UGdypN/l9VAUFjLOtKjjeCNzQKUdYUK/DA9GFML1uH2sRc+S0Wo9d2q9GG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747774394; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QfhsUGiiQGKcqNXvuoCj4gQfcfj05NuHnllW0lUrwak=; b=A1QMLnLq/Nid0DNs8PK6tMoLqNf8cxq17TlhWDqJj2I+hyDcJVCFZkfmXsYvMmzfUPZ7KKRsfa3m01vk4hrnq/ptJNnaCMUSd/mxkKbLrrXoQTDdy+6ST/qFfpBklr1+R3cNOq4AmmWR2aDbaMmNZH+xs2Q5kgEsHwE5Gap++E0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1747774394783107.26152766271855; Tue, 20 May 2025 13:53:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.991134.1375061 (Exim 4.92) (envelope-from ) id 1uHTxA-0006rY-42; Tue, 20 May 2025 20:52:48 +0000 Received: by outflank-mailman (output) from mailman id 991134.1375061; Tue, 20 May 2025 20:52:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uHTx9-0006qk-TD; Tue, 20 May 2025 20:52:47 +0000 Received: by outflank-mailman (input) for mailman id 991134; Tue, 20 May 2025 20:52:47 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uHTx9-0006hP-90 for xen-devel@lists.xenproject.org; Tue, 20 May 2025 20:52:47 +0000 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [2a00:1450:4864:20::433]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 612c3e36-35bc-11f0-b892-0df219b8e170; Tue, 20 May 2025 22:52:45 +0200 (CEST) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3a36efcadb8so2140590f8f.0 for ; Tue, 20 May 2025 13:52:45 -0700 (PDT) Received: from localhost.localdomain (host-92-26-98-202.as13285.net. [92.26.98.202]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a3674fed67sm13346626f8f.89.2025.05.20.13.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 May 2025 13:52:43 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 612c3e36-35bc-11f0-b892-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1747774364; x=1748379164; darn=lists.xenproject.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=QfhsUGiiQGKcqNXvuoCj4gQfcfj05NuHnllW0lUrwak=; b=sVx8AfwfaAV9Pr26TRafSsqLLvLS0Ugl8OPqPxMjY8eZgk0Sm12jhYhnhOqFN/OPQU O1rPC40/dapnd4HKI6JID+MqO8wJHG9Up4rErDPnqN8OgAgAjPIW4PsOafn+6hyltcrA xYnf2pyBhBkioDpwieUPMlb++h0u1gJcNF3J4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747774364; x=1748379164; 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=QfhsUGiiQGKcqNXvuoCj4gQfcfj05NuHnllW0lUrwak=; b=i4+Y9sl6Huir9D19Vl48kGKNv6H0bXmWGP/R5Xaf1/xcq9kjxA9KVzK4T9EZBSqAYf vv10kEdytW9GxsuorIznQMVi9vRIVaLOxlQ0IaWpIT1TWmw+1rl0Imhi7kQCnwY2FOZx BPD7hP20X/MABkpFGgGvXxp+h89dWccB5GeiADLfvZgHtWmvjOr5vTcleczXe/YKHOo/ 25MzqG+m29e77YHb4bkZ6QIzwxQU3mYAFMya3xAfIlF1E32TVgWl9x2cTBqrKFOVsLru w+Z4dTCTbjow2Uh71ro93DAudyLNFKWbXuAMA/F9/by8PgQekgk7BaXEXYFLxCz9AQN/ /t/Q== X-Gm-Message-State: AOJu0YyhOyeouSg9T7DMjYBZbDjoK8CTT1QKPrUWQ3UA4f135ztGpmjp Vbztu4nrdLs3sTPV6reowg2u0dTqpL4FyAgxUAPRaEB0CfCQKktl/346q7UzGKPEyH/0u8v1pdE 1b/dt X-Gm-Gg: ASbGncuqtEVGPRNz58midjjozcB1hK6sf5F/u7/jW9QzGcMYWXc1sx3piPuT5t/1yCv oZ3FXSeEEXhTfng21VEfd7o8xrQIbKirQPlo8DqwOgIjpSyaWqWh28UuUD/K5IcjnDmwoGzpQ7N BeqD8+z0LfCuwDIJ4eq2U2RqZhQ5ONNBzKyr1MnZFusjObWhTIkqX9PEEkkiheWSIrzpud1E29w fpZnlw+dfitvcNzyZyiOc/eLAvvXZBfCzp3mPJ8NuPmhHZvAyItvsX6AsSuuVLTyUgofBVD+WAU abYd+txGdCtlQ2bA5iiAjVIo9tZjsKkO5hIZpFHwet7UllPeSrV2Qs217SnGNkjnhH5RbBVhK1x I36PxkR4ZlHbE67ZrrA33SiYt X-Google-Smtp-Source: AGHT+IHZzkHzMWJczmaSAVLmaheYUXHfYvPj47cipkwBJABK0sJZa5J9y+KNAjZkNCfUlFKBK2hxfA== X-Received: by 2002:a05:6000:1846:b0:38f:4d20:4a17 with SMTP id ffacd0b85a97d-3a35c8218b5mr14937603f8f.13.1747774364176; Tue, 20 May 2025 13:52:44 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Anthony PERARD , Stefano Stabellini , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Subject: [PATCH 3/3] CI: Drop custom handling of tools/tests Date: Tue, 20 May 2025 21:52:39 +0100 Message-Id: <20250520205239.203253-4-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250520205239.203253-1-andrew.cooper3@citrix.com> References: <20250520205239.203253-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1747774396764116600 ... and use them from their installed location. The full recusive copy of tools/tests brings in all build and intermediate artefacts. e.g. for test-tsx alone: ./tests/tsx ./tests/tsx/.test-tsx.o.d ./tests/tsx/test-tsx.o ./tests/tsx/.gitignore ./tests/tsx/test-tsx ./tests/tsx/Makefile ./tests/tsx/test-tsx.c duplicating the test binary which is also in ./usr/lib/xen/tests Rewrite run-tools-tests to run tests from their installed location (/usr/lib/xen/tests in alpine), which effectively removes the outer loop over $dir. No practical change. Signed-off-by: Andrew Cooper Reviewed-by: Anthony PERARD Reviewed-by: Denis Mukhin Reviewed-by: Stefano Stabellini --- CC: Anthony PERARD CC: Stefano Stabellini CC: Marek Marczykowski-G=C3=B3recki This doesn't change any tests that run, although in the XML we get two fewe= r skips. Both skips can be fixed by giving vpci and x86_emulator some install targets --- automation/scripts/build | 1 - automation/scripts/qubes-x86-64.sh | 7 +++-- automation/scripts/run-tools-tests | 43 +++++++++++++----------------- 3 files changed, 22 insertions(+), 29 deletions(-) diff --git a/automation/scripts/build b/automation/scripts/build index cdb8cd7c722b..0e7494ff6d87 100755 --- a/automation/scripts/build +++ b/automation/scripts/build @@ -109,6 +109,5 @@ else # even though dist/ contains everything, while some containers don't e= ven # build Xen (cd dist/install; find | cpio -o -H newc | gzip) > binaries/xen-tools.= cpio.gz - cp -r tools/tests binaries/ collect_xen_artefacts fi diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-= x86-64.sh index aa47ba6bf5c0..577a00238a75 100755 --- a/automation/scripts/qubes-x86-64.sh +++ b/automation/scripts/qubes-x86-64.sh @@ -136,7 +136,7 @@ done passed=3D"test passed" domU_check=3D"" dom0_check=3D" -/tests/run-tools-tests /tests /tmp/tests-junit.xml && echo \"${passed}\" +/root/run-tools-tests /usr/lib/xen/tests /tmp/tests-junit.xml && echo \"${= passed}\" nc -l -p 8080 < /tmp/tests-junit.xml >/dev/null & " if [ "${test_variant}" =3D "tools-tests-pvh" ]; then @@ -195,9 +195,8 @@ cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.= cpio.gz # test-local configuration mkdir -p rootfs cd rootfs -mkdir -p boot etc/local.d -cp -ar ../binaries/tests . -cp -a ../automation/scripts/run-tools-tests tests/ +mkdir -p boot etc/local.d root +cp -a ../automation/scripts/run-tools-tests root/ =20 echo "#!/bin/bash =20 diff --git a/automation/scripts/run-tools-tests b/automation/scripts/run-to= ols-tests index 770e97c3e943..8d7aa8fa5140 100755 --- a/automation/scripts/run-tools-tests +++ b/automation/scripts/run-tools-tests @@ -12,30 +12,25 @@ printf '\n' >= "$xml_out" printf '\n' >> "$xml_out" printf ' \n' >> "$xml_out" failed=3D -for dir in "$1"/*; do - [ -d "$dir" ] || continue - echo "Running test in $dir" - printf ' \n' "$dir" >> "$xml_out" - ret=3D - for f in "$dir"/*; do - [ -f "$f" ] || continue - [ -x "$f" ] || continue - "$f" 2>&1 | tee /tmp/out - ret=3D$? - if [ "$ret" -ne 0 ]; then - echo "FAILED: $ret" - failed+=3D" $dir" - printf ' \n' "$f" "$ret" >> "$xml_out" - # TODO: could use xml escaping... but current tests seems to - # produce sane output - cat /tmp/out >> "$xml_out" - printf ' \n' >> "$xml_out" - else - echo "PASSED" - fi - done - if [ -z "$ret" ]; then - printf ' \n' "$dir" >> "$xml_out" +for f in "$1"/*; do + if [ -x "$f" ]; then + echo "SKIP: $f not executable" + continue + fi + echo "Running $f" + printf ' \n' "$f" >> "$xml_out" + "$f" 2>&1 | tee /tmp/out + ret=3D$? + if [ "$ret" -ne 0 ]; then + echo "FAILED: $f" + failed+=3D" $f" + printf ' \n' "$f" "$ret" >> "$xml_out" + # TODO: could use xml escaping... but current tests seems to + # produce sane output + cat /tmp/out >> "$xml_out" + printf ' \n' >> "$xml_out" + else + echo "PASSED" fi printf ' \n' >> "$xml_out" done --=20 2.39.5