From nobody Wed Apr 22 08:19:47 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4g0sb75b8mz6bkCl for ; Wed, 22 Apr 2026 08:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g0sb74M9sz3cyq for ; Wed, 22 Apr 2026 08:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776845987; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lo19Wh9vuec8T7qYL7o+TAAI7yUMclqSLB7DCSQzl4A=; b=xPME9uNJdIB9dZ7FsrpdCnbj48je1VS8aurvWzqlyVyUr+FwMK5oBELR1407it57byFi5U HXE2vv3o9t6PaUp4/XRTi0IBjjwwFFhVS8FSKDiU931IxqT59AYS05Qkyr7Wuqd2N9EBdb TzG6BsncxZyKLpj5rWVfS9e/hjSHh/7VItfF1psK0Dhr7cTaI6SHK8rZuVuZrB5dOQM8Ow 8zhTBhbs8sQtBVkhY9/vJX4QCCDmeOncAi0rIei4jrxjB1VpY3oGvxO9yxEK8aXSrDc9rk /e/JrYFPV/84+d0YCaJWmGf/0ZMgXAVkYWzHaUuRhn8I/pDqcFEfG7w1cDuzFg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776845987; a=rsa-sha256; cv=none; b=FGg29Er7mzOTw6ub8YH61AMt0Ksdh889h39eHekNsFGz5Q1yPSyCiy1AeJVDJXKS8L74PO EhwB9s7UzcQzEidvYIKuf2CNa2PIg4FwWzM7hhu+vYXNNPDkdfbzcvuMC4VaRaGeJNh5QT V7PPea+iDHHdNDg2tbJLtI/Y8ccd3Jy3HShHK7qVyidXvSdloWz1ggX2I9k5Mxr8EK1iX5 iwQGVEk2xkZqAPacoIhiMgacERAqTUNF5bLeaixnygbwTYPcKt7cjOkNKoOU65pt+4Y8VO oj68EAdiDZHaqsft/O6G0PSfEjfyMxZgVfFSHSE52KU+VGz1Fx+2Q1Ke/mxnQQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776845987; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lo19Wh9vuec8T7qYL7o+TAAI7yUMclqSLB7DCSQzl4A=; b=LL38F6PDAghHaoN2dXHS/S6DSwtfH5fq0hImikgcv4uhkEl+0gfB4cUD0ZSaz9ZQ6EKxPL 9hZslEeAUs5LZLYJIqk5VJ3khloOIEKT+NmAbV6zPDgClDaWlIClXXyZYCRzHBwQHFx2jh yA+ZUvtB3dXyshYwVQeFFFPxNiHGZAseITelyTnX/aRvRjwDeHQ/Jlnpt/m0/5SpT18nNY lM50duMRQIw4rwQIntqdEICgb8uSFibrocC16ZwX0vq2Tks6gCJL7qz5KpOpbRcioPtLF9 ymr1ZvRM4Syf0Qe8kyUtBPKpPh6F5QhLKcqiYzSHKdzCd28zmBaDozYzAR2e0w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g0sb73hJ4z6dc for ; Wed, 22 Apr 2026 08:19:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 25a45 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 22 Apr 2026 08:19:47 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav Subject: git: 3d00db6b8b73 - main - tests.7: Provide better examples List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d00db6b8b73ef7f89654a2928d247d62d39ee29 Auto-Submitted: auto-generated Date: Wed, 22 Apr 2026 08:19:47 +0000 Message-Id: <69e884a3.25a45.60151f73@gitrepo.freebsd.org> The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=3d00db6b8b73ef7f89654a2928d247d62d39ee29 commit 3d00db6b8b73ef7f89654a2928d247d62d39ee29 Author: Dag-Erling Smørgrav AuthorDate: 2026-04-22 08:19:32 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2026-04-22 08:19:32 +0000 tests.7: Provide better examples Previous authors appear to have prioritized brevity over clarity. This unfortunately resulted in a manual page that left its reader with the false impression that Kyua is difficult to use. Attempt to correct this by providing more and simpler examples with longer explanations. While here, correct outdated information about where Kyua stores its logs and results. MFC after: 1 week Reviewed by: ziaee, ngie Differential Revision: https://reviews.freebsd.org/D56475 --- share/man/man7/tests.7 | 102 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 89 insertions(+), 13 deletions(-) diff --git a/share/man/man7/tests.7 b/share/man/man7/tests.7 index 61b0789b9149..97cc6beba4dc 100644 --- a/share/man/man7/tests.7 +++ b/share/man/man7/tests.7 @@ -25,7 +25,7 @@ .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd April 1, 2025 +.Dd April 17, 2026 .Dt TESTS 7 .Os .Sh NAME @@ -97,37 +97,107 @@ third-party packages or manual modifications to configuration files) do not introduce unexpected failures. .El .Ss Running the tests -Use the following command to run the whole test suite: +By default, Kyua looks for tests in the current directory. +To run the whole test suite, either use the +.Fl k +option to specify the top-level +.Pa Kyuafile : .Bd -literal -offset indent $ kyua test -k /usr/tests/Kyuafile .Ed .Pp +or just change to the test suite root before running Kyua: +.Bd -literal -offset indent +$ cd /usr/tests +$ kyua test +.Ed +.Pp The above will iterate through all test programs in .Pa /usr/tests recursively, execute them, store their results and debugging data in Kyua's database (by default in -.Pa ~/.kyua/store.db ) , +.Pa ~/.kyua/store/ ) , and print a summary of the results. This summary includes a brief count of all total tests run and how many of them failed. .Pp -It is possible to restrict which tests to run by providing their names in -the command line. -For example, this would execute the tests for the +It is possible to restrict which tests to run by providing their +names, or a portion of their path, on the command line. +For example, this would execute all of the tests provided for the .Xr cp 1 and -.Xr cut 1 +.Xr stat 1 utilities: .Bd -literal -offset indent -$ kyua test -k /usr/tests/Kyuafile bin/cp usr.bin/cut +$ cd /usr/tests +$ kyua test bin/cp usr.bin/stat +.Ed +.Pp +This would execute only one of the two test programs provided for +.Xr stat 1 : +.Bd -literal -offset indent +$ cd /usr/tests +$ kyua test usr.bin/stat/stat_test +.Ed +.Pp +This would execute just a single test case: +.Bd -literal -offset indent +$ cd /usr/tests +$ kyua test usr.bin/stat/stat_test:t_flag +.Ed +.Pp +Finally, this would execute that test case in debug mode: +.Bd -literal -offset indent +$ cd /usr/tests +$ kyua debug -p usr.bin/stat/stat_test:t_flag .Ed +.Pp +The +.Fl p +option tells Kyua to pause before cleanup so you can inspect the +temporary directory to better understand why the test failed. +.Pp +Note that some tests may require root privileges to execute: +.Bd -literal -offset indent +$ cd /usr/tests +$ kyua debug usr.bin/stat/stat_test:h_flag +usr.bin/stat/stat_test:h_flag -> skipped: Requires root privileges +$ sudo kyua debug usr.bin/stat/stat_test:h_flag +[...] +usr.bin/stat/stat_test:h_flag -> passed +.Ed +.Pp +Conversely, some tests will only work correctly if run as an +unprivileged user. +This will normally be noted in the test's metadata, causing Kyua to +automatically drop privileges before running the test. .Ss Obtaining reports of the tests execution Additional information about the test results can be retrieved by using Kyua's various reporting commands. -For example, the following would print a plain-text report of the executed -tests and show which ones failed: +For example, the following would print a plain-text report of the +tests executed in the latest test run and show which ones failed: +.Bd -literal -offset indent +$ kyua report --verbose +.Ed +.Pp +To show the results of an arbitrary test run, use the +.Fl r +option to specify which results file to read: +.Bd -literal -offset indent +$ kyua report --verbose \\ + -r ~/.kyua/store/results.usr_tests.20260417-173009-335060.db +.Ed +.Pp +Keep in mind that if the tests were run as root, the results will have +been stored in root's +.Pa kyua +directory, and the easiest way to access them will be to run the +.Cm report +command as root as well: .Bd -literal -offset indent -$ kyua report --verbose -r <.db file from output of test> +$ cd /usr/tests +$ sudo kyua test usr.bin/stat +$ sudo kyua report --verbose .Ed .Pp This example would generate an HTML report ready to be published on a @@ -207,8 +277,14 @@ System-wide configuration file for User-specific configuration file for .Xr kyua 1 ; overrides the system file. -.It Pa ~/.kyua/store.db -Default result database used by Kyua. +.It Pa ~/.kyua/logs/ +Default location of Kyua debug logs (one +.Pa .log +file per test run). +.It Pa ~/.kyua/store/ +Default location of Kyua test results (one +.Pa .db +file per test run). .It Pa /usr/tests/ Location of the .Fx