From patchwork Mon Sep 3 10:02:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 10585677 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3ED7E920 for ; Mon, 3 Sep 2018 10:03:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 256E029499 for ; Mon, 3 Sep 2018 10:03:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19ABC294B9; Mon, 3 Sep 2018 10:03:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 794A029499 for ; Mon, 3 Sep 2018 10:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727499AbeICOW3 (ORCPT ); Mon, 3 Sep 2018 10:22:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:34908 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727505AbeICOW3 (ORCPT ); Mon, 3 Sep 2018 10:22:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 16686AF64 for ; Mon, 3 Sep 2018 10:03:02 +0000 (UTC) From: Nikolay Borisov To: linux-btrfs@vger.kernel.org Cc: Nikolay Borisov Subject: [PATCH] btrfs-progs: tests: Add test for missing device delete error value Date: Mon, 3 Sep 2018 13:02:57 +0300 Message-Id: <20180903100257.5789-1-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180903094614.2667-1-nborisov@suse.com> References: <20180903094614.2667-1-nborisov@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a test which ensures the kernel returns the correct error value when missing device removal is requested. This test verifies that kernel refactoring didn't broken the return value. Signed-off-by: Nikolay Borisov --- tests/misc-tests/011-delete-missing-device/test.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/misc-tests/011-delete-missing-device/test.sh b/tests/misc-tests/011-delete-missing-device/test.sh index 4c976421c091..b799a25c201d 100755 --- a/tests/misc-tests/011-delete-missing-device/test.sh +++ b/tests/misc-tests/011-delete-missing-device/test.sh @@ -44,6 +44,21 @@ test_delete_missing() run_check_umount_test_dev } +test_missing_error() +{ + run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$TEST_DEV" + run_check_mount_test_dev + local out + out=$(run_mustfail_stdout "Unexpected success" \ + $SUDO_HELPER "$TOP/btrfs" device remove missing "$TEST_MNT") + + if ! echo "$out" | grep -q "no missing devices found to remove"; then + _fail "IOCTL returned unexpected error value" + fi + + run_check_umount_test_dev +} + setup_loopdevs 4 prepare_loopdevs dev1=${loopdevs[1]} @@ -53,5 +68,7 @@ TEST_DEV=$dev1 test_do_mkfs -m raid1 -d raid1 test_wipefs test_delete_missing +test_missing_error + cleanup_loopdevs