public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/acct02: Check read size.
Date: Wed, 25 Sep 2019 18:14:57 +0200	[thread overview]
Message-ID: <20190925161456.GA28071@rei.lan> (raw)
In-Reply-To: <20190925135634.GA32581@dell5510>

Hi!
> >  	do {
> > -		tst_res(TINFO, "== entry %d ==", ++i);
> > -
> >  		read_bytes = SAFE_READ(0, fd, &acct_struct, acct_size);
> 
> > +		if (i == 0 && read_bytes == 0) {
> > +			tst_res(TFAIL, "acct file is empty");
> > +			goto exit;
> > +		}
> > +
> > +		if (read_bytes != acct_size) {
> > +			tst_res(TFAIL, "incomplete read %i bytes, expected %i",
> > +			        read_bytes, acct_size);
> > +			goto exit;
> > +		}
> > +
> > +		tst_res(TINFO, "== entry %d ==", ++i);
> > +
> >  		if (v3)
> >  			ret = verify_acct(&acct_struct.v3, acct_struct.v3.ac_etime);
> >  		else
> > @@ -192,6 +203,7 @@ static void run(void)
> >  	else
> >  		tst_res(TPASS, "acct() wrote correct file contents!");
> 
> > +exit:
> >  	SAFE_CLOSE(fd);
> >  }
> 
> OK, on s390 where it's failing it actually catches "incomplete read":
> 
> tst_kconfig.c:62: INFO: Parsing kernel config '/proc/config.gz'
> tst_test.c:1118: INFO: Timeout per run is 0h 05m 00s
> tst_kconfig.c:62: INFO: Parsing kernel config '/proc/config.gz'
> acct02.c:234: INFO: Verifying using 'struct acct_v3'
> acct02.c:187: INFO: == entry 1 ==
> acct02.c:147: INFO: ac_version != 3 (131)
> acct02.c:187: INFO: == entry 2 ==
> acct02.c:82: INFO: ac_comm != 'acct02_helper' ('acct02')
> acct02.c:133: INFO: ac_exitcode != 32768 (0)
> acct02.c:141: INFO: ac_ppid != 54783 (54781)
> acct02.c:147: INFO: ac_version != 3 (131)
> acct02.c:183: FAIL: incomplete read 0 bytes, expected 64

Isn't that just end-of-file? I guess that we should just break the loop
if i != 0 and read returned 0.

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2019-09-25 16:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25  9:47 [LTP] [PATCH] syscalls/acct02: Check read size Cyril Hrubis
2019-09-25 13:56 ` Petr Vorel
2019-09-25 16:14   ` Cyril Hrubis [this message]
2019-09-27 11:38   ` Cyril Hrubis
2019-09-27 12:48     ` Petr Vorel
2019-10-30  9:06   ` Jan Stancek
2019-10-30 13:03     ` Jan Stancek
2019-10-30 14:46       ` Petr Vorel
2019-10-30 17:41         ` Jan Stancek
2019-10-31  8:43           ` Li Wang
2019-10-31  8:53             ` Jan Stancek
2019-10-31  9:09               ` Petr Vorel
2019-11-01  6:03               ` Li Wang
2019-11-01  8:54                 ` Jan Stancek
2019-10-31  9:06           ` Petr Vorel

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=20190925161456.GA28071@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