From nobody Fri Nov 11 20:45:23 2022 X-Original-To: testing@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 4N89h44c5hz4g11H for ; Fri, 11 Nov 2022 20:45:24 +0000 (UTC) (envelope-from bugzilla-noreply@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N89h43CXDz4TD1 for ; Fri, 11 Nov 2022 20:45:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668199524; 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: in-reply-to:in-reply-to:references:references; bh=cQiU9DWjqg2Qa8tETyPLrLVfKQ6tu4rAqrQ6//A3lFo=; b=jdi2mDYMB6Wdh4rjBuDjzYvG/W+Y6TcAxjp209zRlCYfPsD46dbKYQNUNhmCDeEUyWvSLB LVSI/aT/VQKSNKmWERv3Lec9UQeTerWiDzKbK/Hdd2uhAIST9DblFt7GyrCGujP9T9NGKN Da2l6kNPvjZz2h3kDfiqVOR2YayT3kcTjaVzG2BP++Q9WT+wVN+8Rac9eQMJJIYUka01x0 n3IwtkkWXDbvMU2UK6aGwpcxuvW4QlNneBaXHE2k6NxeWrzsJWhfFu4xFjvEW5wv9QOnQR 0mzCD96jALpVhkhpIhi37bHY/rD625oWC/52aJjLhM7hm4ZWNJZufvMsA7ay/g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668199524; a=rsa-sha256; cv=none; b=kv8zWlQ6LvZWR02uzXyJDKJw9PMl7fz9uzeilHsAih2CAaFYj5k4lP3iBzR9578TndMNTl PSH8AKr8+wOrG2eU6XHBoWa49GBLUiaQe6bym4Jzea/0Ra1g3v7O08zR33QvpI985FbCNN dNPzOt2AiU7LKkT+JsU9Kx6VqZPAzqZ5PDKx2VrQqvsb2P9lzCyOjsdAaQ5+UXVpgwnJfL 0TDISZeAHxnKm3i5rMew+Cm/rLb2GWvYkAoR6uzZiKvLB6hqRNvasZ6UKHNgegJrxMMy37 08sjIZ6p90j8/3ICIuefcgLoDIgm7ORS5ThSTU5z9R+fyhFo/zWFavi1fW3WyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4N89h42GjYzxLp for ; Fri, 11 Nov 2022 20:45:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 2ABKjOGg030611 for ; Fri, 11 Nov 2022 20:45:24 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2ABKjOjs030610 for testing@FreeBSD.org; Fri, 11 Nov 2022 20:45:24 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: testing@FreeBSD.org Subject: [Bug 267554] ZFS tests should avoid atf_expect_fail due to coarse integration with ATF Date: Fri, 11 Nov 2022 20:45:23 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: tests X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: testing@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Testing List-Archive: https://lists.freebsd.org/archives/freebsd-testing List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-testing@freebsd.org X-BeenThere: freebsd-testing@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D267554 --- Comment #2 from commit-hook@FreeBSD.org --- A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D11ed0a95bfa76791dc6428eb2d47a986c= 0c6f8a3 commit 11ed0a95bfa76791dc6428eb2d47a986c0c6f8a3 Author: Eric van Gyzen AuthorDate: 2022-11-03 02:42:54 +0000 Commit: Eric van Gyzen CommitDate: 2022-11-11 20:43:47 +0000 zfs tests: stop writing to arbitrary devices TL;DR: Three ZFS tests created ZFS pools on all unmounted devices list= ed in /etc/fstab, corrupting their contents. Stop that. Imagine my surprise when the ESP on my main dev/test VM would "randomly" become corrupted, making it unbootable. Three tests collect various devices from the system and try to add them to a test pool. The test expects t= his to fail because it _assumes_ these devices are in use and ZFS will correctly reject the request. My /etc/fstab has two entries for devices in /dev: /dev/gpt/swap0 none swap sw,trimonce,late /dev/gpt/esp0 /boot/efi msdosfs rw,noauto Note the `noauto` on the ESP. In a remarkable example of irony, I chose this because it should keep the ESP more protected from corruption; in fact, mounting it would have protected it from this case. The tests added all of these devices to a test pool in a _single comman= d_, expecting the command to fail. The swap device was in use, so the comm= and correctly failed, but the ESP was added and therefore corrupted. Howev= er, since the command correctly failed, the test didn't notice the ESP prob= lem. If each device had been added with its own command, the test _might_ ha= ve noticed that one of them incorrectly succeeded. However, two of these tests would not have noticed: hotspare_create_001_neg was incorrectly specified as needing the Solaris dumpadm command, so it was skipped. _Some_ of the test needs that comm= and, but it checks for its presence and runs fine without it. Due to bug 241070, zpool_add_005_pos was marked as an expected failure. Due to the coarse level of integration with ATF, this test would still "pass" even if it failed for the wrong reason. I wrote bug 267554 to reconsider the use of atf_expect_fail in these tests. Let's further consider the use of various devices found around the syst= em. In addition to devices in /etc/fstab, the tests also used mounted devic= es listed by the `mount` command. If ZFS behaves correctly, it will refuse to added mounted devices and swap devices to a pool. However, these are unit tests used by developers to ensure that ZFS still works after they modify it, so it's reasonable to expect ZFS to do the _wrong_ thing sometimes. Using random host devices is unsafe. Fix the root problem by using only the disks provided via the "disks" variable in kyua.conf. Use one to create a UFS file system and mount i= t. Use another as a swap device. Use a third as a dump device, but expect it to fail due to bug 241070. While I'm here: Due to commit 6b6e2954dd65, we can simply add a second dump device and remove it in cleanup. We no longer need to save, replace, and restore = the pre-existing dump device. The cleanup_devices function used `camcontrol inquiry` to distinguish d= isks from other devices, such as partitions. That works fine for SCSI, but = not for ATA or VirtIO block. Use `geom disk list` instead. PR: 241070 PR: 267554 Reviewed by: asomers Sponsored by: Dell Inc. Differential Revision: https://reviews.freebsd.org/D37257 tests/sys/cddl/zfs/include/libtest.kshlib | 2 +- .../zfs/tests/cli_root/zpool_add/zpool_add.kshlib | 68 ------------------= ---- .../tests/cli_root/zpool_add/zpool_add_005_pos.ksh | 29 ++++++--- .../zfs/tests/cli_root/zpool_add/zpool_add_test.sh | 3 +- .../zfs/tests/hotspare/hotspare_add_003_neg.ksh | 60 +++++++++---------- .../zfs/tests/hotspare/hotspare_create_001_neg.ksh | 60 +++++++++---------- tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh | 4 +- 7 files changed, 83 insertions(+), 143 deletions(-) --=20 You are receiving this mail because: You are the assignee for the bug.=