From: Cyril Hrubis <chrubis@suse.cz>
To: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v2 3/3] umount2/umount2_03.c: add new test
Date: Tue, 4 Aug 2015 19:52:47 +0200 [thread overview]
Message-ID: <20150804175247.GC20633@rei.suse.de> (raw)
In-Reply-To: <1436949363-8356-3-git-send-email-fenggw-fnst@cn.fujitsu.com>
Hi!
> +static void umount2_verify(void)
> +{
> + SAFE_MOUNT(cleanup, device, MNTPOINT, fs_type, 0, NULL);
> + mount_flag = 1;
> +
> + TEST(umount2(SYMLINK, UMOUNT_NOFOLLOW));
> +
> + if (TEST_RETURN == 0 || TEST_ERRNO != EINVAL) {
> + tst_resm(TFAIL | TTERRNO,
> + "umount2(2) UMOUNT_NOFOLLOW flag "
> + "performed abnormally "
> + "expected error = %d : %s",
> + EINVAL, strerror(EINVAL));
Let's keep the messages short and to the point, what about:
tst_resm(TFAIL | TTERRNO,
"umount2('symlink', UMOUNT_NOFOLLOW) failed unexpectedly, expected EINVAL");
Also it would be better if if we had separate case for the when the call
succeeded something as:
tst_resm(TFAIL, "umount2('symlink', UMOUNT_NOFOLLOW) "
"succeeded unexpectedly");
> + if (TEST_RETURN == 0)
> + mount_flag = 0;
> + goto EXIT;
> + }
> +
> + TEST(umount2(MNTPOINT, UMOUNT_NOFOLLOW));
> +
> + if (TEST_RETURN != 0) {
> + tst_resm(TFAIL | TTERRNO, "umount2(2) Failed");
> + goto EXIT;
> + }
> +
> + mount_flag = 0;
> +
> + tst_resm(TPASS, "umount2(2) Passed");
> +
> +EXIT:
> + if (mount_flag) {
> + SAFE_UMOUNT(cleanup, MNTPOINT);
> + mount_flag = 0;
> + }
> +}
Again, these are two testcases you should print two PASS/FAIL for each of
them. What about you split the verify funciton into two
umount2_verify_failure and umount2_verify_success and mount and umout
the device in each of them. That way we can make the code flow more
straightforward.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2015-08-04 17:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-15 8:36 [LTP] [PATCH v2 1/3] umount2/umount2_01.c: add new test Guangwen Feng
2015-07-15 8:36 ` [LTP] [PATCH v2 2/3] umount2/umount2_02.c: " Guangwen Feng
2015-08-04 17:27 ` Cyril Hrubis
2015-07-15 8:36 ` [LTP] [PATCH v2 3/3] umount2/umount2_03.c: " Guangwen Feng
2015-08-04 17:52 ` Cyril Hrubis [this message]
2015-07-27 10:25 ` [LTP] [PATCH v2 1/3] umount2/umount2_01.c: " Guangwen Feng
2015-08-04 17:17 ` Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150804175247.GC20633@rei.suse.de \
--to=chrubis@suse.cz \
--cc=fenggw-fnst@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox