From nobody Mon Feb 9 13:00:56 2026 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35C72365A1A for ; Thu, 29 Jan 2026 21:25:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769721960; cv=none; b=oVAwcPF3dCK65XAocc6kINMGSOtlWr0MFk2yzY01X5m0B+t78BYruKRG+9syyvQDkhTrNU2ZZGeiVZJY7XjVBha5Afcsytxn1Xn4FB+Hfsw2O3FxQ13jjvG7llSIU8xHOiGH/6y93GWSoKqPQ4yBb6Uoye7SrcCfE1JZ47C4nKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769721960; c=relaxed/simple; bh=iPn4pDoAWI4g0pJVI1rNQDofz3/2KTtO9Jp6Bq5j67U=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=bY2gTmeZEb/mQJ/0GVNOZRI13eT/8EpxiNAYHQILzDZe2NoyBPP1nVJz/a2QB1Khw40z30GPz4rEL1yVMmnEygLOMfvd/9ebfPOVXxvkkoaXPUTF89SzXg5YF/aiDw+MEBwD9d8cY60hjMzB7LE4ndwKFZwr7pdnX7BEGPzHqgY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uVO572HN; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uVO572HN" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2a0e952f153so35451925ad.0 for ; Thu, 29 Jan 2026 13:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1769721957; x=1770326757; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Hp3td6uMAaTZjQV6oFbLUGjv1pGfeS9Cq/BNEG9/dt4=; b=uVO572HNSVbXcjicVqxDYowjIz5A9b59NGNJ+BCwmCK0ahnq3H1IveFLIpPu11cvP7 GUKLuRDJUc+OLeV90GvSJNsEi8TAYJIAiekIsYt792Yy5IvT/XVjbV+gEpoDR8f5Sgew 850JkkjK80jrKuP0jOp2Nc0Kc1Hef6GMe/CY3/1wfypAwSNJ5r6ZuLlNzCcZw1WVgqby 4rMY7zUXrzdyONw7+UXRaj9kbxVAo9owhDydPIo1hC3Yl2kOodmLAEf4I8LNbMwWQAIZ v+EefPJ/DFr+iPMaPkweKnngU6MiIY+FmXIfW2/3y8BICRLbeyBvBkz7HNmoC4KnqTzR QT2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769721957; x=1770326757; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Hp3td6uMAaTZjQV6oFbLUGjv1pGfeS9Cq/BNEG9/dt4=; b=EO0m5V3i3kLGAVlFD7Q1BHEi25Vv8RkmosjbQj2mP+ReQyCkDgPaMVIuJO+5vp5CCB 4f1z9/lPJrjJu9mNRLcQdUEfrorR/VHLHCf4jtGakr0lUdEEYmLHGFofei576I1yuJ6J NE65lf4Ej8ImvYGsOEi6USc7zucjQqZEz4k4L8V3qtWXoM3C2ka4TOXOlk8v9pTID44p uCuuIMC+DQ9B36xtSCOOkoqTG0eJCk+AJ19GQJAWMavNq0x42LVgmPyUBjbWTp74jiMv H5LtwYDwusSuGRJAAYK6J5Ajj+uwHGtdYdn69hI3bWAsNib80nr4KHzw0S0tPrPHFNBe w7aw== X-Forwarded-Encrypted: i=1; AJvYcCX5at5UhBSBVamMqzeRwVBE7NDCCTCVqfb3DxuRo/mAqT4SE6a/o2f0TJfiwQsX2mFBbGXchZt6sSE8tR0=@vger.kernel.org X-Gm-Message-State: AOJu0YxXwKtC2PQF1sLvIpEa/NgWHPtHJHEhzmYmV3RErO2VBp/5PeZv mScOj8nqXa7Pf2NPnwSNsCCw4iCYDO9IDd/s0Mdn1ykoRmZaVvvLp6etzmfXKVmyZWZ+KKNsfAn izgqa+vw8Df+bkw== X-Received: from plgb8.prod.google.com ([2002:a17:902:d508:b0:295:50ce:4dd]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:388e:b0:295:596f:8507 with SMTP id d9443c01a7336-2a8d89464b3mr6954275ad.0.1769721957393; Thu, 29 Jan 2026 13:25:57 -0800 (PST) Date: Thu, 29 Jan 2026 21:24:59 +0000 In-Reply-To: <20260129212510.967611-1-dmatlack@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260129212510.967611-1-dmatlack@google.com> X-Mailer: git-send-email 2.53.0.rc1.225.gd81095ad13-goog Message-ID: <20260129212510.967611-13-dmatlack@google.com> Subject: [PATCH v2 12/22] selftests/liveupdate: Move luo_test_utils.* into a reusable library From: David Matlack To: Alex Williamson Cc: Adithya Jayachandran , Alexander Graf , Alex Mastro , Alistair Popple , Andrew Morton , Ankit Agrawal , Bjorn Helgaas , Chris Li , David Matlack , David Rientjes , Jacob Pan , Jason Gunthorpe , Jason Gunthorpe , Jonathan Corbet , Josh Hilke , Kevin Tian , kexec@lists.infradead.org, kvm@vger.kernel.org, Leon Romanovsky , Leon Romanovsky , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, Lukas Wunner , "=?UTF-8?q?Micha=C5=82=20Winiarski?=" , Mike Rapoport , Parav Pandit , Pasha Tatashin , Pranjal Shrivastava , Pratyush Yadav , Raghavendra Rao Ananta , Rodrigo Vivi , Saeed Mahameed , Samiullah Khawaja , Shuah Khan , "=?UTF-8?q?Thomas=20Hellstr=C3=B6m?=" , Tomita Moeko , Vipin Sharma , Vivek Kasireddy , William Tu , Yi Liu , Zhu Yanjun Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Vipin Sharma Move luo_test_utils.[ch] into a lib/ directory and pull the rules to build them out into a separate make script. This will enable these utilities to be also built by and used within other selftests (such as VFIO) in subsequent commits. No functional change intended. Signed-off-by: Vipin Sharma Co-developed-by: David Matlack Signed-off-by: David Matlack --- tools/testing/selftests/liveupdate/.gitignore | 1 + tools/testing/selftests/liveupdate/Makefile | 14 ++++--------- .../include/libliveupdate.h} | 8 ++++---- .../selftests/liveupdate/lib/libliveupdate.mk | 20 +++++++++++++++++++ .../{luo_test_utils.c =3D> lib/liveupdate.c} | 2 +- .../selftests/liveupdate/luo_kexec_simple.c | 2 +- .../selftests/liveupdate/luo_multi_session.c | 2 +- 7 files changed, 32 insertions(+), 17 deletions(-) rename tools/testing/selftests/liveupdate/{luo_test_utils.h =3D> lib/inclu= de/libliveupdate.h} (87%) create mode 100644 tools/testing/selftests/liveupdate/lib/libliveupdate.mk rename tools/testing/selftests/liveupdate/{luo_test_utils.c =3D> lib/liveu= pdate.c} (99%) diff --git a/tools/testing/selftests/liveupdate/.gitignore b/tools/testing/= selftests/liveupdate/.gitignore index 661827083ab6..18a0c7036cf3 100644 --- a/tools/testing/selftests/liveupdate/.gitignore +++ b/tools/testing/selftests/liveupdate/.gitignore @@ -3,6 +3,7 @@ !/**/ !*.c !*.h +!*.mk !*.sh !.gitignore !config diff --git a/tools/testing/selftests/liveupdate/Makefile b/tools/testing/se= lftests/liveupdate/Makefile index 080754787ede..a060cc21f27f 100644 --- a/tools/testing/selftests/liveupdate/Makefile +++ b/tools/testing/selftests/liveupdate/Makefile @@ -1,7 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only =20 -LIB_C +=3D luo_test_utils.c - TEST_GEN_PROGS +=3D liveupdate =20 TEST_GEN_PROGS_EXTENDED +=3D luo_kexec_simple @@ -10,25 +8,21 @@ TEST_GEN_PROGS_EXTENDED +=3D luo_multi_session TEST_FILES +=3D do_kexec.sh =20 include ../lib.mk +include lib/libliveupdate.mk =20 CFLAGS +=3D $(KHDR_INCLUDES) CFLAGS +=3D -Wall -O2 -Wno-unused-function CFLAGS +=3D -MD =20 -LIB_O :=3D $(patsubst %.c, $(OUTPUT)/%.o, $(LIB_C)) TEST_O :=3D $(patsubst %, %.o, $(TEST_GEN_PROGS)) TEST_O +=3D $(patsubst %, %.o, $(TEST_GEN_PROGS_EXTENDED)) =20 -TEST_DEP_FILES :=3D $(patsubst %.o, %.d, $(LIB_O)) +TEST_DEP_FILES :=3D $(patsubst %.o, %.d, $(LIBLIVEUPDATE_O)) TEST_DEP_FILES +=3D $(patsubst %.o, %.d, $(TEST_O)) -include $(TEST_DEP_FILES) =20 -$(LIB_O): $(OUTPUT)/%.o: %.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ - -$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/%: %.o $(LIB_O) - $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $< $(LIB_O) $(LDLIB= S) -o $@ +$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/%: %.o $(LIBLIVEUP= DATE_O) + $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $< $(LIBLIVEUPDATE_= O) $(LDLIBS) -o $@ =20 -EXTRA_CLEAN +=3D $(LIB_O) EXTRA_CLEAN +=3D $(TEST_O) EXTRA_CLEAN +=3D $(TEST_DEP_FILES) diff --git a/tools/testing/selftests/liveupdate/luo_test_utils.h b/tools/te= sting/selftests/liveupdate/lib/include/libliveupdate.h similarity index 87% rename from tools/testing/selftests/liveupdate/luo_test_utils.h rename to tools/testing/selftests/liveupdate/lib/include/libliveupdate.h index 90099bf49577..4390a2737930 100644 --- a/tools/testing/selftests/liveupdate/luo_test_utils.h +++ b/tools/testing/selftests/liveupdate/lib/include/libliveupdate.h @@ -7,13 +7,13 @@ * Utility functions for LUO kselftests. */ =20 -#ifndef LUO_TEST_UTILS_H -#define LUO_TEST_UTILS_H +#ifndef SELFTESTS_LIVEUPDATE_LIB_LIVEUPDATE_H +#define SELFTESTS_LIVEUPDATE_LIB_LIVEUPDATE_H =20 #include #include #include -#include "../kselftest.h" +#include "../../../kselftest.h" =20 #define LUO_DEVICE "/dev/liveupdate" =20 @@ -41,4 +41,4 @@ typedef void (*luo_test_stage2_fn)(int luo_fd, int state_= session_fd); int luo_test(int argc, char *argv[], const char *state_session_name, luo_test_stage1_fn stage1, luo_test_stage2_fn stage2); =20 -#endif /* LUO_TEST_UTILS_H */ +#endif /* SELFTESTS_LIVEUPDATE_LIB_LIVEUPDATE_H */ diff --git a/tools/testing/selftests/liveupdate/lib/libliveupdate.mk b/tool= s/testing/selftests/liveupdate/lib/libliveupdate.mk new file mode 100644 index 000000000000..fffd95b085b6 --- /dev/null +++ b/tools/testing/selftests/liveupdate/lib/libliveupdate.mk @@ -0,0 +1,20 @@ +include $(top_srcdir)/scripts/subarch.include +ARCH ?=3D $(SUBARCH) + +LIBLIVEUPDATE_SRCDIR :=3D $(selfdir)/liveupdate/lib + +LIBLIVEUPDATE_C :=3D liveupdate.c + +LIBLIVEUPDATE_OUTPUT :=3D $(OUTPUT)/libliveupdate + +LIBLIVEUPDATE_O :=3D $(patsubst %.c, $(LIBLIVEUPDATE_OUTPUT)/%.o, $(LIBLIV= EUPDATE_C)) + +LIBLIVEUPDATE_O_DIRS :=3D $(shell dirname $(LIBLIVEUPDATE_O) | uniq) +$(shell mkdir -p $(LIBLIVEUPDATE_O_DIRS)) + +CFLAGS +=3D -I$(LIBLIVEUPDATE_SRCDIR)/include + +$(LIBLIVEUPDATE_O): $(LIBLIVEUPDATE_OUTPUT)/%.o : $(LIBLIVEUPDATE_SRCDIR)/= %.c + $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@ + +EXTRA_CLEAN +=3D $(LIBLIVEUPDATE_OUTPUT) diff --git a/tools/testing/selftests/liveupdate/luo_test_utils.c b/tools/te= sting/selftests/liveupdate/lib/liveupdate.c similarity index 99% rename from tools/testing/selftests/liveupdate/luo_test_utils.c rename to tools/testing/selftests/liveupdate/lib/liveupdate.c index 3c8721c505df..60121873f685 100644 --- a/tools/testing/selftests/liveupdate/luo_test_utils.c +++ b/tools/testing/selftests/liveupdate/lib/liveupdate.c @@ -21,7 +21,7 @@ #include #include =20 -#include "luo_test_utils.h" +#include =20 int luo_open_device(void) { diff --git a/tools/testing/selftests/liveupdate/luo_kexec_simple.c b/tools/= testing/selftests/liveupdate/luo_kexec_simple.c index d7ac1f3dc4cb..786ac93b9ae3 100644 --- a/tools/testing/selftests/liveupdate/luo_kexec_simple.c +++ b/tools/testing/selftests/liveupdate/luo_kexec_simple.c @@ -8,7 +8,7 @@ * across a single kexec reboot. */ =20 -#include "luo_test_utils.h" +#include =20 #define TEST_SESSION_NAME "test-session" #define TEST_MEMFD_TOKEN 0x1A diff --git a/tools/testing/selftests/liveupdate/luo_multi_session.c b/tools= /testing/selftests/liveupdate/luo_multi_session.c index 0ee2d795beef..aac24a5f5ce3 100644 --- a/tools/testing/selftests/liveupdate/luo_multi_session.c +++ b/tools/testing/selftests/liveupdate/luo_multi_session.c @@ -9,7 +9,7 @@ * files. */ =20 -#include "luo_test_utils.h" +#include =20 #define SESSION_EMPTY_1 "multi-test-empty-1" #define SESSION_EMPTY_2 "multi-test-empty-2" --=20 2.53.0.rc1.225.gd81095ad13-goog