Received: by 10.213.65.68 with SMTP id h4csp791154imn; Wed, 28 Mar 2018 12:51:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/GDcaO6pp+LoOznEFc9nRUHTs+AAFHR9VFxPsVMeZqvKmVQgJIT/PTtofuZkalrFacMV6H X-Received: by 2002:a17:902:2e:: with SMTP id 43-v6mr5111757pla.282.1522266671776; Wed, 28 Mar 2018 12:51:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522266671; cv=none; d=google.com; s=arc-20160816; b=g7Ht/oZAG2CZxfNtRUUYOsJ8H422C5XLlesx3/mFxoUPd43TyapUZxmu3m9hi7uvZC STEpATL6Toep41LJ/QUJSMFapGH0i4dDnCUZpJSDWWHGsIcHWpX2oG/aFvElG3bQN4UM 8quHt0t4hec/LbaMhF2k+YDZfD4mWH/p84k1fBgFYAtn6bpYwAF/e7BXM6CYQ4bO2m3V ZxPpzRO/90lZs3Q2FjyxS+QI/RjZGpJ/fALrYRQSVVEdjpd5o7hdQLjPm0RcfKVNguI/ El6LDczqGTutiFWJMw2w6PIMci5JgYfZCxPHy7rsJvdHut4mGoeUqP6NtQuaDvmOETbd saEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :arc-authentication-results; bh=KPDqRNkdwzDx8KnZrkqqW/o+6l/L5Ye8S9M24dHyu5A=; b=dOa0YGBQdXEWyXXS5Kr+25B6NBuHNcAcvLpnSTu7dlv5qhbXZ741LdjuOJLF4Y8yAa D1n1ww+yzsztUADl8bwvk8DMMU0een26MCdGtIivcKlsCFwzzHZnUFRCpd5bz6KbpP8r cUN2ZP5H76H1+K758GEXhvt8rN42d/euWsDaGcnYLPWqCRXftjGfwTacD1tY4HlSIZqr ruwWaIx+apk2FYxi7XjLQSq4Su4/o46UL1SyRFWd+PzmgSUut1QNyHAZnyQ/XzdKzLDc ebs16Z+G5ec2ezwFCNLT7sxgZZIcyMUgnekwImtMGlz5REsyNKUJVOjzD52WoYOKViOJ EJiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si2896364pgp.351.2018.03.28.12.50.56; Wed, 28 Mar 2018 12:51:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753376AbeC1Ttx (ORCPT + 99 others); Wed, 28 Mar 2018 15:49:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50200 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753290AbeC1Ttv (ORCPT ); Wed, 28 Mar 2018 15:49:51 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 573738424D; Wed, 28 Mar 2018 19:49:51 +0000 (UTC) Received: from jlaw-desktop.bos.com (dhcp-17-208.bos.redhat.com [10.18.17.208]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3939E2026DFD; Wed, 28 Mar 2018 19:49:51 +0000 (UTC) From: Joe Lawrence To: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] Add livepatch kselftests Date: Wed, 28 Mar 2018 15:49:47 -0400 Message-Id: <1522266588-11806-1-git-send-email-joe.lawrence@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 28 Mar 2018 19:49:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 28 Mar 2018 19:49:51 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'joe.lawrence@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, This patch was motivated by the increasing corner cases in the livepatch code. These tests don't cover anywhere near all of them, but were mostly already written up as demonstrations / documentation of the livepatch callback functionality. Converting them into a test rig didn't take long. So the testing methodology is a little hokey as it relies on dmesg order and filtering. That said, it's already been used to verify livepatch callback for "livepatch: Atomic replace feature" patchset. Any suggestions for better testing would be welcome. I didn't get to the shadow variable testing script yet. I figured that I'd share the current state before I got too far along in writing tests. Suggestions for additional tests and test categories welcome as well. To try out the tests, configure with: CONFIG_TEST_LIVEPATCH=m Build kernel, modules, install, etc. then reboot and kick off: % make -C tools/testing/selftests TARGETS=livepatch run_tests The tests expect to on top of v10+ of the "livepatch: Atomic replace feature" series and take ~2.5 minutes to complete. rfc changes: - SPDX-License-Identifiers - Moved livepatch test modules into lib/livepatch - Renamed livepatch.sh (filename suffix) - Reduced between-test delay time - Split off common functions.sh file - Split into separate livepatch, callbacks, and shadow-vars scrips - Gave the tests short descriptions instead of TEST1, TEST2, etc. Joe Lawrence (1): selftests/livepatch: introduce tests lib/Kconfig.debug | 12 + lib/Makefile | 2 + lib/livepatch/Makefile | 18 + lib/livepatch/test_klp_atomic_replace.c | 69 +++ lib/livepatch/test_klp_callbacks_busy.c | 43 ++ lib/livepatch/test_klp_callbacks_demo.c | 132 ++++++ lib/livepatch/test_klp_callbacks_demo2.c | 104 ++++ lib/livepatch/test_klp_callbacks_mod.c | 24 + lib/livepatch/test_klp_livepatch.c | 62 +++ tools/testing/selftests/Makefile | 1 + tools/testing/selftests/livepatch/Makefile | 8 + tools/testing/selftests/livepatch/config | 1 + tools/testing/selftests/livepatch/functions.sh | 202 ++++++++ .../testing/selftests/livepatch/test-callbacks.sh | 526 +++++++++++++++++++++ .../testing/selftests/livepatch/test-livepatch.sh | 177 +++++++ .../selftests/livepatch/test-shadow-vars.sh | 13 + 16 files changed, 1394 insertions(+) create mode 100644 lib/livepatch/Makefile create mode 100644 lib/livepatch/test_klp_atomic_replace.c create mode 100644 lib/livepatch/test_klp_callbacks_busy.c create mode 100644 lib/livepatch/test_klp_callbacks_demo.c create mode 100644 lib/livepatch/test_klp_callbacks_demo2.c create mode 100644 lib/livepatch/test_klp_callbacks_mod.c create mode 100644 lib/livepatch/test_klp_livepatch.c create mode 100644 tools/testing/selftests/livepatch/Makefile create mode 100644 tools/testing/selftests/livepatch/config create mode 100644 tools/testing/selftests/livepatch/functions.sh create mode 100755 tools/testing/selftests/livepatch/test-callbacks.sh create mode 100755 tools/testing/selftests/livepatch/test-livepatch.sh create mode 100755 tools/testing/selftests/livepatch/test-shadow-vars.sh -- 1.8.3.1