From patchwork Mon Jan 20 07:09:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 11341153 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E9B8924 for ; Mon, 20 Jan 2020 07:09:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E2182073A for ; Mon, 20 Jan 2020 07:09:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725872AbgATHJo (ORCPT ); Mon, 20 Jan 2020 02:09:44 -0500 Received: from mx2.suse.de ([195.135.220.15]:34642 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbgATHJo (ORCPT ); Mon, 20 Jan 2020 02:09:44 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B51C6AF84; Mon, 20 Jan 2020 07:09:42 +0000 (UTC) From: Qu Wenruo To: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [PATCH 1/2] fstests: Always dump dmesg for failed test cases Date: Mon, 20 Jan 2020 15:09:37 +0800 Message-Id: <20200120070938.30247-1-wqu@suse.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org When hard-to-hit bugs happened, we really want every piece of info to help us debugging. Although we already have KEEP_DMESG config, not everyone is utilizing it, thus when hard-to-hit bugs happened, one could only set it and retry until next hit. This patch will change the behavior by always dumping the dmesg for failed tests, so that developers can always get extra info from any failure. Signed-off-by: Qu Wenruo --- check | 3 +++ 1 file changed, 3 insertions(+) diff --git a/check b/check index 2e148e5776e5..e580b2249f06 100755 --- a/check +++ b/check @@ -840,6 +840,9 @@ for section in $HOST_OPTIONS_SECTIONS; do # make sure we record the status of the last test we ran. if $err ; then + if [ ! -f $seqres.dmesg ]; then + _dmesg_since_test_start >$seqres.dmesg + fi bad="$bad $seqnum" n_bad=`expr $n_bad + 1` tc_status="fail" From patchwork Mon Jan 20 07:09:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 11341157 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E9D8F17EA for ; Mon, 20 Jan 2020 07:09:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D081D2077C for ; Mon, 20 Jan 2020 07:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726148AbgATHJr (ORCPT ); Mon, 20 Jan 2020 02:09:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:34666 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbgATHJr (ORCPT ); Mon, 20 Jan 2020 02:09:47 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 20889AED5; Mon, 20 Jan 2020 07:09:45 +0000 (UTC) From: Qu Wenruo To: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org Subject: [PATCH 2/2] fstests: btrfs: Fix a bug where test case can't grab the 2nd device when glob is used Date: Mon, 20 Jan 2020 15:09:38 +0800 Message-Id: <20200120070938.30247-2-wqu@suse.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200120070938.30247-1-wqu@suse.com> References: <20200120070938.30247-1-wqu@suse.com> MIME-Version: 1.0 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org If SCRATCH_DEV_POOL is definted using glob, e.g. SCRATCH_DEV_POOL="/dev/mapper/test-scratch[123456]", then btrfs/175 will fail like this: btrfs/175 15s ... - output mismatch (see results//btrfs/175.out.bad) --- tests/btrfs/175.out 2019-10-22 15:18:14.085632007 +0800 +++ results//btrfs/175.out.bad 2020-01-20 14:53:56.518567916 +0800 @@ -6,3 +6,4 @@ Single on multiple devices swapon: SCRATCH_MNT/swap: swapon failed: Invalid argument Single on one device +ERROR: checking status of : No such file or directory ... (Run 'diff -u tests/btrfs/175.out results//btrfs/175.out.bad' to see the entire diff) This is caused by the extra quotation mark (and the complexity nature of bash glob). # SCRATCH_DEV_POOL="/dev/mapper/test-scratch[123]" # echo ${SCRATCH_DEV_POOL} /dev/mapper/test-scratch1 /dev/mapper/test-scratch2 /dev/mapper/test-scratch3 # echo "${SCRATCH_DEV_POOL}" /dev/mapper/test-scratch[123] To fix the problem, remove the quotation mark out of ${SCRATCH_DEV_POOL} or $SCRATCH_DEV_POOL for all related test cases. Signed-off-by: Qu Wenruo --- The weirdest thing is, only btrfs/17[56], all other related test cases pass without any problem. Maybe it's time to provide a proper wrapper to do such thing? --- tests/btrfs/140 | 2 +- tests/btrfs/141 | 2 +- tests/btrfs/142 | 2 +- tests/btrfs/143 | 2 +- tests/btrfs/157 | 2 +- tests/btrfs/158 | 2 +- tests/btrfs/175 | 2 +- tests/btrfs/176 | 6 +++--- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/btrfs/140 b/tests/btrfs/140 index f0db8022cb48..0e6c91019854 100755 --- a/tests/btrfs/140 +++ b/tests/btrfs/140 @@ -65,7 +65,7 @@ get_devid() get_device_path() { local devid=$1 - echo "$SCRATCH_DEV_POOL" | $AWK_PROG "{print \$$devid}" + echo $SCRATCH_DEV_POOL | $AWK_PROG "{print \$$devid}" } _scratch_dev_pool_get 2 diff --git a/tests/btrfs/141 b/tests/btrfs/141 index c8c184ba29b0..5678e6513f80 100755 --- a/tests/btrfs/141 +++ b/tests/btrfs/141 @@ -65,7 +65,7 @@ get_devid() get_device_path() { local devid=$1 - echo "$SCRATCH_DEV_POOL" | $AWK_PROG "{print \$$devid}" + echo $SCRATCH_DEV_POOL | $AWK_PROG "{print \$$devid}" } _scratch_dev_pool_get 2 diff --git a/tests/btrfs/142 b/tests/btrfs/142 index db0a3377a1ed..ae480352c4d9 100755 --- a/tests/btrfs/142 +++ b/tests/btrfs/142 @@ -66,7 +66,7 @@ get_devid() get_device_path() { local devid=$1 - echo "$SCRATCH_DEV_POOL" | $AWK_PROG "{print \$$devid}" + echo $SCRATCH_DEV_POOL | $AWK_PROG "{print \$$devid}" } start_fail() diff --git a/tests/btrfs/143 b/tests/btrfs/143 index 0388a52899c9..9e1e7ea0874d 100755 --- a/tests/btrfs/143 +++ b/tests/btrfs/143 @@ -73,7 +73,7 @@ get_devid() get_device_path() { local devid=$1 - echo "$SCRATCH_DEV_POOL" | $AWK_PROG "{print \$$devid}" + echo $SCRATCH_DEV_POOL | $AWK_PROG "{print \$$devid}" } SYSFS_BDEV=`_sysfs_dev $SCRATCH_DEV` diff --git a/tests/btrfs/157 b/tests/btrfs/157 index 634370b97ec0..c60d05ce36f3 100755 --- a/tests/btrfs/157 +++ b/tests/btrfs/157 @@ -70,7 +70,7 @@ get_devid() get_device_path() { local devid=$1 - echo "$SCRATCH_DEV_POOL" | $AWK_PROG "{print \$$devid}" + echo $SCRATCH_DEV_POOL | $AWK_PROG "{print \$$devid}" } _scratch_dev_pool_get 4 diff --git a/tests/btrfs/158 b/tests/btrfs/158 index d6df9eaa7dea..179c620b223f 100755 --- a/tests/btrfs/158 +++ b/tests/btrfs/158 @@ -62,7 +62,7 @@ get_devid() get_device_path() { local devid=$1 - echo "$SCRATCH_DEV_POOL" | $AWK_PROG "{print \$$devid}" + echo $SCRATCH_DEV_POOL | $AWK_PROG "{print \$$devid}" } _scratch_dev_pool_get 4 diff --git a/tests/btrfs/175 b/tests/btrfs/175 index d13be3e95ed4..e1c3c28fe5a4 100755 --- a/tests/btrfs/175 +++ b/tests/btrfs/175 @@ -63,7 +63,7 @@ _scratch_mount # Create the swap file, then add the device. That way we know it's all on one # device. _format_swapfile "$SCRATCH_MNT/swap" $(($(get_page_size) * 10)) -scratch_dev2="$(echo "${SCRATCH_DEV_POOL}" | awk '{ print $2 }')" +scratch_dev2="$(echo ${SCRATCH_DEV_POOL} | awk '{ print $2 }')" $BTRFS_UTIL_PROG device add -f "$scratch_dev2" "$SCRATCH_MNT" swapon "$SCRATCH_MNT/swap" 2>&1 | _filter_scratch swapoff "$SCRATCH_MNT/swap" > /dev/null 2>&1 diff --git a/tests/btrfs/176 b/tests/btrfs/176 index 196ba2b8bdf6..c2d67c6f807a 100755 --- a/tests/btrfs/176 +++ b/tests/btrfs/176 @@ -39,9 +39,9 @@ _require_scratch_swapfile # We check the filesystem manually because we move devices around. rm -f "${RESULT_DIR}/require_scratch" -scratch_dev1="$(echo "${SCRATCH_DEV_POOL}" | awk '{ print $1 }')" -scratch_dev2="$(echo "${SCRATCH_DEV_POOL}" | awk '{ print $2 }')" -scratch_dev3="$(echo "${SCRATCH_DEV_POOL}" | awk '{ print $3 }')" +scratch_dev1="$(echo ${SCRATCH_DEV_POOL} | awk '{ print $1 }')" +scratch_dev2="$(echo ${SCRATCH_DEV_POOL} | awk '{ print $2 }')" +scratch_dev3="$(echo ${SCRATCH_DEV_POOL} | awk '{ print $3 }')" echo "Remove device" _scratch_mkfs >> $seqres.full 2>&1