On Thu, Jun 23, 2016 at 12:34 PM, Anand Jain <anand.jain@xxxxxxxxxx> wrote: > > > On 06/23/2016 07:18 PM, Eryu Guan wrote: >> >> On Thu, Jun 23, 2016 at 07:03:59PM +0800, Anand Jain wrote: >>> >>> >>> >>> On 06/23/2016 06:53 PM, Eryu Guan wrote: >> >> [snip] >>>>> >>>>> diff --git a/common/rc b/common/rc >>>>> index a44fb8750220..2a10fbb2d341 100644 >>>>> --- a/common/rc >>>>> +++ b/common/rc >>>>> @@ -3114,6 +3114,17 @@ _min_dio_alignment() >>>>> fi >>>>> } >>>>> >>>>> +run_check_dontfail() >>>>> +{ >>>>> + echo "# $@" >> $seqres.full 2>&1 >>>>> + "$@" >> $seqres.full 2>&1 || echo "failed: '$@'" >>>>> +} >>>>> + >>>>> +_runnt_btrfs_util_prog() >>>>> +{ >>>>> + run_check_dontfail $BTRFS_UTIL_PROG $* >>>>> +} >>>>> + >>>>> run_check() >>>>> { >>>>> echo "# $@" >> $seqres.full 2>&1 >>>>> diff --git a/tests/btrfs/006 b/tests/btrfs/006 >>>>> index 715fd80fb6fc..9d1fe09e07de 100755 >>>>> --- a/tests/btrfs/006 >>>>> +++ b/tests/btrfs/006 >>>>> @@ -79,7 +79,7 @@ echo "== Show filesystem by UUID" >>>>> $BTRFS_UTIL_PROG filesystem show $UUID | _filter_btrfs_filesystem_show >>>>> $TOTAL_DEVS $UUID >>>>> >>>>> echo "== Sync filesystem" >>>>> -$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT | _filter_scratch >>>>> +_runnt_btrfs_util_prog filesystem sync $SCRATCH_MNT >>>> >>>> >>>> Still, I don't think this helper is necessary. >>>> >>>> $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT >/dev/null >>>> >>>> doesn't _fail on failure, output error messages breaks golden image, and >>>> is much simpler. Do I miss anything? >>> >>> >>> runnt_btrfs_util_prog() checks the return status of the command, >>> if failed (!0) it will echo so to break the golden image. >> >> >> So it fails silently now? (return non-zero value and print no error >> message) That seems a btrfs-progs bug to me.. It should print error >> messages to stderr on failure, so we don't have to check the return >> value explicitly. > > > For programming interfaces I would rather depend more on the return > value, than the UI/error strings. That's precisely why both error messages to stderr *and* return values are used. For scripts you always have the option to ignore stderr through redirection to /dev/null and check only the return value. Also _runnt_btrfs_util_prog filesystem is, in my opinion, a terrible name. What does "runnt" means? > > Thanks, Anand > > >> Thanks, >> Eryu >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in >> the body of a message to majordomo@xxxxxxxxxxxxxxx >> More majordomo info at http://vger.kernel.org/majordomo-info.html >> > -- > To unsubscribe from this list: send the line "unsubscribe fstests" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Filipe David Manana, "Reasonable men adapt themselves to the world. Unreasonable men adapt the world to themselves. That's why all progress depends on unreasonable men." -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html