From patchwork Wed May 21 17:20:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Buchbinder X-Patchwork-Id: 4218101 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 086DBBEEAB for ; Wed, 21 May 2014 17:20:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 29546202E9 for ; Wed, 21 May 2014 17:20:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48CB220158 for ; Wed, 21 May 2014 17:20:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752807AbaEURUg (ORCPT ); Wed, 21 May 2014 13:20:36 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:46054 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752766AbaEURUf (ORCPT ); Wed, 21 May 2014 13:20:35 -0400 Received: by mail-pd0-f170.google.com with SMTP id g10so1597406pdj.1 for ; Wed, 21 May 2014 10:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=om2U1I3gEIap6Cy5mgybcK99P+xw7rYS69dfuX3jal0=; b=YVMwBmipycOomO+JVnLVJVEWvsPTxqbsiJ6BNlClfzKHUL8qbBUZkjBoXVA2JNZrPr 99zRL/L9Rt9aZbfPvNIMXOhZOlI93JWkDrgZjXG2LgTMfKnyUG9o4+RS43aFb+FGK8Ux SIeAeMyXF+dFU8iM4JEQDFAfeMmyXvYT5JsVs+cLh/7PrBTxKydilR2xHJWw9TqchMc3 BY76/0IKfe+tdE747l0W0SnyCasUmM9tic9pUtzzlG5JrciMdHj1Az1kHs8e6wZnmy/Z EksaGNd4kr8b3IurTd+7Bj3Didx5ahQaFuCUxUIETTCrvostI91ctAlXsfOOx+a9dF1C ac0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=om2U1I3gEIap6Cy5mgybcK99P+xw7rYS69dfuX3jal0=; b=Cc8E/S26d2UKe+H2MqWUmnTvqH3n/2cZqd6QcggZ6Iir3i7dNxgk95JF8f0w/v5neW mo00wfQ0n+pmUcNsM6WeMQGn6ZtgbdNjtJ0AiCvM/To257PS8HhGRtManCReMv+A9yDz aNT0r1LTdGS7CE5R2DkXPG8HCTXPKQSOivBmCeI9pRoETo7f0c2nGN0mqwlMYW7GodVJ G34FOoUFp+y90gqRrhjh13/9aij7nG8qGVxu5TT737ftd0OMH13u4pSeQ6WcNAtJJdyZ ofO+GQLkWMytjeGfE84DUI5yBa9icBkRd6PvE49h3KAn2VpEXvJCTxfRG/UJ/5M29eO5 rWyA== X-Gm-Message-State: ALoCoQmvsWNr9BInR+608ogcv3WSZDopPCrde10YxDZHRtczta/WxKY2ozduYI1wHkoTEWOg50vHV2DOEHYojeFDLwHR9KPcfpNSKY8Hah3MNsqLD6u8jQcXdJDCiDIgi1AAplxE2RKYZKARvJoJKaLxfbQRGIfB3g== X-Received: by 10.68.102.34 with SMTP id fl2mr59778743pbb.2.1400692835169; Wed, 21 May 2014 10:20:35 -0700 (PDT) Received: from abuchbinder-glaptop.corp.google.com ([172.19.248.194]) by mx.google.com with ESMTPSA id ih6sm9052016pbc.22.2014.05.21.10.20.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 21 May 2014 10:20:34 -0700 (PDT) From: Adam Buchbinder To: linux-btrfs@vger.kernel.org Cc: dave@jikos.cz, Adam Buchbinder Subject: [PATCH] Add some simple end-to-end tests for btrfs-convert. Date: Wed, 21 May 2014 10:20:27 -0700 Message-Id: <1400692827-14606-1-git-send-email-abuchbinder@google.com> X-Mailer: git-send-email 1.9.1.423.g4596e3a Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP These use the system's mke2fs, and don't require loop devices or root privileges. They don't pick up anything with the default flags right now, but they do pick up some sanitizer issues when the tools are compiled with any of -fsanitize={address,memory,thread}. Signed-off-by: Adam Buchbinder --- Makefile | 2 +- tests/convert-tests.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/convert-tests.sh diff --git a/Makefile b/Makefile index da05197..8f002f3 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ libbtrfs_objects = send-stream.o send-utils.o rbtree.o btrfs-list.o crc32c.o \ libbtrfs_headers = send-stream.h send-utils.h send.h rbtree.h btrfs-list.h \ crc32c.h list.h kerncompat.h radix-tree.h extent-cache.h \ extent_io.h ioctl.h ctree.h btrfsck.h -TESTS = fsck-tests.sh +TESTS = fsck-tests.sh convert-tests.sh INSTALL = install prefix ?= /usr/local diff --git a/tests/convert-tests.sh b/tests/convert-tests.sh new file mode 100644 index 0000000..87369c5 --- /dev/null +++ b/tests/convert-tests.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# +# convert ext2/3/4 images to btrfs images, and make sure the results are +# clean. +# + +here=`pwd` + +_fail() +{ + echo "$*" | tee -a convert-tests-results.txt + exit 1 +} + +rm -f convert-tests-results.txt +rm -f test.img + +test(){ + echo " [TEST] $1" + shift + echo "creating ext image with: $*" >> convert-tests-results.txt + # 256MB is the smallest acceptable btrfs image. + dd if=/dev/zero of=$here/test.img bs=1024 count=$((256*1024)) \ + >> convert-tests-results.txt 2>&1 || _fail "dd failed" + $* -F $here/test.img >> convert-tests-results.txt 2>&1 \ + || _fail "filesystem create failed" + $here/btrfs-convert $here/test.img >> convert-tests-results.txt 2>&1 \ + || _fail "btrfs-convert failed" + $here/btrfsck $here/test.img >> convert-tests-results.txt 2>&1 \ + || _fail "btrfsck detected errors" +} + +test "ext2, 4k blocksize" mke2fs -b 4096 +test "ext3, 4k blocksize" mke2fs -j -b 4096 +test "ext4, 4k blocksize" mke2fs -t ext4 -b 4096