From patchwork Tue Oct 11 22:39:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugene Syromyatnikov X-Patchwork-Id: 9372177 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8ABC6607FD for ; Wed, 12 Oct 2016 07:48:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C31F29CDF for ; Wed, 12 Oct 2016 07:48:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70FE529CED; Wed, 12 Oct 2016 07:48:14 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3ECF529CDF for ; Wed, 12 Oct 2016 07:48:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9C7k57K008625; Wed, 12 Oct 2016 03:46:05 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9BMdh43009594 for ; Tue, 11 Oct 2016 18:39:43 -0400 Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9BMdg38020817 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 11 Oct 2016 18:39:42 -0400 Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9DE9413AA1; Tue, 11 Oct 2016 22:39:40 +0000 (UTC) Received: by mail-lf0-f68.google.com with SMTP id x79so5523719lff.2; Tue, 11 Oct 2016 15:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qkj0rM+9JQaDhZ/SghMdsZhvnvXR0wYnXBA8dtgTcGY=; b=iSRdLXFSlVon+g1/tHsJ7pwOuSVlw1areY6GjlwVf9zF0B8a4KIEEauhsnK8rbsqEg I4kIDKWXm/mb2ylWWkB4Bkw/91NZnqVDKDO9/Xra3rwbC3RVWZLad3KQVbxLSTSCnmyX Lm7k2v/S6+klUCnKruhocRjQjrN+DxWXSPhXw77Wa6RsvSVVSvNAS3aNj9zOufOilv51 gl50wmy9uCeRb1+t23Sz0Y59pCS2tiHHyRsVk0ap5AujrszWWy5Nz42HEvvi0FBYaCUL IoWMy6zaCz2AR8Tn42j2B5Y64PqgFLWZuRfMxS7ZVWzOyM6o/RnzA8NVfkjNVR/EXWW6 LZXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qkj0rM+9JQaDhZ/SghMdsZhvnvXR0wYnXBA8dtgTcGY=; b=BRwaJWZyfPDY9uavwpmpSBByjqyAg2E/ExGCp7Ec+rlR9yMVM0Q+rRo7d/4do5t4E1 i3lS1I2m070nixCCxY7h8bq76HyIOY6afld7cgb/nOxpqzdzgTSdDJy5+HS1U+K9fKrR Wv5hQUqJL6G6ajtgrYZSTQoMLa808FeEpLrUSQKc+Y7VWwvBNlEW6A5nEyyhKJsxWdad YPfsDZsCU4whd4+AHfeD46rxAtb3EfMPcRqEs8JCYcVultmF7+zq8r9kqLGWgoKXsj/0 Xn/EH4XdjeshyXAcs1FW97sfoIzegKqVhyTQ0lgCqbw4rhnIJ19vXiZk1YdmODaoGL92 iPeg== X-Gm-Message-State: AA6/9RnTANAu5KfA81w66DKnFbQSOJ7sEA+vO3OsXaywr9bD3aRARWNrBrn/CaGR5/odSA== X-Received: by 10.25.41.137 with SMTP id p131mr4982081lfp.183.1476225578887; Tue, 11 Oct 2016 15:39:38 -0700 (PDT) Received: from obsidian (broadband-46-188-15-144.2com.net. [46.188.15.144]) by smtp.gmail.com with ESMTPSA id f198sm1563170lfe.10.2016.10.11.15.39.37 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 11 Oct 2016 15:39:38 -0700 (PDT) Date: Wed, 12 Oct 2016 01:39:36 +0300 From: Eugene Syromyatnikov To: strace-devel@lists.sourceforge.net Message-ID: <20161011223936.GA9597@obsidian> References: <20161005.192828.566127461630656590.yamato@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161005.192828.566127461630656590.yamato@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 11 Oct 2016 22:39:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 11 Oct 2016 22:39:41 +0000 (UTC) for IP:'209.85.215.68' DOMAIN:'mail-lf0-f68.google.com' HELO:'mail-lf0-f68.google.com' FROM:'evgsyr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.18 * (BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.215.68 mail-lf0-f68.google.com 209.85.215.68 mail-lf0-f68.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Wed, 12 Oct 2016 03:45:31 -0400 Cc: dm-devel@redhat.com, mpatocka@redhat.com, yamato@redhat.com Subject: [dm-devel] [PATCH 9/9] tests: Add checks for abbreviated DM ioctl output X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP --- tests/.gitignore | 1 + tests/Makefile.am | 2 + tests/ioctl_dm-v.c | 2 + tests/ioctl_dm-v.test | 12 ++++ tests/ioctl_dm.c | 178 +++++++++++++++++++++++++++++++++++++++---------- tests/ioctl_dm.test | 2 +- 6 files changed, 160 insertions(+), 37 deletions(-) create mode 100644 tests/ioctl_dm-v.c create mode 100755 tests/ioctl_dm-v.test diff --git a/tests/.gitignore b/tests/.gitignore index 9045117..b2c5434 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -104,6 +104,7 @@ inet-cmsg ioctl ioctl_block ioctl_dm +ioctl_dm-v ioctl_evdev ioctl_evdev-v ioctl_mtd diff --git a/tests/Makefile.am b/tests/Makefile.am index 2405415..61b6db7 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -164,6 +164,7 @@ check_PROGRAMS = \ ioctl \ ioctl_block \ ioctl_dm \ + ioctl_dm-v \ ioctl_evdev \ ioctl_evdev-v \ ioctl_mtd \ @@ -513,6 +514,7 @@ DECODER_TESTS = \ ioctl.test \ ioctl_block.test \ ioctl_dm.test \ + ioctl_dm-v.test \ ioctl_evdev.test \ ioctl_evdev-v.test \ ioctl_mtd.test \ diff --git a/tests/ioctl_dm-v.c b/tests/ioctl_dm-v.c new file mode 100644 index 0000000..d95058f --- /dev/null +++ b/tests/ioctl_dm-v.c @@ -0,0 +1,2 @@ +#define VERBOSE 1 +#include "ioctl_dm.c" diff --git a/tests/ioctl_dm-v.test b/tests/ioctl_dm-v.test new file mode 100755 index 0000000..4f6d64c --- /dev/null +++ b/tests/ioctl_dm-v.test @@ -0,0 +1,12 @@ +#!/bin/sh + +# Check abbreviated decoding of DM* ioctls. + +. "${srcdir=.}/init.sh" + +run_prog > /dev/null +run_strace -a16 -s9 -veioctl $args > "$EXP" +check_prog grep +grep -v '^ioctl([012],' < "$LOG" > "$OUT" +match_diff "$OUT" "$EXP" +rm -f "$EXP" "$OUT" diff --git a/tests/ioctl_dm.c b/tests/ioctl_dm.c index 0b2c5a7..2fcd430 100644 --- a/tests/ioctl_dm.c +++ b/tests/ioctl_dm.c @@ -11,6 +11,10 @@ # include # include +# ifndef VERBOSE +# define VERBOSE 0 +# endif + # define STR32 "AbCdEfGhIjKlMnOpQrStUvWxYz012345" static const char str129[] = STR32 STR32 STR32 STR32 "6"; @@ -102,6 +106,7 @@ init_dm_target_spec(struct dm_target_spec *ptr, uint32_t id) ptr->target_type[id % (sizeof(ptr->target_type) + 1)] = '\0'; } +# if VERBOSE static void print_dm_target_spec(struct dm_target_spec *ptr, uint32_t id) { @@ -112,6 +117,7 @@ print_dm_target_spec(struct dm_target_spec *ptr, uint32_t id) (int) (id % (sizeof(ptr->target_type) + 1)), str129 + id % (sizeof(str129) - sizeof(ptr->target_type))); } +# endif /* VERBOSE */ # define ARG_STR(_arg) (_arg), #_arg @@ -303,9 +309,14 @@ main(void) printf("ioctl(-1, DM_TABLE_LOAD, " "{version=4.1.2, data_size=%u, data_start=%u, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", " - "target_count=1, flags=0, {sector_start=16, " - "length=32, target_type=\"tgt\", string=\"tparams\"}}) = " - "-1 EBADF (%m)\n", s.ioc.data_size, s.ioc.data_start); + "target_count=1, flags=0, " +# if VERBOSE + "{sector_start=16, length=32, target_type=\"tgt\", " + "string=\"tparams\"}" +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", s.ioc.data_size, s.ioc.data_start); /* No targets */ init_s(dm_arg, sizeof(*dm_arg) - sizeof(dm_arg->data), @@ -328,8 +339,12 @@ main(void) "{version=4.1.2, data_size=%zu, data_start=%u, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", " "target_count=1234, flags=0, " - "/* misplaced struct dm_target_spec */ ...}) = -1 EBADF (%m)\n", - sizeof(*dm_arg), 0xfffffff8); +# if VERBOSE + "/* misplaced struct dm_target_spec */ ..." +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", sizeof(*dm_arg), 0xfffffff8); /* Inaccessible pointer */ init_s(&dm_arg_open1->ioc, offsetof(struct dm_table_open_test, target1), @@ -340,11 +355,19 @@ main(void) printf("ioctl(-1, DM_TABLE_LOAD, " "{version=4.1.2, data_size=%zu, data_start=%zu, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", " - "target_count=3735936673, flags=0, %p}) = -1 EBADF (%m)\n", - sizeof(*dm_arg_open1), - offsetof(struct dm_table_open_test, target1), - (char *) dm_arg_open1 + - offsetof(struct dm_table_open_test, target1)); + "target_count=3735936673, flags=0, " +# if VERBOSE + "%p" +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", sizeof(*dm_arg_open1), + offsetof(struct dm_table_open_test, target1) +# if VERBOSE + , (char *) dm_arg_open1 + + offsetof(struct dm_table_open_test, target1) +# endif /* VERBOSE */ + ); /* Inaccessible string */ init_s(&dm_arg_open2->ioc, offsetof(struct dm_table_open_test, param1), @@ -363,13 +386,18 @@ main(void) "target_count=2, flags=0, ", sizeof(*dm_arg_open2), offsetof(struct dm_table_open_test, target1)); +# if VERBOSE print_dm_target_spec(&dm_arg_open2->target1, 7); - errno = saved_errno; - printf("%p}, %p}) = -1 EBADF (%m)\n", + printf("%p}, %p", (char *) dm_arg_open2 + offsetof(struct dm_table_open_test, param1), (char *) dm_arg_open2 + offsetof(struct dm_table_open_test, target3)); +# else /* !VERBOSE */ + printf("..."); +# endif /* VERBOSE */ + errno = saved_errno; + printf("}) = -1 EBADF (%m)\n"); /* Incorrect next */ init_s(&dm_arg_open3->ioc, offsetof(struct dm_table_open_test, target5), @@ -403,14 +431,19 @@ main(void) "target_count=4, flags=0, ", offsetof(struct dm_table_open_test, target5), offsetof(struct dm_table_open_test, target0)); +# if VERBOSE print_dm_target_spec(&dm_arg_open3->target0, 9); printf("\"\"}, "); print_dm_target_spec(&dm_arg_open3->target1, 15); printf("\"\\377\"}, "); print_dm_target_spec(&dm_arg_open3->target1, 42); errno = saved_errno; - printf("\"\\1\\2\"}, /* misplaced struct dm_target_spec */ ...}) = " - "-1 EBADF (%m)\n"); + printf("\"\\1\\2\"}, /* misplaced struct dm_target_spec */ ..."); +# else /* !VERBOSE */ + printf("..."); +# endif /* VERBOSE */ + errno = saved_errno; + printf("}) = -1 EBADF (%m)\n"); #define FILL_DM_TARGET(id, id_next) \ do { \ @@ -451,6 +484,7 @@ main(void) "target_count=3134983661, flags=0, ", sizeof(*dm_arg_open3), offsetof(struct dm_table_open_test, target0)); +# if VERBOSE PRINT_DM_TARGET(0); PRINT_DM_TARGET(1); PRINT_DM_TARGET(2); @@ -460,6 +494,7 @@ main(void) PRINT_DM_TARGET(6); PRINT_DM_TARGET(7); PRINT_DM_TARGET(8); +# endif /* VERBOSE */ errno = saved_errno; printf("...}) = -1 EBADF (%m)\n"); @@ -473,7 +508,12 @@ main(void) printf("ioctl(-1, DM_TARGET_MSG, " "{version=4.1.2, data_size=%u, data_start=%u, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, " - "{sector=4660, message=\"long targ\"...}}) = -1 EBADF (%m)\n", +# if VERBOSE + "{sector=4660, message=\"long targ\"...}" +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", s.ioc.data_size, s.ioc.data_start); /* Invalid data_start */ @@ -484,7 +524,12 @@ main(void) printf("ioctl(-1, DM_TARGET_MSG, " "{version=4.1.2, data_size=%zu, data_start=%zu, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, " - "/* misplaced struct dm_target_msg */}) = -1 EBADF (%m)\n", +# if VERBOSE + "/* misplaced struct dm_target_msg */" +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", sizeof(*dm_arg), sizeof(*dm_arg) - sizeof(dm_arg->data)); /* Invalid data_start */ @@ -494,7 +539,12 @@ main(void) printf("ioctl(-1, DM_TARGET_MSG, " "{version=4.1.2, data_size=%zu, data_start=%u, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, " - "/* misplaced struct dm_target_msg */}) = -1 EBADF (%m)\n", +# if VERBOSE + "/* misplaced struct dm_target_msg */" +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", sizeof(*dm_arg), 0xffffffff); /* Inaccessible pointer */ @@ -504,10 +554,19 @@ main(void) ioctl(-1, DM_TARGET_MSG, dm_arg); printf("ioctl(-1, DM_TARGET_MSG, " "{version=4.1.2, data_size=%zu, data_start=%zu, " - "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, %p}) " - "= -1 EBADF (%m)\n", + "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, " +# if VERBOSE + "%p" +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", sizeof(*dm_arg) + sizeof(struct dm_target_msg), - sizeof(*dm_arg), (char *) dm_arg + sizeof(*dm_arg)); + sizeof(*dm_arg) +# if VERBOSE + , (char *) dm_arg + sizeof(*dm_arg) +# endif /* VERBOSE */ + ); /* Inaccessible string */ init_s(&dm_arg_msg->ioc, sizeof(*dm_arg_msg), @@ -515,29 +574,41 @@ main(void) dm_arg_msg->ioc.data_size = sizeof(*dm_arg_msg) + 1; dm_arg_msg->msg.sector = (__u64) 0xdeadbeeffacef157ULL; ioctl(-1, DM_TARGET_MSG, dm_arg_msg); + saved_errno = errno; printf("ioctl(-1, DM_TARGET_MSG, " "{version=4.1.2, data_size=%zu, data_start=%zu, " - "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, " - "{sector=%" PRI__u64 ", message=%p}}) " - "= -1 EBADF (%m)\n", + "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, ", sizeof(*dm_arg_msg) + 1, - offsetof(struct dm_target_msg_test, msg), + offsetof(struct dm_target_msg_test, msg)); +# if VERBOSE + printf("{sector=%" PRI__u64 ", message=%p}", (__u64) 0xdeadbeeffacef157ULL, (char *) dm_arg_msg + offsetof(struct dm_target_msg_test, msg.message)); +# else /* !VERBOSE */ + printf("..."); +# endif /* VERBOSE */ + errno = saved_errno; + printf("}) = -1 EBADF (%m)\n"); /* Zero-sied string */ init_s(&dm_arg_msg->ioc, sizeof(*dm_arg_msg), offsetof(struct dm_target_msg_test, msg)); dm_arg_msg->msg.sector = (__u64) 0xdeadbeeffacef157ULL; ioctl(-1, DM_TARGET_MSG, dm_arg_msg); + saved_errno = errno; printf("ioctl(-1, DM_TARGET_MSG, " "{version=4.1.2, data_size=%zu, data_start=%zu, " - "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, " - "{sector=%" PRI__u64 ", message=\"\"}}) " - "= -1 EBADF (%m)\n", - sizeof(*dm_arg_msg), offsetof(struct dm_target_msg_test, msg), + "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, ", + sizeof(*dm_arg_msg), offsetof(struct dm_target_msg_test, msg)); +# if VERBOSE + printf("{sector=%" PRI__u64 ", message=\"\"}", (__u64) 0xdeadbeeffacef157ULL); +# else /* !VERBOSE */ + printf("..."); +# endif /* VERBOSE */ + errno = saved_errno; + printf("}) = -1 EBADF (%m)\n"); /* DM_DEV_SET_GEOMETRY */ @@ -547,7 +618,12 @@ main(void) printf("ioctl(-1, DM_DEV_SET_GEOMETRY, " "{version=4.1.2, data_size=%u, data_start=%u, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, " - "string=\"10 20 30 \"...}) = -1 EBADF (%m)\n", +# if VERBOSE + "string=\"10 20 30 \"..." +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", s.ioc.data_size, s.ioc.data_start); @@ -560,9 +636,18 @@ main(void) printf("ioctl(-1, DM_DEV_RENAME, " "{version=4.1.2, data_size=%zu, data_start=%zu, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", event_nr=0, " - "flags=0, string=%p}) = -1 EBADF (%m)\n", - sizeof(*dm_arg), sizeof(*dm_arg) - sizeof(dm_arg->data), - (char *) dm_arg + sizeof(*dm_arg) - sizeof(dm_arg->data)); + "flags=0, " +# if VERBOSE + "string=%p" +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", + sizeof(*dm_arg), sizeof(*dm_arg) - sizeof(dm_arg->data) +# if VERBOSE + , (char *) dm_arg + sizeof(*dm_arg) - sizeof(dm_arg->data) +# endif /* VERBOSE */ + ); /* Incorrect data_start data */ init_s(&s.ioc, sizeof(s), offsetof(struct s, u)); @@ -571,7 +656,13 @@ main(void) printf("ioctl(-1, DM_DEV_RENAME, " "{version=4.1.2, data_size=%u, data_start=3735928559, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", event_nr=0, " - "flags=0, /* misplaced string */}) = -1 EBADF (%m)\n", + "flags=0, " +# if VERBOSE + "/* misplaced string */" +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", s.ioc.data_size); /* Strange but still valid data_start */ @@ -582,7 +673,13 @@ main(void) printf("ioctl(-1, DM_DEV_RENAME, " "{version=4.1.2, data_size=%u, data_start=%zu, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", event_nr=0, " - "flags=0, string=\"nn\"}) = -1 EBADF (%m)\n", + "flags=0, " +# if VERBOSE + "string=\"nn\"" +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", s.ioc.data_size, offsetof(struct dm_ioctl, name) + 1); @@ -593,7 +690,13 @@ main(void) printf("ioctl(-1, DM_DEV_RENAME, " "{version=4.1.2, data_size=%u, data_start=%u, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", event_nr=0, " - "flags=0, string=\"new long \"...}) = -1 EBADF (%m)\n", + "flags=0, " +# if VERBOSE + "string=\"new long \"..." +# else /* !VERBOSE */ + "..." +# endif /* VERBOSE */ + "}) = -1 EBADF (%m)\n", s.ioc.data_size, s.ioc.data_start); @@ -605,8 +708,11 @@ main(void) "{version=4.1.2, data_size=%u, data_start=%u, " "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", " "target_count=4294967295, flags=0, " +# if VERBOSE "{sector_start=0, length=0, target_type=\"\", string=\"\"}, " - "/* misplaced struct dm_target_spec */ ...}) = -1 EBADF (%m)\n", + "/* misplaced struct dm_target_spec */ " +# endif /* VERBOSE */ + "...}) = -1 EBADF (%m)\n", s.ioc.data_size, s.ioc.data_start); puts("+++ exited with 0 +++"); diff --git a/tests/ioctl_dm.test b/tests/ioctl_dm.test index 78866d3..6485205 100755 --- a/tests/ioctl_dm.test +++ b/tests/ioctl_dm.test @@ -5,7 +5,7 @@ . "${srcdir=.}/init.sh" run_prog > /dev/null -run_strace -a16 -s9 -veioctl $args > "$EXP" +run_strace -a16 -s9 -eioctl $args > "$EXP" check_prog grep grep -v '^ioctl([012],' < "$LOG" > "$OUT" match_diff "$OUT" "$EXP"