From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/2] syscalls/acct01: convert to new library
Date: Fri, 5 Apr 2019 15:01:19 +0200 [thread overview]
Message-ID: <20190405130119.GB7540@rei.lan> (raw)
In-Reply-To: <20190328114700.189583-2-sspatil@android.com>
Hi!
Pushed with cosmetic changes, thanks.
> -static void setup2(void)
> +static void verify_acct(unsigned int nr)
> {
> - SAFE_SETEUID(cleanup, ltpuser->pw_uid);
> -}
> + struct test_case *tcase = &tcases[nr];
>
> -static void cleanup2(void)
> -{
> - SAFE_SETEUID(cleanup, 0);
> -}
> + if (tcase->setupfunc)
> + tcase->setupfunc();
>
> -static void cleanup(void)
> -{
> - if (acct(NULL) == -1)
> - tst_resm(TWARN | TERRNO, "acct(NULL) failed");
> + TEST(acct(tcase->filename));
>
> - if (mount_flag && tst_umount("mntpoint") < 0) {
> - tst_resm(TWARN | TERRNO,
> - "umount device:%s failed", device);
> - }
> + if (tcase->cleanfunc)
> + tcase->cleanfunc();
>
> - if (device)
> - tst_release_device(device);
> + if (TST_RET != -1)
> + tst_res(TFAIL, "acct(%s) succeeded unexpectedly",
> + tcase->filename);
I've put this block inside curly braces and added return; after the
tst_res() here so that the code flow is more clear.
> - tst_rmdir();
> + if (TST_ERR == tcase->exp_errno)
> + tst_res(TPASS | TTERRNO, "acct() failed as expected");
> + else
> + tst_res(TFAIL | TTERRNO,
> + "acct() failed, expected: %s",
> + tst_strerrno(tcase->exp_errno));
And also added curly braces around these blocks, since LKML prefers to
have them when at least one block spans across multiple lines.
--
Cyril Hrubis
chrubis@suse.cz
next prev parent reply other threads:[~2019-04-05 13:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-28 11:46 [LTP] [PATCH v2 1/2] syscalls/accept01: convert to new library Sandeep Patil
2019-03-28 11:47 ` [LTP] [PATCH v2 2/2] syscalls/acct01: " Sandeep Patil
2019-04-05 13:01 ` Cyril Hrubis [this message]
2019-04-05 14:25 ` Sandeep Patil
2019-04-05 12:00 ` [LTP] [PATCH v2 1/2] syscalls/accept01: " 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=20190405130119.GB7540@rei.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
/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